File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed
cases/conformance/externalModules/rewriteRelativeImportExtensions Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -4306,7 +4306,7 @@ export function tryGetImportFromModuleSpecifier(node: StringLiteralLike): AnyVal
43064306
43074307/** @internal */
43084308export function shouldRewriteModuleSpecifier ( specifier : string , compilerOptions : CompilerOptions ) : boolean {
4309- return ! ! compilerOptions . rewriteRelativeImportExtensions && pathIsRelative ( specifier ) && ! isDeclarationFileName ( specifier ) ;
4309+ return ! ! compilerOptions . rewriteRelativeImportExtensions && pathIsRelative ( specifier ) && ! isDeclarationFileName ( specifier ) && hasTSFileExtension ( specifier ) ;
43104310}
43114311
43124312/** @internal */
Original file line number Diff line number Diff line change 1+ //// [tests/cases/conformance/externalModules/rewriteRelativeImportExtensions/nonTSExtensions.ts] ////
2+
3+ //// [example.json]
4+ { }
5+
6+ //// [styles.d.css.ts]
7+ export { } ;
8+
9+ //// [index.mts]
10+ import { } from "./example.json" with { type : "json" } ; // Ok
11+ import { } from "./styles.css" ; // Ok
12+
13+ //// [index.mjs]
14+ export { } ;
Original file line number Diff line number Diff line change 1+ // @module : nodenext
2+ // @rewriteRelativeImportExtensions : true
3+ // @allowArbitraryExtensions : true
4+ // @resolveJsonModule : true
5+ // @noTypesAndSymbols : true
6+
7+ // @Filename : example.json
8+ { }
9+
10+ // @Filename : styles.d.css.ts
11+ export { } ;
12+
13+ // @Filename : index.mts
14+ import { } from "./example.json" with { type : "json" } ; // Ok
15+ import { } from "./styles.css" ; // Ok
You can’t perform that action at this time.
0 commit comments