Skip to content

Commit cc2610f

Browse files
authored
Update error for allowImportingTsExtensions to mention rewriteRelativeImportExtensions (#62557)
1 parent 09e31cf commit cc2610f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/compiler/diagnosticMessages.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4669,7 +4669,7 @@
46694669
"category": "Error",
46704670
"code": 5095
46714671
},
4672-
"Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.": {
4672+
"Option 'allowImportingTsExtensions' can only be used when one of 'noEmit', 'emitDeclarationOnly', or 'rewriteRelativeImportExtensions' is set.": {
46734673
"category": "Error",
46744674
"code": 5096
46754675
},

src/compiler/program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4318,7 +4318,7 @@ export function createProgram(_rootNamesOrOptions: readonly string[] | CreatePro
43184318
}
43194319

43204320
if (options.allowImportingTsExtensions && !(options.noEmit || options.emitDeclarationOnly || options.rewriteRelativeImportExtensions)) {
4321-
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_either_noEmit_or_emitDeclarationOnly_is_set);
4321+
createOptionValueDiagnostic("allowImportingTsExtensions", Diagnostics.Option_allowImportingTsExtensions_can_only_be_used_when_one_of_noEmit_emitDeclarationOnly_or_rewriteRelativeImportExtensions_is_set);
43224322
}
43234323

43244324
const moduleResolution = getEmitModuleResolutionKind(options);

tests/baselines/reference/bundlerImportTsExtensions(allowimportingtsextensions=true,noemit=false).errors.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files.
22
error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files.
3-
error TS5096: Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.
3+
error TS5096: Option 'allowImportingTsExtensions' can only be used when one of 'noEmit', 'emitDeclarationOnly', or 'rewriteRelativeImportExtensions' is set.
44
error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'.
55
The file is in the program because:
66
Root file specified for compilation
@@ -11,7 +11,7 @@ error TS6054: File '/project/e.txt' has an unsupported extension. The only suppo
1111

1212
!!! error TS5056: Cannot write file 'out/b.js' because it would be overwritten by multiple input files.
1313
!!! error TS5056: Cannot write file 'out/c.js' because it would be overwritten by multiple input files.
14-
!!! error TS5096: Option 'allowImportingTsExtensions' can only be used when either 'noEmit' or 'emitDeclarationOnly' is set.
14+
!!! error TS5096: Option 'allowImportingTsExtensions' can only be used when one of 'noEmit', 'emitDeclarationOnly', or 'rewriteRelativeImportExtensions' is set.
1515
!!! error TS6054: File '/project/e.txt' has an unsupported extension. The only supported extensions are '.ts', '.tsx', '.d.ts', '.js', '.jsx', '.cts', '.d.cts', '.cjs', '.mts', '.d.mts', '.mjs'.
1616
!!! error TS6054: The file is in the program because:
1717
!!! error TS6054: Root file specified for compilation

0 commit comments

Comments
 (0)