
rewriteRelativeImportExtensions does not rewrite extension if import expression has .then attached
DRANK
🔎 Search Terms rewriteRelativeImportExtensions, import expression, then 🕗 Version & Regression Information I was unable to test this on prior versions because rewriteRelativeImportExtensions is new as of 5.7. I did test in v5.8.0-beta and v5.8.0-dev.20250207 where I observed the same behavior. ⏯ Playground Link https://www.typescriptlang.org/play/?rewriteRelativeImportExtensions=true&ts=5.7.3#code/JYWwDg9gTgLgBAcgHQHoCGSYGcECg0Duaw8oksAFMupjgJS5nQxWobYINOXXv2YALAKYA7CgyA 💻 Code import './a.ts' await import('./a.ts') import('./a.ts') import('./a.ts').then() 🙁 Actual behavior import "./a.js"; // .js await import("./a.js"); // .js import("./a.js"); // .js import('./a.ts').then(); // Still .ts 🙂 Expected behavior import "./a.js"; // .js await import("./a.js"); // .js import("./a.js"); // .js import('./a.js').then(); // .js Additional information about the issue This seems very similar to https://github.com/microsoft/TypeScript/issues/60599 but I opted for a new issue because I believe the cause of that issue is the module detection which appears to be working as expected here. But the specific case of import(specifier).then() is not.
👀 github.com/microsoft/Type…