-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report errors for module generation other than "commonjs" with --reso…
…lveJsonModule Fixes #25517
- Loading branch information
1 parent
a9771e3
commit 3866a50
Showing
45 changed files
with
636 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
tests/baselines/reference/requireOfJsonFileWithModuleEmitNone.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
error TS5070: Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy. | ||
tests/cases/compiler/file1.ts(1,1): error TS1148: Cannot use imports, exports, or module augmentations when '--module' is 'none'. | ||
tests/cases/compiler/file1.ts(1,20): error TS2307: Cannot find module './b.json'. | ||
|
||
|
||
!!! error TS5070: Option '--resolveJsonModule' cannot be specified without 'node' module resolution strategy. | ||
==== tests/cases/compiler/file1.ts (2 errors) ==== | ||
import * as b from './b.json'; | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS1148: Cannot use imports, exports, or module augmentations when '--module' is 'none'. | ||
~~~~~~~~~~ | ||
!!! error TS2307: Cannot find module './b.json'. | ||
|
||
==== tests/cases/compiler/b.json (0 errors) ==== | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/baselines/reference/requireOfJsonFileWithModuleEmitNone.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
//// [tests/cases/compiler/requireOfJsonFileWithModuleEmitNone.ts] //// | ||
|
||
//// [file1.ts] | ||
import * as b from './b.json'; | ||
|
||
//// [b.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
|
||
//// [out/file1.js] | ||
"use strict"; | ||
exports.__esModule = true; |
4 changes: 4 additions & 0 deletions
4
tests/baselines/reference/requireOfJsonFileWithModuleEmitNone.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : Symbol(b, Decl(file1.ts, 0, 6)) | ||
|
4 changes: 4 additions & 0 deletions
4
tests/baselines/reference/requireOfJsonFileWithModuleEmitNone.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : any | ||
|
19 changes: 19 additions & 0 deletions
19
tests/baselines/reference/requireOfJsonFileWithModuleEmitUndefined.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//// [tests/cases/compiler/requireOfJsonFileWithModuleEmitUndefined.ts] //// | ||
|
||
//// [file1.ts] | ||
import * as b from './b.json'; | ||
|
||
//// [b.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
|
||
//// [out/b.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
//// [out/file1.js] | ||
"use strict"; | ||
exports.__esModule = true; |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/requireOfJsonFileWithModuleEmitUndefined.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : Symbol(b, Decl(file1.ts, 0, 6)) | ||
|
||
=== tests/cases/compiler/b.json === | ||
{ | ||
"a": true, | ||
>"a" : Symbol("a", Decl(b.json, 0, 1)) | ||
|
||
"b": "hello" | ||
>"b" : Symbol("b", Decl(b.json, 1, 14)) | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/requireOfJsonFileWithModuleEmitUndefined.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : { "a": boolean; "b": string; } | ||
|
||
=== tests/cases/compiler/b.json === | ||
{ | ||
>{ "a": true, "b": "hello"} : { "a": boolean; "b": string; } | ||
|
||
"a": true, | ||
>"a" : boolean | ||
>true : true | ||
|
||
"b": "hello" | ||
>"b" : string | ||
>"hello" : "hello" | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitAmd.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs'. | ||
|
||
|
||
!!! error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs'. | ||
==== tests/cases/compiler/file1.ts (0 errors) ==== | ||
import * as b from './b.json'; | ||
|
||
==== tests/cases/compiler/b.json (0 errors) ==== | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} |
21 changes: 21 additions & 0 deletions
21
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitAmd.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//// [tests/cases/compiler/requireOfJsonFileWithModuleNodeResolutionEmitAmd.ts] //// | ||
|
||
//// [file1.ts] | ||
import * as b from './b.json'; | ||
|
||
//// [b.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
|
||
//// [out/b.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
//// [out/file1.js] | ||
define(["require", "exports"], function (require, exports) { | ||
"use strict"; | ||
exports.__esModule = true; | ||
}); |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitAmd.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : Symbol(b, Decl(file1.ts, 0, 6)) | ||
|
||
=== tests/cases/compiler/b.json === | ||
{ | ||
"a": true, | ||
>"a" : Symbol("a", Decl(b.json, 0, 1)) | ||
|
||
"b": "hello" | ||
>"b" : Symbol("b", Decl(b.json, 1, 14)) | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitAmd.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : { "a": boolean; "b": string; } | ||
|
||
=== tests/cases/compiler/b.json === | ||
{ | ||
>{ "a": true, "b": "hello"} : { "a": boolean; "b": string; } | ||
|
||
"a": true, | ||
>"a" : boolean | ||
>true : true | ||
|
||
"b": "hello" | ||
>"b" : string | ||
>"hello" : "hello" | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitEs2015.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs'. | ||
|
||
|
||
!!! error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs'. | ||
==== tests/cases/compiler/file1.ts (0 errors) ==== | ||
import * as b from './b.json'; | ||
|
||
==== tests/cases/compiler/b.json (0 errors) ==== | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitEs2015.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//// [tests/cases/compiler/requireOfJsonFileWithModuleNodeResolutionEmitEs2015.ts] //// | ||
|
||
//// [file1.ts] | ||
import * as b from './b.json'; | ||
|
||
//// [b.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
|
||
//// [out/b.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
//// [out/file1.js] |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitEs2015.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : Symbol(b, Decl(file1.ts, 0, 6)) | ||
|
||
=== tests/cases/compiler/b.json === | ||
{ | ||
"a": true, | ||
>"a" : Symbol("a", Decl(b.json, 0, 1)) | ||
|
||
"b": "hello" | ||
>"b" : Symbol("b", Decl(b.json, 1, 14)) | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitEs2015.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : { "a": boolean; "b": string; } | ||
|
||
=== tests/cases/compiler/b.json === | ||
{ | ||
>{ "a": true, "b": "hello"} : { "a": boolean; "b": string; } | ||
|
||
"a": true, | ||
>"a" : boolean | ||
>true : true | ||
|
||
"b": "hello" | ||
>"b" : string | ||
>"hello" : "hello" | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitEsNext.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs'. | ||
|
||
|
||
!!! error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs'. | ||
==== tests/cases/compiler/file1.ts (0 errors) ==== | ||
import * as b from './b.json'; | ||
|
||
==== tests/cases/compiler/b.json (0 errors) ==== | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitEsNext.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
//// [tests/cases/compiler/requireOfJsonFileWithModuleNodeResolutionEmitEsNext.ts] //// | ||
|
||
//// [file1.ts] | ||
import * as b from './b.json'; | ||
|
||
//// [b.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
|
||
//// [out/b.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
//// [out/file1.js] |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitEsNext.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : Symbol(b, Decl(file1.ts, 0, 6)) | ||
|
||
=== tests/cases/compiler/b.json === | ||
{ | ||
"a": true, | ||
>"a" : Symbol("a", Decl(b.json, 0, 1)) | ||
|
||
"b": "hello" | ||
>"b" : Symbol("b", Decl(b.json, 1, 14)) | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitEsNext.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : { "a": boolean; "b": string; } | ||
|
||
=== tests/cases/compiler/b.json === | ||
{ | ||
>{ "a": true, "b": "hello"} : { "a": boolean; "b": string; } | ||
|
||
"a": true, | ||
>"a" : boolean | ||
>true : true | ||
|
||
"b": "hello" | ||
>"b" : string | ||
>"hello" : "hello" | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitNone.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs'. | ||
tests/cases/compiler/file1.ts(1,1): error TS1148: Cannot use imports, exports, or module augmentations when '--module' is 'none'. | ||
|
||
|
||
!!! error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs'. | ||
==== tests/cases/compiler/file1.ts (1 errors) ==== | ||
import * as b from './b.json'; | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
!!! error TS1148: Cannot use imports, exports, or module augmentations when '--module' is 'none'. | ||
|
||
==== tests/cases/compiler/b.json (0 errors) ==== | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitNone.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//// [tests/cases/compiler/requireOfJsonFileWithModuleNodeResolutionEmitNone.ts] //// | ||
|
||
//// [file1.ts] | ||
import * as b from './b.json'; | ||
|
||
//// [b.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
|
||
//// [out/b.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
//// [out/file1.js] | ||
"use strict"; | ||
exports.__esModule = true; |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitNone.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : Symbol(b, Decl(file1.ts, 0, 6)) | ||
|
||
=== tests/cases/compiler/b.json === | ||
{ | ||
"a": true, | ||
>"a" : Symbol("a", Decl(b.json, 0, 1)) | ||
|
||
"b": "hello" | ||
>"b" : Symbol("b", Decl(b.json, 1, 14)) | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitNone.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
=== tests/cases/compiler/file1.ts === | ||
import * as b from './b.json'; | ||
>b : { "a": boolean; "b": string; } | ||
|
||
=== tests/cases/compiler/b.json === | ||
{ | ||
>{ "a": true, "b": "hello"} : { "a": boolean; "b": string; } | ||
|
||
"a": true, | ||
>"a" : boolean | ||
>true : true | ||
|
||
"b": "hello" | ||
>"b" : string | ||
>"hello" : "hello" | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/requireOfJsonFileWithModuleNodeResolutionEmitSystem.errors.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs'. | ||
|
||
|
||
!!! error TS5071: Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs'. | ||
==== tests/cases/compiler/file1.ts (0 errors) ==== | ||
import * as b from './b.json'; | ||
|
||
==== tests/cases/compiler/b.json (0 errors) ==== | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} |
Oops, something went wrong.