Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not report esModuleInterop needed error for json imports
Fixes #25400
- Loading branch information
1 parent
50ef631
commit cb622b4
Showing
5 changed files
with
64 additions
and
1 deletion.
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
19 changes: 19 additions & 0 deletions
19
tests/baselines/reference/requireOfJsonFileWithoutEsModuleInterop.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/requireOfJsonFileWithoutEsModuleInterop.ts] //// | ||
|
||
//// [file1.ts] | ||
import * as test from "./test.json" | ||
|
||
//// [test.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
|
||
//// [out/test.json] | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} | ||
//// [out/file1.js] | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
12 changes: 12 additions & 0 deletions
12
tests/baselines/reference/requireOfJsonFileWithoutEsModuleInterop.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 test from "./test.json" | ||
>test : Symbol(test, Decl(file1.ts, 0, 6)) | ||
|
||
=== tests/cases/compiler/test.json === | ||
{ | ||
"a": true, | ||
>"a" : Symbol("a", Decl(test.json, 0, 1)) | ||
|
||
"b": "hello" | ||
>"b" : Symbol("b", Decl(test.json, 1, 14)) | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/baselines/reference/requireOfJsonFileWithoutEsModuleInterop.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 test from "./test.json" | ||
>test : { "a": boolean; "b": string; } | ||
|
||
=== tests/cases/compiler/test.json === | ||
{ | ||
>{ "a": true, "b": "hello"} : { "a": boolean; "b": string; } | ||
|
||
"a": true, | ||
>"a" : boolean | ||
>true : true | ||
|
||
"b": "hello" | ||
>"b" : string | ||
>"hello" : "hello" | ||
} |
16 changes: 16 additions & 0 deletions
16
tests/cases/compiler/requireOfJsonFileWithoutEsModuleInterop.ts
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 @@ | ||
// @module: commonjs | ||
// @moduleResolution: node | ||
// @target:es2017 | ||
// @strict: true | ||
// @resolveJsonModule: true | ||
// @outdir: out/ | ||
// @fullEmitPaths: true | ||
|
||
// @Filename: file1.ts | ||
import * as test from "./test.json" | ||
|
||
// @Filename: test.json | ||
{ | ||
"a": true, | ||
"b": "hello" | ||
} |