question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong Imports in Generated `.d.ts` on Windows

See original GitHub issue

As the picture shown, the generated file index.esm.d.ts contains OS-specific path imports:

image

More importantly, Suggestion interface is redefined…

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
wessbergcommented, Jun 6, 2019

The issue has been fixed and released in v1.1.55. Thanks for reporting it!

0reactions
wessbergcommented, Jun 4, 2019

I’m investigating the issue, and the issue is related to a couple of things:

  • When comparing two paths or filenames, rollup-plugin-ts always assume that they follow POSIX. For example, there are strict equality checks between generated filenames for Rollup chunks, which use the path convention of the OS, and Typescript sourcefile filenames, which are normalized to POSIX by Typescript itself. This means that some comparisons fail that wouldn’t on MacOS where everything is POSIX.

  • The path module is used heavily to normalize file paths. However, they aren’t normalized to POSIX when generating new ImportDeclarations and ExportDeclarations which means that stuff like import {foo} from "\\a\\b\\c" can happen where you would expect import {foo} from "./a/b/c" instead.

I’m working on fixing these things and I’m testing both on MacOS and Windows. I’ll keep you posted.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dynamic import in generated .d.ts file has incorrect module ...
This causes my future compilations that use this d.ts file to fail. The generated out/datastore.bundle.d.ts file includes this: declare module "projection ...
Read more >
generated declaration file (d.ts) with bad imports
These import statements are output in the d.ts declaration files. That makes the declaration files invalid because there are no sass files ...
Read more >
TSConfig Reference - Docs on every TSConfig option
This technique lets you generate types ahead of time for the non-code source files. Imports then work naturally based off the source file's...
Read more >
Module Resolution - TypeScript
Module resolution is the process the compiler uses to figure out what an import refers to. Consider an import statement like import {...
Read more >
Announcing TypeScript 4.7 - Microsoft Developer Blogs
When a .ts file is compiled as an ES module, ECMAScript import / export ... When TypeScript finds a .d.ts file in package,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found