Wrong Imports in Generated `.d.ts` on Windows
See original GitHub issueAs the picture shown, the generated file index.esm.d.ts
contains OS-specific path imports:
More importantly, Suggestion
interface is redefined…
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The issue has been fixed and released in v1.1.55. Thanks for reporting it!
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 newImportDeclarations
andExportDeclarations
which means that stuff likeimport {foo} from "\\a\\b\\c"
can happen where you would expectimport {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.