Skip to content

Commit 590892b

Browse files
committed
Update missed baseline
1 parent 2fb1117 commit 590892b

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

tests/baselines/reference/nodeModulesJson(module=node20).errors.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
/main.mts(2,22): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node20'.
44
/main.mts(3,19): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node20'.
55
/main.mts(7,21): error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node20'.
6-
/main.mts(8,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node20'.
7-
/main.mts(10,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'.
6+
/main.mts(9,47): error TS2857: Import attributes cannot be used with type-only imports or exports.
7+
/main.mts(10,10): error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node20'.
8+
/main.mts(12,9): error TS2339: Property 'version' does not exist on type '{ default: { version: number; }; }'.
89

910

1011
==== /node_modules/not.json/package.json (0 errors) ====
@@ -41,7 +42,7 @@
4142
"version": 1
4243
}
4344

44-
==== /main.mts (5 errors) ====
45+
==== /main.mts (6 errors) ====
4546
import { oops } from "not.json"; // Ok
4647
import moreOops from "actually-json"; // Error in nodenext
4748
~~~~~~~~~~~~~~~
@@ -55,6 +56,10 @@
5556
import config2 from "./config.json"; // Error in nodenext, no attribute
5657
~~~~~~~~~~~~~~~
5758
!!! error TS1543: Importing a JSON file into an ECMAScript module requires a 'type: "json"' import attribute when 'module' is set to 'Node20'.
59+
import type config2Type from "./config.json"; // Ok, type-only
60+
import type config2Type2 from "./config.json" with { type: "json" }; // Error, import attributes not allowed on type-only imports
61+
~~~~~~~~~~~~~~~~~~~~~
62+
!!! error TS2857: Import attributes cannot be used with type-only imports or exports.
5863
import { version } from "./config.json" with { type: "json" }; // Error, named import
5964
~~~~~~~
6065
!!! error TS1544: Named imports from a JSON file into an ECMAScript module are not allowed when 'module' is set to 'Node20'.

tests/baselines/reference/nodeModulesJson(module=node20).symbols

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,24 @@ import { default as config1 } from "./config.json" with { type: "json" }; // Ok
4242
import config2 from "./config.json"; // Error in nodenext, no attribute
4343
>config2 : Symbol(config2, Decl(main.mts, 6, 6))
4444

45+
import type config2Type from "./config.json"; // Ok, type-only
46+
>config2Type : Symbol(config2Type, Decl(main.mts, 7, 6))
47+
48+
import type config2Type2 from "./config.json" with { type: "json" }; // Error, import attributes not allowed on type-only imports
49+
>config2Type2 : Symbol(config2Type2, Decl(main.mts, 8, 6))
50+
4551
import { version } from "./config.json" with { type: "json" }; // Error, named import
46-
>version : Symbol(version, Decl(main.mts, 7, 8))
52+
>version : Symbol(version, Decl(main.mts, 9, 8))
4753

4854
import * as config3 from "./config.json" with { type: "json" };
49-
>config3 : Symbol(config3, Decl(main.mts, 8, 6))
55+
>config3 : Symbol(config3, Decl(main.mts, 10, 6))
5056

5157
config3.version; // Error
52-
>config3 : Symbol(config3, Decl(main.mts, 8, 6))
58+
>config3 : Symbol(config3, Decl(main.mts, 10, 6))
5359

5460
config3.default; // Ok
5561
>config3.default : Symbol("/config")
56-
>config3 : Symbol(config3, Decl(main.mts, 8, 6))
62+
>config3 : Symbol(config3, Decl(main.mts, 10, 6))
5763
>default : Symbol("/config")
5864

5965
=== /loosey.cts ===

tests/baselines/reference/nodeModulesJson(module=node20).types

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ import config2 from "./config.json"; // Error in nodenext, no attribute
6464
>config2 : { version: number; }
6565
> : ^^^^^^^^^^^^^^^^^^^^
6666

67+
import type config2Type from "./config.json"; // Ok, type-only
68+
>config2Type : any
69+
> : ^^^
70+
71+
import type config2Type2 from "./config.json" with { type: "json" }; // Error, import attributes not allowed on type-only imports
72+
>config2Type2 : any
73+
> : ^^^
74+
>type : any
75+
> : ^^^
76+
6777
import { version } from "./config.json" with { type: "json" }; // Error, named import
6878
>version : number
6979
> : ^^^^^^

0 commit comments

Comments
 (0)