Skip to content

Commit 11bec36

Browse files
committed
Merge remote-tracking branch 'origin/main' into fix/reentrant-getEffectsSignature
2 parents bf335f5 + 1fd0c53 commit 11bec36

File tree

139 files changed

+1242
-1137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

139 files changed

+1242
-1137
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48552,6 +48552,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
4855248552
return grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert);
4855348553
}
4855448554

48555+
if (!isImportAttributes && compilerOptions.ignoreDeprecations !== "6.0") {
48556+
grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert);
48557+
}
48558+
4855548559
if (declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier) === ModuleKind.CommonJS) {
4855648560
return grammarErrorOnNode(
4855748561
node,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// === documentHighlights ===
22
// === /tests/cases/fourslash/getOccurrencesNonStringImportAssertion.ts ===
3-
// import * as react from "react" assert { cache: /*HIGHLIGHTS*/0 };
3+
// import * as react from "react" with { cache: /*HIGHLIGHTS*/0 };
44
// react.Children;
Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
2-
1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
3-
1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
4-
2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
5-
2.ts(2,38): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
1+
1.ts(1,14): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
2+
1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
3+
1.ts(3,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
4+
2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
5+
2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
66
3.ts(2,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'.
77
3.ts(3,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'.
88
3.ts(4,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'.
@@ -11,50 +11,50 @@
1111
3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments
1212
3.ts(9,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'.
1313
3.ts(10,25): error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'.
14-
3.ts(10,52): error TS1009: Trailing comma not allowed.
14+
3.ts(10,50): error TS1009: Trailing comma not allowed.
1515

1616

1717
==== 0.ts (0 errors) ====
1818
export const a = 1;
1919
export const b = 2;
2020

2121
==== 1.ts (3 errors) ====
22-
import './0' assert { type: "json" }
23-
~~~~~~~~~~~~~~~~~~~~~~~
24-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
25-
import { a, b } from './0' assert { "type": "json" }
26-
~~~~~~~~~~~~~~~~~~~~~~~~~
27-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
28-
import * as foo from './0' assert { type: "json" }
22+
import './0' with { type: "json" }
23+
~~~~~~~~~~~~~~~~~~~~~
24+
!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
25+
import { a, b } from './0' with { "type": "json" }
2926
~~~~~~~~~~~~~~~~~~~~~~~
30-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
27+
!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
28+
import * as foo from './0' with { type: "json" }
29+
~~~~~~~~~~~~~~~~~~~~~
30+
!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
3131
a;
3232
b;
3333
foo.a;
3434
foo.b;
3535

3636
==== 2.ts (2 errors) ====
37-
import { a, b } from './0' assert {}
38-
~~~~~~~~~
39-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
40-
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
41-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42-
!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
37+
import { a, b } from './0' with {}
38+
~~~~~~~
39+
!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
40+
import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" }
41+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
42+
!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.
4343
a;
4444
b;
4545
c;
4646
d;
4747

4848
==== 3.ts (9 errors) ====
4949
const a = import('./0')
50-
const b = import('./0', { assert: { type: "json" } })
51-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50+
const b = import('./0', { with: { type: "json" } })
51+
~~~~~~~~~~~~~~~~~~~~~~~~~~
5252
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'.
53-
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
54-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
53+
const c = import('./0', { with: { type: "json", ttype: "typo" } })
54+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5555
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'.
56-
const d = import('./0', { assert: {} })
57-
~~~~~~~~~~~~~~
56+
const d = import('./0', { with: {} })
57+
~~~~~~~~~~~~
5858
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'.
5959
const dd = import('./0', {})
6060
~~
@@ -69,10 +69,10 @@
6969
const g = import('./0', {}, {})
7070
~~
7171
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'.
72-
const h = import('./0', { assert: { type: "json" }},)
73-
~~~~~~~~~~~~~~~~~~~~~~~~~~~
72+
const h = import('./0', { with: { type: "json" }},)
73+
~~~~~~~~~~~~~~~~~~~~~~~~~
7474
!!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'.
75-
~
75+
~
7676
!!! error TS1009: Trailing comma not allowed.
7777

7878

tests/baselines/reference/importAssertion1(module=commonjs).js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,33 @@ export const a = 1;
55
export const b = 2;
66

77
//// [1.ts]
8-
import './0' assert { type: "json" }
9-
import { a, b } from './0' assert { "type": "json" }
10-
import * as foo from './0' assert { type: "json" }
8+
import './0' with { type: "json" }
9+
import { a, b } from './0' with { "type": "json" }
10+
import * as foo from './0' with { type: "json" }
1111
a;
1212
b;
1313
foo.a;
1414
foo.b;
1515

1616
//// [2.ts]
17-
import { a, b } from './0' assert {}
18-
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
17+
import { a, b } from './0' with {}
18+
import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" }
1919
a;
2020
b;
2121
c;
2222
d;
2323

2424
//// [3.ts]
2525
const a = import('./0')
26-
const b = import('./0', { assert: { type: "json" } })
27-
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
28-
const d = import('./0', { assert: {} })
26+
const b = import('./0', { with: { type: "json" } })
27+
const c = import('./0', { with: { type: "json", ttype: "typo" } })
28+
const d = import('./0', { with: {} })
2929
const dd = import('./0', {})
3030
declare function foo(): any;
3131
const e = import('./0', foo())
3232
const f = import()
3333
const g = import('./0', {}, {})
34-
const h = import('./0', { assert: { type: "json" }},)
34+
const h = import('./0', { with: { type: "json" }},)
3535

3636

3737

tests/baselines/reference/importAssertion1(module=commonjs).symbols

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ export const b = 2;
88
>b : Symbol(b, Decl(0.ts, 1, 12))
99

1010
=== 1.ts ===
11-
import './0' assert { type: "json" }
12-
import { a, b } from './0' assert { "type": "json" }
11+
import './0' with { type: "json" }
12+
import { a, b } from './0' with { "type": "json" }
1313
>a : Symbol(a, Decl(1.ts, 1, 8))
1414
>b : Symbol(b, Decl(1.ts, 1, 11))
1515

16-
import * as foo from './0' assert { type: "json" }
16+
import * as foo from './0' with { type: "json" }
1717
>foo : Symbol(foo, Decl(1.ts, 2, 6))
1818

1919
a;
@@ -33,11 +33,11 @@ foo.b;
3333
>b : Symbol(b, Decl(0.ts, 1, 12))
3434

3535
=== 2.ts ===
36-
import { a, b } from './0' assert {}
36+
import { a, b } from './0' with {}
3737
>a : Symbol(a, Decl(2.ts, 0, 8))
3838
>b : Symbol(b, Decl(2.ts, 0, 11))
3939

40-
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
40+
import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" }
4141
>a : Symbol(a, Decl(0.ts, 0, 12))
4242
>c : Symbol(c, Decl(2.ts, 1, 8))
4343
>b : Symbol(b, Decl(0.ts, 1, 12))
@@ -60,23 +60,23 @@ const a = import('./0')
6060
>a : Symbol(a, Decl(3.ts, 0, 5))
6161
>'./0' : Symbol("0", Decl(0.ts, 0, 0))
6262

63-
const b = import('./0', { assert: { type: "json" } })
63+
const b = import('./0', { with: { type: "json" } })
6464
>b : Symbol(b, Decl(3.ts, 1, 5))
6565
>'./0' : Symbol("0", Decl(0.ts, 0, 0))
66-
>assert : Symbol(assert, Decl(3.ts, 1, 25))
67-
>type : Symbol(type, Decl(3.ts, 1, 35))
66+
>with : Symbol(with, Decl(3.ts, 1, 25))
67+
>type : Symbol(type, Decl(3.ts, 1, 33))
6868

69-
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
69+
const c = import('./0', { with: { type: "json", ttype: "typo" } })
7070
>c : Symbol(c, Decl(3.ts, 2, 5))
7171
>'./0' : Symbol("0", Decl(0.ts, 0, 0))
72-
>assert : Symbol(assert, Decl(3.ts, 2, 25))
73-
>type : Symbol(type, Decl(3.ts, 2, 35))
74-
>ttype : Symbol(ttype, Decl(3.ts, 2, 49))
72+
>with : Symbol(with, Decl(3.ts, 2, 25))
73+
>type : Symbol(type, Decl(3.ts, 2, 33))
74+
>ttype : Symbol(ttype, Decl(3.ts, 2, 47))
7575

76-
const d = import('./0', { assert: {} })
76+
const d = import('./0', { with: {} })
7777
>d : Symbol(d, Decl(3.ts, 3, 5))
7878
>'./0' : Symbol("0", Decl(0.ts, 0, 0))
79-
>assert : Symbol(assert, Decl(3.ts, 3, 25))
79+
>with : Symbol(with, Decl(3.ts, 3, 25))
8080

8181
const dd = import('./0', {})
8282
>dd : Symbol(dd, Decl(3.ts, 4, 5))
@@ -97,10 +97,10 @@ const g = import('./0', {}, {})
9797
>g : Symbol(g, Decl(3.ts, 8, 5))
9898
>'./0' : Symbol("0", Decl(0.ts, 0, 0))
9999

100-
const h = import('./0', { assert: { type: "json" }},)
100+
const h = import('./0', { with: { type: "json" }},)
101101
>h : Symbol(h, Decl(3.ts, 9, 5))
102102
>'./0' : Symbol("0", Decl(0.ts, 0, 0))
103-
>assert : Symbol(assert, Decl(3.ts, 9, 25))
104-
>type : Symbol(type, Decl(3.ts, 9, 35))
103+
>with : Symbol(with, Decl(3.ts, 9, 25))
104+
>type : Symbol(type, Decl(3.ts, 9, 33))
105105

106106

tests/baselines/reference/importAssertion1(module=commonjs).types

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ export const b = 2;
1414
> : ^
1515

1616
=== 1.ts ===
17-
import './0' assert { type: "json" }
17+
import './0' with { type: "json" }
1818
>type : any
1919
> : ^^^
2020

21-
import { a, b } from './0' assert { "type": "json" }
21+
import { a, b } from './0' with { "type": "json" }
2222
>a : 1
2323
> : ^
2424
>b : 2
2525
> : ^
2626

27-
import * as foo from './0' assert { type: "json" }
27+
import * as foo from './0' with { type: "json" }
2828
>foo : typeof foo
2929
> : ^^^^^^^^^^
3030
>type : any
@@ -55,13 +55,13 @@ foo.b;
5555
> : ^
5656

5757
=== 2.ts ===
58-
import { a, b } from './0' assert {}
58+
import { a, b } from './0' with {}
5959
>a : 1
6060
> : ^
6161
>b : 2
6262
> : ^
6363

64-
import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }
64+
import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" }
6565
>a : 1
6666
> : ^
6767
>c : 1
@@ -102,35 +102,35 @@ const a = import('./0')
102102
>'./0' : "./0"
103103
> : ^^^^^
104104

105-
const b = import('./0', { assert: { type: "json" } })
105+
const b = import('./0', { with: { type: "json" } })
106106
>b : Promise<typeof import("0")>
107107
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
108-
>import('./0', { assert: { type: "json" } }) : Promise<typeof import("0")>
109-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
108+
>import('./0', { with: { type: "json" } }) : Promise<typeof import("0")>
109+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
110110
>'./0' : "./0"
111111
> : ^^^^^
112-
>{ assert: { type: "json" } } : { assert: { type: string; }; }
113-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
114-
>assert : { type: string; }
115-
> : ^^^^^^^^^^^^^^^^^
112+
>{ with: { type: "json" } } : { with: { type: string; }; }
113+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
114+
>with : { type: string; }
115+
> : ^^^^^^^^^^^^^^^^^
116116
>{ type: "json" } : { type: string; }
117117
> : ^^^^^^^^^^^^^^^^^
118118
>type : string
119119
> : ^^^^^^
120120
>"json" : "json"
121121
> : ^^^^^^
122122

123-
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
123+
const c = import('./0', { with: { type: "json", ttype: "typo" } })
124124
>c : Promise<typeof import("0")>
125125
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
126-
>import('./0', { assert: { type: "json", ttype: "typo" } }) : Promise<typeof import("0")>
127-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
126+
>import('./0', { with: { type: "json", ttype: "typo" } }) : Promise<typeof import("0")>
127+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
128128
>'./0' : "./0"
129129
> : ^^^^^
130-
>{ assert: { type: "json", ttype: "typo" } } : { assert: { type: string; ttype: string; }; }
131-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
132-
>assert : { type: string; ttype: string; }
133-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
130+
>{ with: { type: "json", ttype: "typo" } } : { with: { type: string; ttype: string; }; }
131+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
132+
>with : { type: string; ttype: string; }
133+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134134
>{ type: "json", ttype: "typo" } : { type: string; ttype: string; }
135135
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
136136
>type : string
@@ -142,17 +142,17 @@ const c = import('./0', { assert: { type: "json", ttype: "typo" } })
142142
>"typo" : "typo"
143143
> : ^^^^^^
144144

145-
const d = import('./0', { assert: {} })
145+
const d = import('./0', { with: {} })
146146
>d : Promise<typeof import("0")>
147147
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
148-
>import('./0', { assert: {} }) : Promise<typeof import("0")>
149-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
148+
>import('./0', { with: {} }) : Promise<typeof import("0")>
149+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
150150
>'./0' : "./0"
151151
> : ^^^^^
152-
>{ assert: {} } : { assert: {}; }
153-
> : ^^^^^^^^^^^^^^^
154-
>assert : {}
155-
> : ^^
152+
>{ with: {} } : { with: {}; }
153+
> : ^^^^^^^^^^^^^
154+
>with : {}
155+
> : ^^
156156
>{} : {}
157157
> : ^^
158158

@@ -200,17 +200,17 @@ const g = import('./0', {}, {})
200200
>{} : {}
201201
> : ^^
202202

203-
const h = import('./0', { assert: { type: "json" }},)
203+
const h = import('./0', { with: { type: "json" }},)
204204
>h : Promise<typeof import("0")>
205205
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
206-
>import('./0', { assert: { type: "json" }},) : Promise<typeof import("0")>
207-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
206+
>import('./0', { with: { type: "json" }},) : Promise<typeof import("0")>
207+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^
208208
>'./0' : "./0"
209209
> : ^^^^^
210-
>{ assert: { type: "json" }} : { assert: { type: string; }; }
211-
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
212-
>assert : { type: string; }
213-
> : ^^^^^^^^^^^^^^^^^
210+
>{ with: { type: "json" }} : { with: { type: string; }; }
211+
> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
212+
>with : { type: string; }
213+
> : ^^^^^^^^^^^^^^^^^
214214
>{ type: "json" } : { type: string; }
215215
> : ^^^^^^^^^^^^^^^^^
216216
>type : string

0 commit comments

Comments
 (0)