From 3ad9f7801f4b22acbba788ab7694ea4da4d71789 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Sat, 31 Jan 2026 10:09:44 -0800 Subject: [PATCH] Deprecate import assert in favor of import with --- src/compiler/checker.ts | 4 + ...cesNonStringImportAssertion.baseline.jsonc | 2 +- ...portAssertion1(module=commonjs).errors.txt | 58 +++++++------- .../importAssertion1(module=commonjs).js | 18 ++--- .../importAssertion1(module=commonjs).symbols | 34 ++++----- .../importAssertion1(module=commonjs).types | 66 ++++++++-------- ...importAssertion1(module=es2015).errors.txt | 54 ++++++------- .../importAssertion1(module=es2015).js | 36 ++++----- .../importAssertion1(module=es2015).symbols | 34 ++++----- .../importAssertion1(module=es2015).types | 66 ++++++++-------- ...importAssertion1(module=esnext).errors.txt | 18 ++--- .../importAssertion1(module=esnext).js | 36 ++++----- .../importAssertion1(module=esnext).symbols | 34 ++++----- .../importAssertion1(module=esnext).types | 66 ++++++++-------- ...portAssertion2(module=commonjs).errors.txt | 48 ++++++------ .../importAssertion2(module=commonjs).js | 12 +-- .../importAssertion2(module=commonjs).symbols | 12 +-- .../importAssertion2(module=commonjs).types | 12 +-- ...importAssertion2(module=es2015).errors.txt | 48 ++++++------ .../importAssertion2(module=es2015).js | 22 +++--- .../importAssertion2(module=es2015).symbols | 12 +-- .../importAssertion2(module=es2015).types | 12 +-- .../importAssertion2(module=esnext).js | 22 +++--- .../importAssertion2(module=esnext).symbols | 12 +-- .../importAssertion2(module=esnext).types | 12 +-- ...importAssertion3(module=es2015).errors.txt | 32 ++++---- .../importAssertion3(module=es2015).js | 8 +- .../importAssertion3(module=es2015).symbols | 8 +- .../importAssertion3(module=es2015).types | 8 +- ...importAssertion3(module=esnext).errors.txt | 32 ++++---- .../importAssertion3(module=esnext).js | 8 +- .../importAssertion3(module=esnext).symbols | 8 +- .../importAssertion3(module=esnext).types | 8 +- .../reference/importAssertion4.errors.txt | 2 +- tests/baselines/reference/importAssertion4.js | 2 +- .../reference/importAssertion4.symbols | 2 +- .../reference/importAssertion4.types | 2 +- .../reference/importAssertion5.errors.txt | 4 +- tests/baselines/reference/importAssertion5.js | 2 +- .../reference/importAssertion5.symbols | 2 +- .../reference/importAssertion5.types | 2 +- .../importAssertionNonstring.errors.txt | 76 +++++++------------ .../reference/importAssertionNonstring.js | 12 +-- .../importAssertionNonstring.symbols | 14 ++-- .../reference/importAssertionNonstring.types | 12 +-- .../importAssertionsDeprecated.errors.txt | 29 +++++++ .../reference/importAssertionsDeprecated.js | 27 +++++++ .../importAssertionsDeprecatedIgnored.js | 28 +++++++ ...ImportAssertions(module=node16).errors.txt | 18 ++--- ...eModulesImportAssertions(module=node16).js | 8 +- ...lesImportAssertions(module=node16).symbols | 10 +-- ...dulesImportAssertions(module=node16).types | 18 ++--- ...ImportAssertions(module=node18).errors.txt | 12 +-- ...eModulesImportAssertions(module=node18).js | 8 +- ...lesImportAssertions(module=node18).symbols | 10 +-- ...dulesImportAssertions(module=node18).types | 18 ++--- ...ImportAssertions(module=node20).errors.txt | 17 ++--- ...eModulesImportAssertions(module=node20).js | 8 +- ...lesImportAssertions(module=node20).symbols | 10 +-- ...dulesImportAssertions(module=node20).types | 18 ++--- ...portAssertions(module=nodenext).errors.txt | 17 ++--- ...odulesImportAssertions(module=nodenext).js | 8 +- ...sImportAssertions(module=nodenext).symbols | 10 +-- ...lesImportAssertions(module=nodenext).types | 18 ++--- ...DeclarationEmit1(module=node16).errors.txt | 24 +++--- ...portModeDeclarationEmit1(module=node16).js | 24 +++--- ...odeDeclarationEmit1(module=node16).symbols | 16 ++-- ...tModeDeclarationEmit1(module=node16).types | 12 +-- ...DeclarationEmit1(module=node18).errors.txt | 24 +++--- ...portModeDeclarationEmit1(module=node18).js | 24 +++--- ...odeDeclarationEmit1(module=node18).symbols | 16 ++-- ...tModeDeclarationEmit1(module=node18).types | 12 +-- ...DeclarationEmit1(module=node20).errors.txt | 24 +++--- ...portModeDeclarationEmit1(module=node20).js | 24 +++--- ...odeDeclarationEmit1(module=node20).symbols | 16 ++-- ...tModeDeclarationEmit1(module=node20).types | 12 +-- ...clarationEmit1(module=nodenext).errors.txt | 24 +++--- ...rtModeDeclarationEmit1(module=nodenext).js | 24 +++--- ...eDeclarationEmit1(module=nodenext).symbols | 16 ++-- ...odeDeclarationEmit1(module=nodenext).types | 12 +-- ...DeclarationEmit2(module=node16).errors.txt | 24 +++--- ...portModeDeclarationEmit2(module=node16).js | 24 +++--- ...odeDeclarationEmit2(module=node16).symbols | 16 ++-- ...tModeDeclarationEmit2(module=node16).types | 12 +-- ...DeclarationEmit2(module=node18).errors.txt | 16 ++-- ...portModeDeclarationEmit2(module=node18).js | 24 +++--- ...odeDeclarationEmit2(module=node18).symbols | 16 ++-- ...tModeDeclarationEmit2(module=node18).types | 12 +-- ...DeclarationEmit2(module=node20).errors.txt | 24 +++--- ...portModeDeclarationEmit2(module=node20).js | 24 +++--- ...odeDeclarationEmit2(module=node20).symbols | 16 ++-- ...tModeDeclarationEmit2(module=node20).types | 12 +-- ...clarationEmit2(module=nodenext).errors.txt | 24 +++--- ...rtModeDeclarationEmit2(module=nodenext).js | 24 +++--- ...eDeclarationEmit2(module=nodenext).symbols | 16 ++-- ...odeDeclarationEmit2(module=nodenext).types | 12 +-- ...ationEmitErrors1(module=node16).errors.txt | 28 +++---- ...deDeclarationEmitErrors1(module=node16).js | 8 +- ...larationEmitErrors1(module=node16).symbols | 8 +- ...eclarationEmitErrors1(module=node16).types | 6 +- ...ationEmitErrors1(module=node18).errors.txt | 28 +++---- ...deDeclarationEmitErrors1(module=node18).js | 8 +- ...larationEmitErrors1(module=node18).symbols | 8 +- ...eclarationEmitErrors1(module=node18).types | 6 +- ...ationEmitErrors1(module=node20).errors.txt | 28 +++---- ...deDeclarationEmitErrors1(module=node20).js | 8 +- ...larationEmitErrors1(module=node20).symbols | 8 +- ...eclarationEmitErrors1(module=node20).types | 6 +- ...ionEmitErrors1(module=nodenext).errors.txt | 28 +++---- ...DeclarationEmitErrors1(module=nodenext).js | 8 +- ...rationEmitErrors1(module=nodenext).symbols | 8 +- ...larationEmitErrors1(module=nodenext).types | 6 +- ...peOnlyImport1(moduleresolution=bundler).js | 16 ++-- ...yImport1(moduleresolution=bundler).symbols | 12 +-- ...nlyImport1(moduleresolution=bundler).types | 8 +- ...port1(moduleresolution=classic).errors.txt | 8 +- ...peOnlyImport1(moduleresolution=classic).js | 16 ++-- ...yImport1(moduleresolution=classic).symbols | 12 +-- ...nlyImport1(moduleresolution=classic).types | 8 +- .../compiler/importAssertionNonstring.ts | 12 +-- .../compiler/importAssertionsDeprecated.ts | 21 +++++ .../importAssertionsDeprecatedIgnored.ts | 23 ++++++ .../importAssertion/importAssertion1.ts | 18 ++--- .../importAssertion/importAssertion2.ts | 12 +-- .../importAssertion/importAssertion3.ts | 8 +- .../importAssertion/importAssertion4.ts | 2 +- .../importAssertion/importAssertion5.ts | 2 +- .../resolutionModeTypeOnlyImport1.ts | 8 +- .../node/nodeModulesImportAssertions.ts | 6 +- .../nodeModulesImportModeDeclarationEmit1.ts | 12 +-- .../nodeModulesImportModeDeclarationEmit2.ts | 12 +-- ...ModulesImportModeDeclarationEmitErrors1.ts | 6 +- .../getOccurrencesNonStringImportAssertion.ts | 2 +- .../fourslash/organizeImportsAttributes.ts | 10 +-- .../fourslash/organizeImportsAttributes2.ts | 11 ++- .../fourslash/organizeImportsAttributes3.ts | 14 ++-- .../fourslash/organizeImportsAttributes4.ts | 24 +++--- .../outliningSpansForImportsAndExports.ts | 6 +- ...mplateLiteral_ToTemplateInvalidLocation.ts | 4 +- 139 files changed, 1242 insertions(+), 1137 deletions(-) create mode 100644 tests/baselines/reference/importAssertionsDeprecated.errors.txt create mode 100644 tests/baselines/reference/importAssertionsDeprecated.js create mode 100644 tests/baselines/reference/importAssertionsDeprecatedIgnored.js create mode 100644 tests/cases/compiler/importAssertionsDeprecated.ts create mode 100644 tests/cases/compiler/importAssertionsDeprecatedIgnored.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 04abe7d1b45ce..2468efeac50db 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -48552,6 +48552,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { return grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert); } + if (!isImportAttributes && compilerOptions.ignoreDeprecations !== "6.0") { + grammarErrorOnFirstToken(node, Diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert); + } + if (declaration.moduleSpecifier && getEmitSyntaxForModuleSpecifierExpression(declaration.moduleSpecifier) === ModuleKind.CommonJS) { return grammarErrorOnNode( node, diff --git a/tests/baselines/reference/getOccurrencesNonStringImportAssertion.baseline.jsonc b/tests/baselines/reference/getOccurrencesNonStringImportAssertion.baseline.jsonc index a2fa8f8051ad8..19d932063fe5a 100644 --- a/tests/baselines/reference/getOccurrencesNonStringImportAssertion.baseline.jsonc +++ b/tests/baselines/reference/getOccurrencesNonStringImportAssertion.baseline.jsonc @@ -1,4 +1,4 @@ // === documentHighlights === // === /tests/cases/fourslash/getOccurrencesNonStringImportAssertion.ts === -// import * as react from "react" assert { cache: /*HIGHLIGHTS*/0 }; +// import * as react from "react" with { cache: /*HIGHLIGHTS*/0 }; // react.Children; \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt index 96d411a196413..643e511724f6e 100644 --- a/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=commonjs).errors.txt @@ -1,8 +1,8 @@ -1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -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.ts(1,14): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(3,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. 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'. 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'. 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,7 +11,7 @@ 3.ts(8,11): message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments 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'. 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'. -3.ts(10,52): error TS1009: Trailing comma not allowed. +3.ts(10,50): error TS1009: Trailing comma not allowed. ==== 0.ts (0 errors) ==== @@ -19,27 +19,27 @@ export const b = 2; ==== 1.ts (3 errors) ==== - import './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - import { a, b } from './0' assert { "type": "json" } - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - import * as foo from './0' assert { type: "json" } + import './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import { a, b } from './0' with { "type": "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import * as foo from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. a; b; foo.a; foo.b; ==== 2.ts (2 errors) ==== - import { a, b } from './0' assert {} - ~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import { a, b } from './0' with {} + ~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. a; b; c; @@ -47,14 +47,14 @@ ==== 3.ts (9 errors) ==== const a = import('./0') - const b = import('./0', { assert: { type: "json" } }) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + const b = import('./0', { with: { type: "json" } }) + ~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. - const c = import('./0', { assert: { type: "json", ttype: "typo" } }) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + const c = import('./0', { with: { type: "json", ttype: "typo" } }) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. - const d = import('./0', { assert: {} }) - ~~~~~~~~~~~~~~ + const d = import('./0', { with: {} }) + ~~~~~~~~~~~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. const dd = import('./0', {}) ~~ @@ -69,10 +69,10 @@ const g = import('./0', {}, {}) ~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. - const h = import('./0', { assert: { type: "json" }},) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + const h = import('./0', { with: { type: "json" }},) + ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1324: Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'node18', 'node20', 'nodenext', or 'preserve'. - ~ + ~ !!! error TS1009: Trailing comma not allowed. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion1(module=commonjs).js b/tests/baselines/reference/importAssertion1(module=commonjs).js index a927686c3499c..e899640ac39da 100644 --- a/tests/baselines/reference/importAssertion1(module=commonjs).js +++ b/tests/baselines/reference/importAssertion1(module=commonjs).js @@ -5,17 +5,17 @@ export const a = 1; export const b = 2; //// [1.ts] -import './0' assert { type: "json" } -import { a, b } from './0' assert { "type": "json" } -import * as foo from './0' assert { type: "json" } +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } +import * as foo from './0' with { type: "json" } a; b; foo.a; foo.b; //// [2.ts] -import { a, b } from './0' assert {} -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +import { a, b } from './0' with {} +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } a; b; c; @@ -23,15 +23,15 @@ d; //// [3.ts] const a = import('./0') -const b = import('./0', { assert: { type: "json" } }) -const c = import('./0', { assert: { type: "json", ttype: "typo" } }) -const d = import('./0', { assert: {} }) +const b = import('./0', { with: { type: "json" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +const d = import('./0', { with: {} }) const dd = import('./0', {}) declare function foo(): any; const e = import('./0', foo()) const f = import() const g = import('./0', {}, {}) -const h = import('./0', { assert: { type: "json" }},) +const h = import('./0', { with: { type: "json" }},) diff --git a/tests/baselines/reference/importAssertion1(module=commonjs).symbols b/tests/baselines/reference/importAssertion1(module=commonjs).symbols index 99ba5af25ebca..512bdbd4534ef 100644 --- a/tests/baselines/reference/importAssertion1(module=commonjs).symbols +++ b/tests/baselines/reference/importAssertion1(module=commonjs).symbols @@ -8,12 +8,12 @@ export const b = 2; >b : Symbol(b, Decl(0.ts, 1, 12)) === 1.ts === -import './0' assert { type: "json" } -import { a, b } from './0' assert { "type": "json" } +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } >a : Symbol(a, Decl(1.ts, 1, 8)) >b : Symbol(b, Decl(1.ts, 1, 11)) -import * as foo from './0' assert { type: "json" } +import * as foo from './0' with { type: "json" } >foo : Symbol(foo, Decl(1.ts, 2, 6)) a; @@ -33,11 +33,11 @@ foo.b; >b : Symbol(b, Decl(0.ts, 1, 12)) === 2.ts === -import { a, b } from './0' assert {} +import { a, b } from './0' with {} >a : Symbol(a, Decl(2.ts, 0, 8)) >b : Symbol(b, Decl(2.ts, 0, 11)) -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : Symbol(a, Decl(0.ts, 0, 12)) >c : Symbol(c, Decl(2.ts, 1, 8)) >b : Symbol(b, Decl(0.ts, 1, 12)) @@ -60,23 +60,23 @@ const a = import('./0') >a : Symbol(a, Decl(3.ts, 0, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) -const b = import('./0', { assert: { type: "json" } }) +const b = import('./0', { with: { type: "json" } }) >b : Symbol(b, Decl(3.ts, 1, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 1, 25)) ->type : Symbol(type, Decl(3.ts, 1, 35)) +>with : Symbol(with, Decl(3.ts, 1, 25)) +>type : Symbol(type, Decl(3.ts, 1, 33)) -const c = import('./0', { assert: { type: "json", ttype: "typo" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) >c : Symbol(c, Decl(3.ts, 2, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 2, 25)) ->type : Symbol(type, Decl(3.ts, 2, 35)) ->ttype : Symbol(ttype, Decl(3.ts, 2, 49)) +>with : Symbol(with, Decl(3.ts, 2, 25)) +>type : Symbol(type, Decl(3.ts, 2, 33)) +>ttype : Symbol(ttype, Decl(3.ts, 2, 47)) -const d = import('./0', { assert: {} }) +const d = import('./0', { with: {} }) >d : Symbol(d, Decl(3.ts, 3, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 3, 25)) +>with : Symbol(with, Decl(3.ts, 3, 25)) const dd = import('./0', {}) >dd : Symbol(dd, Decl(3.ts, 4, 5)) @@ -97,10 +97,10 @@ const g = import('./0', {}, {}) >g : Symbol(g, Decl(3.ts, 8, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) -const h = import('./0', { assert: { type: "json" }},) +const h = import('./0', { with: { type: "json" }},) >h : Symbol(h, Decl(3.ts, 9, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 9, 25)) ->type : Symbol(type, Decl(3.ts, 9, 35)) +>with : Symbol(with, Decl(3.ts, 9, 25)) +>type : Symbol(type, Decl(3.ts, 9, 33)) diff --git a/tests/baselines/reference/importAssertion1(module=commonjs).types b/tests/baselines/reference/importAssertion1(module=commonjs).types index 8c64e06b78f3e..022fd97137655 100644 --- a/tests/baselines/reference/importAssertion1(module=commonjs).types +++ b/tests/baselines/reference/importAssertion1(module=commonjs).types @@ -14,17 +14,17 @@ export const b = 2; > : ^ === 1.ts === -import './0' assert { type: "json" } +import './0' with { type: "json" } >type : any > : ^^^ -import { a, b } from './0' assert { "type": "json" } +import { a, b } from './0' with { "type": "json" } >a : 1 > : ^ >b : 2 > : ^ -import * as foo from './0' assert { type: "json" } +import * as foo from './0' with { type: "json" } >foo : typeof foo > : ^^^^^^^^^^ >type : any @@ -55,13 +55,13 @@ foo.b; > : ^ === 2.ts === -import { a, b } from './0' assert {} +import { a, b } from './0' with {} >a : 1 > : ^ >b : 2 > : ^ -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : 1 > : ^ >c : 1 @@ -102,17 +102,17 @@ const a = import('./0') >'./0' : "./0" > : ^^^^^ -const b = import('./0', { assert: { type: "json" } }) +const b = import('./0', { with: { type: "json" } }) >b : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: { type: "json" } }) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: { type: "json" } }) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: { type: "json" } } : { assert: { type: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; } -> : ^^^^^^^^^^^^^^^^^ +>{ with: { type: "json" } } : { with: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; } +> : ^^^^^^^^^^^^^^^^^ >{ type: "json" } : { type: string; } > : ^^^^^^^^^^^^^^^^^ >type : string @@ -120,17 +120,17 @@ const b = import('./0', { assert: { type: "json" } }) >"json" : "json" > : ^^^^^^ -const c = import('./0', { assert: { type: "json", ttype: "typo" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) >c : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: { type: "json", ttype: "typo" } }) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: { type: "json", ttype: "typo" } }) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: { type: "json", ttype: "typo" } } : { assert: { type: string; ttype: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; ttype: string; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>{ with: { type: "json", ttype: "typo" } } : { with: { type: string; ttype: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; ttype: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >{ type: "json", ttype: "typo" } : { type: string; ttype: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : string @@ -142,17 +142,17 @@ const c = import('./0', { assert: { type: "json", ttype: "typo" } }) >"typo" : "typo" > : ^^^^^^ -const d = import('./0', { assert: {} }) +const d = import('./0', { with: {} }) >d : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: {} }) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: {} }) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: {} } : { assert: {}; } -> : ^^^^^^^^^^^^^^^ ->assert : {} -> : ^^ +>{ with: {} } : { with: {}; } +> : ^^^^^^^^^^^^^ +>with : {} +> : ^^ >{} : {} > : ^^ @@ -200,17 +200,17 @@ const g = import('./0', {}, {}) >{} : {} > : ^^ -const h = import('./0', { assert: { type: "json" }},) +const h = import('./0', { with: { type: "json" }},) >h : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: { type: "json" }},) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: { type: "json" }},) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: { type: "json" }} : { assert: { type: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; } -> : ^^^^^^^^^^^^^^^^^ +>{ with: { type: "json" }} : { with: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; } +> : ^^^^^^^^^^^^^^^^^ >{ type: "json" } : { type: string; } > : ^^^^^^^^^^^^^^^^^ >type : string diff --git a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt index 8d120f6aab05e..94cc15d8d3809 100644 --- a/tests/baselines/reference/importAssertion1(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=es2015).errors.txt @@ -1,8 +1,8 @@ -1.ts(1,14): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -1.ts(3,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -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.ts(1,14): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(3,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. 3.ts(1,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. 3.ts(2,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. 3.ts(3,11): error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. @@ -19,27 +19,27 @@ export const b = 2; ==== 1.ts (3 errors) ==== - import './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - import { a, b } from './0' assert { "type": "json" } - ~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - import * as foo from './0' assert { type: "json" } + import './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import { a, b } from './0' with { "type": "json" } ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import * as foo from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. a; b; foo.a; foo.b; ==== 2.ts (2 errors) ==== - import { a, b } from './0' assert {} - ~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import { a, b } from './0' with {} + ~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. a; b; c; @@ -49,14 +49,14 @@ const a = import('./0') ~~~~~~~~~~~~~ !!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. - const b = import('./0', { assert: { type: "json" } }) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + const b = import('./0', { with: { type: "json" } }) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. - const c = import('./0', { assert: { type: "json", ttype: "typo" } }) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + const c = import('./0', { with: { type: "json", ttype: "typo" } }) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. - const d = import('./0', { assert: {} }) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + const d = import('./0', { with: {} }) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. const dd = import('./0', {}) ~~~~~~~~~~~~~~~~~ @@ -71,8 +71,8 @@ const g = import('./0', {}, {}) ~~~~~~~~~~~~~~~~~~~~~ !!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. - const h = import('./0', { assert: { type: "json" }},) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + const h = import('./0', { with: { type: "json" }},) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1323: Dynamic imports are only supported when the '--module' flag is set to 'es2020', 'es2022', 'esnext', 'commonjs', 'amd', 'system', 'umd', 'node16', 'node18', 'node20', or 'nodenext'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion1(module=es2015).js b/tests/baselines/reference/importAssertion1(module=es2015).js index 0dcd0888aed9d..b7c173f486400 100644 --- a/tests/baselines/reference/importAssertion1(module=es2015).js +++ b/tests/baselines/reference/importAssertion1(module=es2015).js @@ -5,17 +5,17 @@ export const a = 1; export const b = 2; //// [1.ts] -import './0' assert { type: "json" } -import { a, b } from './0' assert { "type": "json" } -import * as foo from './0' assert { type: "json" } +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } +import * as foo from './0' with { type: "json" } a; b; foo.a; foo.b; //// [2.ts] -import { a, b } from './0' assert {} -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +import { a, b } from './0' with {} +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } a; b; c; @@ -23,15 +23,15 @@ d; //// [3.ts] const a = import('./0') -const b = import('./0', { assert: { type: "json" } }) -const c = import('./0', { assert: { type: "json", ttype: "typo" } }) -const d = import('./0', { assert: {} }) +const b = import('./0', { with: { type: "json" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +const d = import('./0', { with: {} }) const dd = import('./0', {}) declare function foo(): any; const e = import('./0', foo()) const f = import() const g = import('./0', {}, {}) -const h = import('./0', { assert: { type: "json" }},) +const h = import('./0', { with: { type: "json" }},) @@ -39,30 +39,30 @@ const h = import('./0', { assert: { type: "json" }},) export const a = 1; export const b = 2; //// [1.js] -import './0' assert { type: "json" }; -import { a, b } from './0' assert { "type": "json" }; -import * as foo from './0' assert { type: "json" }; +import './0' with { type: "json" }; +import { a, b } from './0' with { "type": "json" }; +import * as foo from './0' with { type: "json" }; a; b; foo.a; foo.b; //// [2.js] -import { a, b } from './0' assert {}; -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }; +import { a, b } from './0' with {}; +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" }; a; b; c; d; //// [3.js] const a = import('./0'); -const b = import('./0', { assert: { type: "json" } }); -const c = import('./0', { assert: { type: "json", ttype: "typo" } }); -const d = import('./0', { assert: {} }); +const b = import('./0', { with: { type: "json" } }); +const c = import('./0', { with: { type: "json", ttype: "typo" } }); +const d = import('./0', { with: {} }); const dd = import('./0', {}); const e = import('./0', foo()); const f = import(); const g = import('./0', {}, {}); -const h = import('./0', { assert: { type: "json" } }); +const h = import('./0', { with: { type: "json" } }); //// [0.d.ts] diff --git a/tests/baselines/reference/importAssertion1(module=es2015).symbols b/tests/baselines/reference/importAssertion1(module=es2015).symbols index 99ba5af25ebca..512bdbd4534ef 100644 --- a/tests/baselines/reference/importAssertion1(module=es2015).symbols +++ b/tests/baselines/reference/importAssertion1(module=es2015).symbols @@ -8,12 +8,12 @@ export const b = 2; >b : Symbol(b, Decl(0.ts, 1, 12)) === 1.ts === -import './0' assert { type: "json" } -import { a, b } from './0' assert { "type": "json" } +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } >a : Symbol(a, Decl(1.ts, 1, 8)) >b : Symbol(b, Decl(1.ts, 1, 11)) -import * as foo from './0' assert { type: "json" } +import * as foo from './0' with { type: "json" } >foo : Symbol(foo, Decl(1.ts, 2, 6)) a; @@ -33,11 +33,11 @@ foo.b; >b : Symbol(b, Decl(0.ts, 1, 12)) === 2.ts === -import { a, b } from './0' assert {} +import { a, b } from './0' with {} >a : Symbol(a, Decl(2.ts, 0, 8)) >b : Symbol(b, Decl(2.ts, 0, 11)) -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : Symbol(a, Decl(0.ts, 0, 12)) >c : Symbol(c, Decl(2.ts, 1, 8)) >b : Symbol(b, Decl(0.ts, 1, 12)) @@ -60,23 +60,23 @@ const a = import('./0') >a : Symbol(a, Decl(3.ts, 0, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) -const b = import('./0', { assert: { type: "json" } }) +const b = import('./0', { with: { type: "json" } }) >b : Symbol(b, Decl(3.ts, 1, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 1, 25)) ->type : Symbol(type, Decl(3.ts, 1, 35)) +>with : Symbol(with, Decl(3.ts, 1, 25)) +>type : Symbol(type, Decl(3.ts, 1, 33)) -const c = import('./0', { assert: { type: "json", ttype: "typo" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) >c : Symbol(c, Decl(3.ts, 2, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 2, 25)) ->type : Symbol(type, Decl(3.ts, 2, 35)) ->ttype : Symbol(ttype, Decl(3.ts, 2, 49)) +>with : Symbol(with, Decl(3.ts, 2, 25)) +>type : Symbol(type, Decl(3.ts, 2, 33)) +>ttype : Symbol(ttype, Decl(3.ts, 2, 47)) -const d = import('./0', { assert: {} }) +const d = import('./0', { with: {} }) >d : Symbol(d, Decl(3.ts, 3, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 3, 25)) +>with : Symbol(with, Decl(3.ts, 3, 25)) const dd = import('./0', {}) >dd : Symbol(dd, Decl(3.ts, 4, 5)) @@ -97,10 +97,10 @@ const g = import('./0', {}, {}) >g : Symbol(g, Decl(3.ts, 8, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) -const h = import('./0', { assert: { type: "json" }},) +const h = import('./0', { with: { type: "json" }},) >h : Symbol(h, Decl(3.ts, 9, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 9, 25)) ->type : Symbol(type, Decl(3.ts, 9, 35)) +>with : Symbol(with, Decl(3.ts, 9, 25)) +>type : Symbol(type, Decl(3.ts, 9, 33)) diff --git a/tests/baselines/reference/importAssertion1(module=es2015).types b/tests/baselines/reference/importAssertion1(module=es2015).types index 8c64e06b78f3e..022fd97137655 100644 --- a/tests/baselines/reference/importAssertion1(module=es2015).types +++ b/tests/baselines/reference/importAssertion1(module=es2015).types @@ -14,17 +14,17 @@ export const b = 2; > : ^ === 1.ts === -import './0' assert { type: "json" } +import './0' with { type: "json" } >type : any > : ^^^ -import { a, b } from './0' assert { "type": "json" } +import { a, b } from './0' with { "type": "json" } >a : 1 > : ^ >b : 2 > : ^ -import * as foo from './0' assert { type: "json" } +import * as foo from './0' with { type: "json" } >foo : typeof foo > : ^^^^^^^^^^ >type : any @@ -55,13 +55,13 @@ foo.b; > : ^ === 2.ts === -import { a, b } from './0' assert {} +import { a, b } from './0' with {} >a : 1 > : ^ >b : 2 > : ^ -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : 1 > : ^ >c : 1 @@ -102,17 +102,17 @@ const a = import('./0') >'./0' : "./0" > : ^^^^^ -const b = import('./0', { assert: { type: "json" } }) +const b = import('./0', { with: { type: "json" } }) >b : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: { type: "json" } }) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: { type: "json" } }) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: { type: "json" } } : { assert: { type: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; } -> : ^^^^^^^^^^^^^^^^^ +>{ with: { type: "json" } } : { with: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; } +> : ^^^^^^^^^^^^^^^^^ >{ type: "json" } : { type: string; } > : ^^^^^^^^^^^^^^^^^ >type : string @@ -120,17 +120,17 @@ const b = import('./0', { assert: { type: "json" } }) >"json" : "json" > : ^^^^^^ -const c = import('./0', { assert: { type: "json", ttype: "typo" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) >c : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: { type: "json", ttype: "typo" } }) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: { type: "json", ttype: "typo" } }) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: { type: "json", ttype: "typo" } } : { assert: { type: string; ttype: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; ttype: string; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>{ with: { type: "json", ttype: "typo" } } : { with: { type: string; ttype: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; ttype: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >{ type: "json", ttype: "typo" } : { type: string; ttype: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : string @@ -142,17 +142,17 @@ const c = import('./0', { assert: { type: "json", ttype: "typo" } }) >"typo" : "typo" > : ^^^^^^ -const d = import('./0', { assert: {} }) +const d = import('./0', { with: {} }) >d : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: {} }) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: {} }) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: {} } : { assert: {}; } -> : ^^^^^^^^^^^^^^^ ->assert : {} -> : ^^ +>{ with: {} } : { with: {}; } +> : ^^^^^^^^^^^^^ +>with : {} +> : ^^ >{} : {} > : ^^ @@ -200,17 +200,17 @@ const g = import('./0', {}, {}) >{} : {} > : ^^ -const h = import('./0', { assert: { type: "json" }},) +const h = import('./0', { with: { type: "json" }},) >h : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: { type: "json" }},) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: { type: "json" }},) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: { type: "json" }} : { assert: { type: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; } -> : ^^^^^^^^^^^^^^^^^ +>{ with: { type: "json" }} : { with: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; } +> : ^^^^^^^^^^^^^^^^^ >{ type: "json" } : { type: string; } > : ^^^^^^^^^^^^^^^^^ >type : string diff --git a/tests/baselines/reference/importAssertion1(module=esnext).errors.txt b/tests/baselines/reference/importAssertion1(module=esnext).errors.txt index e8100730813c4..80932a4972b56 100644 --- a/tests/baselines/reference/importAssertion1(module=esnext).errors.txt +++ b/tests/baselines/reference/importAssertion1(module=esnext).errors.txt @@ -7,17 +7,17 @@ export const b = 2; ==== 1.ts (0 errors) ==== - import './0' assert { type: "json" } - import { a, b } from './0' assert { "type": "json" } - import * as foo from './0' assert { type: "json" } + import './0' with { type: "json" } + import { a, b } from './0' with { "type": "json" } + import * as foo from './0' with { type: "json" } a; b; foo.a; foo.b; ==== 2.ts (0 errors) ==== - import { a, b } from './0' assert {} - import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } + import { a, b } from './0' with {} + import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } a; b; c; @@ -25,9 +25,9 @@ ==== 3.ts (2 errors) ==== const a = import('./0') - const b = import('./0', { assert: { type: "json" } }) - const c = import('./0', { assert: { type: "json", ttype: "typo" } }) - const d = import('./0', { assert: {} }) + const b = import('./0', { with: { type: "json" } }) + const c = import('./0', { with: { type: "json", ttype: "typo" } }) + const d = import('./0', { with: {} }) const dd = import('./0', {}) declare function foo(): any; const e = import('./0', foo()) @@ -37,6 +37,6 @@ const g = import('./0', {}, {}) ~~~~~~~~~~~~~~~~~~~~~ !!! message TS1450: Dynamic imports can only accept a module specifier and an optional set of attributes as arguments - const h = import('./0', { assert: { type: "json" }},) + const h = import('./0', { with: { type: "json" }},) \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion1(module=esnext).js b/tests/baselines/reference/importAssertion1(module=esnext).js index 0dcd0888aed9d..b7c173f486400 100644 --- a/tests/baselines/reference/importAssertion1(module=esnext).js +++ b/tests/baselines/reference/importAssertion1(module=esnext).js @@ -5,17 +5,17 @@ export const a = 1; export const b = 2; //// [1.ts] -import './0' assert { type: "json" } -import { a, b } from './0' assert { "type": "json" } -import * as foo from './0' assert { type: "json" } +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } +import * as foo from './0' with { type: "json" } a; b; foo.a; foo.b; //// [2.ts] -import { a, b } from './0' assert {} -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +import { a, b } from './0' with {} +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } a; b; c; @@ -23,15 +23,15 @@ d; //// [3.ts] const a = import('./0') -const b = import('./0', { assert: { type: "json" } }) -const c = import('./0', { assert: { type: "json", ttype: "typo" } }) -const d = import('./0', { assert: {} }) +const b = import('./0', { with: { type: "json" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +const d = import('./0', { with: {} }) const dd = import('./0', {}) declare function foo(): any; const e = import('./0', foo()) const f = import() const g = import('./0', {}, {}) -const h = import('./0', { assert: { type: "json" }},) +const h = import('./0', { with: { type: "json" }},) @@ -39,30 +39,30 @@ const h = import('./0', { assert: { type: "json" }},) export const a = 1; export const b = 2; //// [1.js] -import './0' assert { type: "json" }; -import { a, b } from './0' assert { "type": "json" }; -import * as foo from './0' assert { type: "json" }; +import './0' with { type: "json" }; +import { a, b } from './0' with { "type": "json" }; +import * as foo from './0' with { type: "json" }; a; b; foo.a; foo.b; //// [2.js] -import { a, b } from './0' assert {}; -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }; +import { a, b } from './0' with {}; +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" }; a; b; c; d; //// [3.js] const a = import('./0'); -const b = import('./0', { assert: { type: "json" } }); -const c = import('./0', { assert: { type: "json", ttype: "typo" } }); -const d = import('./0', { assert: {} }); +const b = import('./0', { with: { type: "json" } }); +const c = import('./0', { with: { type: "json", ttype: "typo" } }); +const d = import('./0', { with: {} }); const dd = import('./0', {}); const e = import('./0', foo()); const f = import(); const g = import('./0', {}, {}); -const h = import('./0', { assert: { type: "json" } }); +const h = import('./0', { with: { type: "json" } }); //// [0.d.ts] diff --git a/tests/baselines/reference/importAssertion1(module=esnext).symbols b/tests/baselines/reference/importAssertion1(module=esnext).symbols index 99ba5af25ebca..512bdbd4534ef 100644 --- a/tests/baselines/reference/importAssertion1(module=esnext).symbols +++ b/tests/baselines/reference/importAssertion1(module=esnext).symbols @@ -8,12 +8,12 @@ export const b = 2; >b : Symbol(b, Decl(0.ts, 1, 12)) === 1.ts === -import './0' assert { type: "json" } -import { a, b } from './0' assert { "type": "json" } +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } >a : Symbol(a, Decl(1.ts, 1, 8)) >b : Symbol(b, Decl(1.ts, 1, 11)) -import * as foo from './0' assert { type: "json" } +import * as foo from './0' with { type: "json" } >foo : Symbol(foo, Decl(1.ts, 2, 6)) a; @@ -33,11 +33,11 @@ foo.b; >b : Symbol(b, Decl(0.ts, 1, 12)) === 2.ts === -import { a, b } from './0' assert {} +import { a, b } from './0' with {} >a : Symbol(a, Decl(2.ts, 0, 8)) >b : Symbol(b, Decl(2.ts, 0, 11)) -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : Symbol(a, Decl(0.ts, 0, 12)) >c : Symbol(c, Decl(2.ts, 1, 8)) >b : Symbol(b, Decl(0.ts, 1, 12)) @@ -60,23 +60,23 @@ const a = import('./0') >a : Symbol(a, Decl(3.ts, 0, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) -const b = import('./0', { assert: { type: "json" } }) +const b = import('./0', { with: { type: "json" } }) >b : Symbol(b, Decl(3.ts, 1, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 1, 25)) ->type : Symbol(type, Decl(3.ts, 1, 35)) +>with : Symbol(with, Decl(3.ts, 1, 25)) +>type : Symbol(type, Decl(3.ts, 1, 33)) -const c = import('./0', { assert: { type: "json", ttype: "typo" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) >c : Symbol(c, Decl(3.ts, 2, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 2, 25)) ->type : Symbol(type, Decl(3.ts, 2, 35)) ->ttype : Symbol(ttype, Decl(3.ts, 2, 49)) +>with : Symbol(with, Decl(3.ts, 2, 25)) +>type : Symbol(type, Decl(3.ts, 2, 33)) +>ttype : Symbol(ttype, Decl(3.ts, 2, 47)) -const d = import('./0', { assert: {} }) +const d = import('./0', { with: {} }) >d : Symbol(d, Decl(3.ts, 3, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 3, 25)) +>with : Symbol(with, Decl(3.ts, 3, 25)) const dd = import('./0', {}) >dd : Symbol(dd, Decl(3.ts, 4, 5)) @@ -97,10 +97,10 @@ const g = import('./0', {}, {}) >g : Symbol(g, Decl(3.ts, 8, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) -const h = import('./0', { assert: { type: "json" }},) +const h = import('./0', { with: { type: "json" }},) >h : Symbol(h, Decl(3.ts, 9, 5)) >'./0' : Symbol("0", Decl(0.ts, 0, 0)) ->assert : Symbol(assert, Decl(3.ts, 9, 25)) ->type : Symbol(type, Decl(3.ts, 9, 35)) +>with : Symbol(with, Decl(3.ts, 9, 25)) +>type : Symbol(type, Decl(3.ts, 9, 33)) diff --git a/tests/baselines/reference/importAssertion1(module=esnext).types b/tests/baselines/reference/importAssertion1(module=esnext).types index 8c64e06b78f3e..022fd97137655 100644 --- a/tests/baselines/reference/importAssertion1(module=esnext).types +++ b/tests/baselines/reference/importAssertion1(module=esnext).types @@ -14,17 +14,17 @@ export const b = 2; > : ^ === 1.ts === -import './0' assert { type: "json" } +import './0' with { type: "json" } >type : any > : ^^^ -import { a, b } from './0' assert { "type": "json" } +import { a, b } from './0' with { "type": "json" } >a : 1 > : ^ >b : 2 > : ^ -import * as foo from './0' assert { type: "json" } +import * as foo from './0' with { type: "json" } >foo : typeof foo > : ^^^^^^^^^^ >type : any @@ -55,13 +55,13 @@ foo.b; > : ^ === 2.ts === -import { a, b } from './0' assert {} +import { a, b } from './0' with {} >a : 1 > : ^ >b : 2 > : ^ -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : 1 > : ^ >c : 1 @@ -102,17 +102,17 @@ const a = import('./0') >'./0' : "./0" > : ^^^^^ -const b = import('./0', { assert: { type: "json" } }) +const b = import('./0', { with: { type: "json" } }) >b : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: { type: "json" } }) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: { type: "json" } }) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: { type: "json" } } : { assert: { type: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; } -> : ^^^^^^^^^^^^^^^^^ +>{ with: { type: "json" } } : { with: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; } +> : ^^^^^^^^^^^^^^^^^ >{ type: "json" } : { type: string; } > : ^^^^^^^^^^^^^^^^^ >type : string @@ -120,17 +120,17 @@ const b = import('./0', { assert: { type: "json" } }) >"json" : "json" > : ^^^^^^ -const c = import('./0', { assert: { type: "json", ttype: "typo" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) >c : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: { type: "json", ttype: "typo" } }) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: { type: "json", ttype: "typo" } }) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: { type: "json", ttype: "typo" } } : { assert: { type: string; ttype: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; ttype: string; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>{ with: { type: "json", ttype: "typo" } } : { with: { type: string; ttype: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; ttype: string; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >{ type: "json", ttype: "typo" } : { type: string; ttype: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : string @@ -142,17 +142,17 @@ const c = import('./0', { assert: { type: "json", ttype: "typo" } }) >"typo" : "typo" > : ^^^^^^ -const d = import('./0', { assert: {} }) +const d = import('./0', { with: {} }) >d : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: {} }) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: {} }) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: {} } : { assert: {}; } -> : ^^^^^^^^^^^^^^^ ->assert : {} -> : ^^ +>{ with: {} } : { with: {}; } +> : ^^^^^^^^^^^^^ +>with : {} +> : ^^ >{} : {} > : ^^ @@ -200,17 +200,17 @@ const g = import('./0', {}, {}) >{} : {} > : ^^ -const h = import('./0', { assert: { type: "json" }},) +const h = import('./0', { with: { type: "json" }},) >h : Promise > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import('./0', { assert: { type: "json" }},) : Promise -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import('./0', { with: { type: "json" }},) : Promise +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^ >'./0' : "./0" > : ^^^^^ ->{ assert: { type: "json" }} : { assert: { type: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; } -> : ^^^^^^^^^^^^^^^^^ +>{ with: { type: "json" }} : { with: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; } +> : ^^^^^^^^^^^^^^^^^ >{ type: "json" } : { type: string; } > : ^^^^^^^^^^^^^^^^^ >type : string diff --git a/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt b/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt index a71f6df42c13d..7171347b35feb 100644 --- a/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt +++ b/tests/baselines/reference/importAssertion2(module=commonjs).errors.txt @@ -1,9 +1,9 @@ -1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -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.ts(1,22): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(3,21): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(4,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. ==== 0.ts (0 errors) ==== @@ -11,24 +11,24 @@ export const b = 2; ==== 1.ts (4 errors) ==== - export {} from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - export { a, b } from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - export * from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - export * as ns from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export {} from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export { a, b } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export * from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export * as ns from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. ==== 2.ts (2 errors) ==== - export { a, b } from './0' assert {} - ~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export { a, b } from './0' with {} + ~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=commonjs).js b/tests/baselines/reference/importAssertion2(module=commonjs).js index a3c51d1f8513f..fc784a987ea30 100644 --- a/tests/baselines/reference/importAssertion2(module=commonjs).js +++ b/tests/baselines/reference/importAssertion2(module=commonjs).js @@ -5,14 +5,14 @@ export const a = 1; export const b = 2; //// [1.ts] -export {} from './0' assert { type: "json" } -export { a, b } from './0' assert { type: "json" } -export * from './0' assert { type: "json" } -export * as ns from './0' assert { type: "json" } +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } //// [2.ts] -export { a, b } from './0' assert {} -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +export { a, b } from './0' with {} +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } //// [0.js] diff --git a/tests/baselines/reference/importAssertion2(module=commonjs).symbols b/tests/baselines/reference/importAssertion2(module=commonjs).symbols index 6b6fb9a9370a5..9b073e389ea3a 100644 --- a/tests/baselines/reference/importAssertion2(module=commonjs).symbols +++ b/tests/baselines/reference/importAssertion2(module=commonjs).symbols @@ -8,21 +8,21 @@ export const b = 2; >b : Symbol(b, Decl(0.ts, 1, 12)) === 1.ts === -export {} from './0' assert { type: "json" } -export { a, b } from './0' assert { type: "json" } +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } >a : Symbol(a, Decl(1.ts, 1, 8)) >b : Symbol(b, Decl(1.ts, 1, 11)) -export * from './0' assert { type: "json" } -export * as ns from './0' assert { type: "json" } +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } >ns : Symbol(ns, Decl(1.ts, 3, 6)) === 2.ts === -export { a, b } from './0' assert {} +export { a, b } from './0' with {} >a : Symbol(a, Decl(2.ts, 0, 8)) >b : Symbol(b, Decl(2.ts, 0, 11)) -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : Symbol(a, Decl(0.ts, 0, 12)) >c : Symbol(c, Decl(2.ts, 1, 8)) >b : Symbol(b, Decl(0.ts, 1, 12)) diff --git a/tests/baselines/reference/importAssertion2(module=commonjs).types b/tests/baselines/reference/importAssertion2(module=commonjs).types index b0af07fa4f6fd..dde7f0f479b9f 100644 --- a/tests/baselines/reference/importAssertion2(module=commonjs).types +++ b/tests/baselines/reference/importAssertion2(module=commonjs).types @@ -14,11 +14,11 @@ export const b = 2; > : ^ === 1.ts === -export {} from './0' assert { type: "json" } +export {} from './0' with { type: "json" } >type : any > : ^^^ -export { a, b } from './0' assert { type: "json" } +export { a, b } from './0' with { type: "json" } >a : 1 > : ^ >b : 2 @@ -26,24 +26,24 @@ export { a, b } from './0' assert { type: "json" } >type : any > : ^^^ -export * from './0' assert { type: "json" } +export * from './0' with { type: "json" } >type : any > : ^^^ -export * as ns from './0' assert { type: "json" } +export * as ns from './0' with { type: "json" } >ns : typeof import("0") > : ^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ === 2.ts === -export { a, b } from './0' assert {} +export { a, b } from './0' with {} >a : 1 > : ^ >b : 2 > : ^ -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : 1 > : ^ >c : 1 diff --git a/tests/baselines/reference/importAssertion2(module=es2015).errors.txt b/tests/baselines/reference/importAssertion2(module=es2015).errors.txt index a71f6df42c13d..7171347b35feb 100644 --- a/tests/baselines/reference/importAssertion2(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion2(module=es2015).errors.txt @@ -1,9 +1,9 @@ -1.ts(1,22): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -1.ts(2,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -1.ts(3,21): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -1.ts(4,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -2.ts(1,28): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -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.ts(1,22): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(2,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(3,21): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(4,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +2.ts(1,28): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +2.ts(2,38): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. ==== 0.ts (0 errors) ==== @@ -11,24 +11,24 @@ export const b = 2; ==== 1.ts (4 errors) ==== - export {} from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - export { a, b } from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - export * from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - export * as ns from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export {} from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export { a, b } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export * from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export * as ns from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. ==== 2.ts (2 errors) ==== - export { a, b } from './0' assert {} - ~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export { a, b } from './0' with {} + ~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion2(module=es2015).js b/tests/baselines/reference/importAssertion2(module=es2015).js index 01804f2b0de3b..25a70583d401b 100644 --- a/tests/baselines/reference/importAssertion2(module=es2015).js +++ b/tests/baselines/reference/importAssertion2(module=es2015).js @@ -5,27 +5,27 @@ export const a = 1; export const b = 2; //// [1.ts] -export {} from './0' assert { type: "json" } -export { a, b } from './0' assert { type: "json" } -export * from './0' assert { type: "json" } -export * as ns from './0' assert { type: "json" } +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } //// [2.ts] -export { a, b } from './0' assert {} -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +export { a, b } from './0' with {} +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } //// [0.js] export const a = 1; export const b = 2; //// [1.js] -export { a, b } from './0' assert { type: "json" }; -export * from './0' assert { type: "json" }; -import * as ns_1 from './0' assert { type: "json" }; +export { a, b } from './0' with { type: "json" }; +export * from './0' with { type: "json" }; +import * as ns_1 from './0' with { type: "json" }; export { ns_1 as ns }; //// [2.js] -export { a, b } from './0' assert {}; -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }; +export { a, b } from './0' with {}; +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" }; //// [0.d.ts] diff --git a/tests/baselines/reference/importAssertion2(module=es2015).symbols b/tests/baselines/reference/importAssertion2(module=es2015).symbols index 6b6fb9a9370a5..9b073e389ea3a 100644 --- a/tests/baselines/reference/importAssertion2(module=es2015).symbols +++ b/tests/baselines/reference/importAssertion2(module=es2015).symbols @@ -8,21 +8,21 @@ export const b = 2; >b : Symbol(b, Decl(0.ts, 1, 12)) === 1.ts === -export {} from './0' assert { type: "json" } -export { a, b } from './0' assert { type: "json" } +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } >a : Symbol(a, Decl(1.ts, 1, 8)) >b : Symbol(b, Decl(1.ts, 1, 11)) -export * from './0' assert { type: "json" } -export * as ns from './0' assert { type: "json" } +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } >ns : Symbol(ns, Decl(1.ts, 3, 6)) === 2.ts === -export { a, b } from './0' assert {} +export { a, b } from './0' with {} >a : Symbol(a, Decl(2.ts, 0, 8)) >b : Symbol(b, Decl(2.ts, 0, 11)) -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : Symbol(a, Decl(0.ts, 0, 12)) >c : Symbol(c, Decl(2.ts, 1, 8)) >b : Symbol(b, Decl(0.ts, 1, 12)) diff --git a/tests/baselines/reference/importAssertion2(module=es2015).types b/tests/baselines/reference/importAssertion2(module=es2015).types index b0af07fa4f6fd..dde7f0f479b9f 100644 --- a/tests/baselines/reference/importAssertion2(module=es2015).types +++ b/tests/baselines/reference/importAssertion2(module=es2015).types @@ -14,11 +14,11 @@ export const b = 2; > : ^ === 1.ts === -export {} from './0' assert { type: "json" } +export {} from './0' with { type: "json" } >type : any > : ^^^ -export { a, b } from './0' assert { type: "json" } +export { a, b } from './0' with { type: "json" } >a : 1 > : ^ >b : 2 @@ -26,24 +26,24 @@ export { a, b } from './0' assert { type: "json" } >type : any > : ^^^ -export * from './0' assert { type: "json" } +export * from './0' with { type: "json" } >type : any > : ^^^ -export * as ns from './0' assert { type: "json" } +export * as ns from './0' with { type: "json" } >ns : typeof import("0") > : ^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ === 2.ts === -export { a, b } from './0' assert {} +export { a, b } from './0' with {} >a : 1 > : ^ >b : 2 > : ^ -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : 1 > : ^ >c : 1 diff --git a/tests/baselines/reference/importAssertion2(module=esnext).js b/tests/baselines/reference/importAssertion2(module=esnext).js index f57ec44cc1546..4ab9dd3751d70 100644 --- a/tests/baselines/reference/importAssertion2(module=esnext).js +++ b/tests/baselines/reference/importAssertion2(module=esnext).js @@ -5,26 +5,26 @@ export const a = 1; export const b = 2; //// [1.ts] -export {} from './0' assert { type: "json" } -export { a, b } from './0' assert { type: "json" } -export * from './0' assert { type: "json" } -export * as ns from './0' assert { type: "json" } +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } //// [2.ts] -export { a, b } from './0' assert {} -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +export { a, b } from './0' with {} +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } //// [0.js] export const a = 1; export const b = 2; //// [1.js] -export { a, b } from './0' assert { type: "json" }; -export * from './0' assert { type: "json" }; -export * as ns from './0' assert { type: "json" }; +export { a, b } from './0' with { type: "json" }; +export * from './0' with { type: "json" }; +export * as ns from './0' with { type: "json" }; //// [2.js] -export { a, b } from './0' assert {}; -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" }; +export { a, b } from './0' with {}; +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" }; //// [0.d.ts] diff --git a/tests/baselines/reference/importAssertion2(module=esnext).symbols b/tests/baselines/reference/importAssertion2(module=esnext).symbols index 6b6fb9a9370a5..9b073e389ea3a 100644 --- a/tests/baselines/reference/importAssertion2(module=esnext).symbols +++ b/tests/baselines/reference/importAssertion2(module=esnext).symbols @@ -8,21 +8,21 @@ export const b = 2; >b : Symbol(b, Decl(0.ts, 1, 12)) === 1.ts === -export {} from './0' assert { type: "json" } -export { a, b } from './0' assert { type: "json" } +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } >a : Symbol(a, Decl(1.ts, 1, 8)) >b : Symbol(b, Decl(1.ts, 1, 11)) -export * from './0' assert { type: "json" } -export * as ns from './0' assert { type: "json" } +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } >ns : Symbol(ns, Decl(1.ts, 3, 6)) === 2.ts === -export { a, b } from './0' assert {} +export { a, b } from './0' with {} >a : Symbol(a, Decl(2.ts, 0, 8)) >b : Symbol(b, Decl(2.ts, 0, 11)) -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : Symbol(a, Decl(0.ts, 0, 12)) >c : Symbol(c, Decl(2.ts, 1, 8)) >b : Symbol(b, Decl(0.ts, 1, 12)) diff --git a/tests/baselines/reference/importAssertion2(module=esnext).types b/tests/baselines/reference/importAssertion2(module=esnext).types index bd1dd630dcce5..8180ca39a9928 100644 --- a/tests/baselines/reference/importAssertion2(module=esnext).types +++ b/tests/baselines/reference/importAssertion2(module=esnext).types @@ -14,32 +14,32 @@ export const b = 2; > : ^ === 1.ts === -export {} from './0' assert { type: "json" } +export {} from './0' with { type: "json" } >type : error -export { a, b } from './0' assert { type: "json" } +export { a, b } from './0' with { type: "json" } >a : 1 > : ^ >b : 2 > : ^ >type : error -export * from './0' assert { type: "json" } +export * from './0' with { type: "json" } >type : error -export * as ns from './0' assert { type: "json" } +export * as ns from './0' with { type: "json" } >ns : typeof import("0") > : ^^^^^^^^^^^^^^^^^^ >type : error === 2.ts === -export { a, b } from './0' assert {} +export { a, b } from './0' with {} >a : 1 > : ^ >b : 2 > : ^ -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } >a : 1 > : ^ >c : 1 diff --git a/tests/baselines/reference/importAssertion3(module=es2015).errors.txt b/tests/baselines/reference/importAssertion3(module=es2015).errors.txt index 9ca5e660161ac..e1b1bba3d4679 100644 --- a/tests/baselines/reference/importAssertion3(module=es2015).errors.txt +++ b/tests/baselines/reference/importAssertion3(module=es2015).errors.txt @@ -1,26 +1,26 @@ -1.ts(1,27): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -1.ts(2,30): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -2.ts(1,31): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -2.ts(2,33): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(1,27): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +1.ts(2,30): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +2.ts(1,31): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +2.ts(2,33): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. ==== 0.ts (0 errors) ==== export interface I { } ==== 1.ts (2 errors) ==== - export type {} from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - export type { I } from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export type {} from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + export type { I } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. ==== 2.ts (2 errors) ==== - import type { I } from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - import type * as foo from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import type { I } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import type * as foo from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion3(module=es2015).js b/tests/baselines/reference/importAssertion3(module=es2015).js index 2044e3ed0500d..01234b6f15d63 100644 --- a/tests/baselines/reference/importAssertion3(module=es2015).js +++ b/tests/baselines/reference/importAssertion3(module=es2015).js @@ -4,12 +4,12 @@ export interface I { } //// [1.ts] -export type {} from './0' assert { type: "json" } -export type { I } from './0' assert { type: "json" } +export type {} from './0' with { type: "json" } +export type { I } from './0' with { type: "json" } //// [2.ts] -import type { I } from './0' assert { type: "json" } -import type * as foo from './0' assert { type: "json" } +import type { I } from './0' with { type: "json" } +import type * as foo from './0' with { type: "json" } diff --git a/tests/baselines/reference/importAssertion3(module=es2015).symbols b/tests/baselines/reference/importAssertion3(module=es2015).symbols index 0f25d9b4286fe..817bb8064744e 100644 --- a/tests/baselines/reference/importAssertion3(module=es2015).symbols +++ b/tests/baselines/reference/importAssertion3(module=es2015).symbols @@ -5,15 +5,15 @@ export interface I { } >I : Symbol(I, Decl(0.ts, 0, 0)) === 1.ts === -export type {} from './0' assert { type: "json" } -export type { I } from './0' assert { type: "json" } +export type {} from './0' with { type: "json" } +export type { I } from './0' with { type: "json" } >I : Symbol(I, Decl(1.ts, 1, 13)) === 2.ts === -import type { I } from './0' assert { type: "json" } +import type { I } from './0' with { type: "json" } >I : Symbol(I, Decl(2.ts, 0, 13)) -import type * as foo from './0' assert { type: "json" } +import type * as foo from './0' with { type: "json" } >foo : Symbol(foo, Decl(2.ts, 1, 11)) diff --git a/tests/baselines/reference/importAssertion3(module=es2015).types b/tests/baselines/reference/importAssertion3(module=es2015).types index 13ac48f7f566d..906c653680eb4 100644 --- a/tests/baselines/reference/importAssertion3(module=es2015).types +++ b/tests/baselines/reference/importAssertion3(module=es2015).types @@ -5,24 +5,24 @@ export interface I { } === 1.ts === -export type {} from './0' assert { type: "json" } +export type {} from './0' with { type: "json" } >type : any > : ^^^ -export type { I } from './0' assert { type: "json" } +export type { I } from './0' with { type: "json" } >I : import("0").I > : ^^^^^^^^^^^^^ >type : any > : ^^^ === 2.ts === -import type { I } from './0' assert { type: "json" } +import type { I } from './0' with { type: "json" } >I : I > : ^ >type : any > : ^^^ -import type * as foo from './0' assert { type: "json" } +import type * as foo from './0' with { type: "json" } >foo : typeof foo > : ^^^^^^^^^^ >type : any diff --git a/tests/baselines/reference/importAssertion3(module=esnext).errors.txt b/tests/baselines/reference/importAssertion3(module=esnext).errors.txt index 1d754165a3df6..2f05b5fbb90fe 100644 --- a/tests/baselines/reference/importAssertion3(module=esnext).errors.txt +++ b/tests/baselines/reference/importAssertion3(module=esnext).errors.txt @@ -1,26 +1,26 @@ -1.ts(1,27): error TS2822: Import assertions cannot be used with type-only imports or exports. -1.ts(2,30): error TS2822: Import assertions cannot be used with type-only imports or exports. -2.ts(1,31): error TS2822: Import assertions cannot be used with type-only imports or exports. -2.ts(2,33): error TS2822: Import assertions cannot be used with type-only imports or exports. +1.ts(1,27): error TS2857: Import attributes cannot be used with type-only imports or exports. +1.ts(2,30): error TS2857: Import attributes cannot be used with type-only imports or exports. +2.ts(1,31): error TS2857: Import attributes cannot be used with type-only imports or exports. +2.ts(2,33): error TS2857: Import attributes cannot be used with type-only imports or exports. ==== 0.ts (0 errors) ==== export interface I { } ==== 1.ts (2 errors) ==== - export type {} from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2822: Import assertions cannot be used with type-only imports or exports. - export type { I } from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2822: Import assertions cannot be used with type-only imports or exports. + export type {} from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2857: Import attributes cannot be used with type-only imports or exports. + export type { I } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2857: Import attributes cannot be used with type-only imports or exports. ==== 2.ts (2 errors) ==== - import type { I } from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2822: Import assertions cannot be used with type-only imports or exports. - import type * as foo from './0' assert { type: "json" } - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2822: Import assertions cannot be used with type-only imports or exports. + import type { I } from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2857: Import attributes cannot be used with type-only imports or exports. + import type * as foo from './0' with { type: "json" } + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2857: Import attributes cannot be used with type-only imports or exports. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion3(module=esnext).js b/tests/baselines/reference/importAssertion3(module=esnext).js index 2044e3ed0500d..01234b6f15d63 100644 --- a/tests/baselines/reference/importAssertion3(module=esnext).js +++ b/tests/baselines/reference/importAssertion3(module=esnext).js @@ -4,12 +4,12 @@ export interface I { } //// [1.ts] -export type {} from './0' assert { type: "json" } -export type { I } from './0' assert { type: "json" } +export type {} from './0' with { type: "json" } +export type { I } from './0' with { type: "json" } //// [2.ts] -import type { I } from './0' assert { type: "json" } -import type * as foo from './0' assert { type: "json" } +import type { I } from './0' with { type: "json" } +import type * as foo from './0' with { type: "json" } diff --git a/tests/baselines/reference/importAssertion3(module=esnext).symbols b/tests/baselines/reference/importAssertion3(module=esnext).symbols index 0f25d9b4286fe..817bb8064744e 100644 --- a/tests/baselines/reference/importAssertion3(module=esnext).symbols +++ b/tests/baselines/reference/importAssertion3(module=esnext).symbols @@ -5,15 +5,15 @@ export interface I { } >I : Symbol(I, Decl(0.ts, 0, 0)) === 1.ts === -export type {} from './0' assert { type: "json" } -export type { I } from './0' assert { type: "json" } +export type {} from './0' with { type: "json" } +export type { I } from './0' with { type: "json" } >I : Symbol(I, Decl(1.ts, 1, 13)) === 2.ts === -import type { I } from './0' assert { type: "json" } +import type { I } from './0' with { type: "json" } >I : Symbol(I, Decl(2.ts, 0, 13)) -import type * as foo from './0' assert { type: "json" } +import type * as foo from './0' with { type: "json" } >foo : Symbol(foo, Decl(2.ts, 1, 11)) diff --git a/tests/baselines/reference/importAssertion3(module=esnext).types b/tests/baselines/reference/importAssertion3(module=esnext).types index 13ac48f7f566d..906c653680eb4 100644 --- a/tests/baselines/reference/importAssertion3(module=esnext).types +++ b/tests/baselines/reference/importAssertion3(module=esnext).types @@ -5,24 +5,24 @@ export interface I { } === 1.ts === -export type {} from './0' assert { type: "json" } +export type {} from './0' with { type: "json" } >type : any > : ^^^ -export type { I } from './0' assert { type: "json" } +export type { I } from './0' with { type: "json" } >I : import("0").I > : ^^^^^^^^^^^^^ >type : any > : ^^^ === 2.ts === -import type { I } from './0' assert { type: "json" } +import type { I } from './0' with { type: "json" } >I : I > : ^ >type : any > : ^^^ -import type * as foo from './0' assert { type: "json" } +import type * as foo from './0' with { type: "json" } >foo : typeof foo > : ^^^^^^^^^^ >type : any diff --git a/tests/baselines/reference/importAssertion4.errors.txt b/tests/baselines/reference/importAssertion4.errors.txt index 276da4e5004de..c2e658063acb5 100644 --- a/tests/baselines/reference/importAssertion4.errors.txt +++ b/tests/baselines/reference/importAssertion4.errors.txt @@ -3,7 +3,7 @@ importAssertion4.ts(2,1): error TS1005: '{' expected. ==== importAssertion4.ts (2 errors) ==== - import * as f from "./first" assert + import * as f from "./first" with ~~~~~~~~~ !!! error TS2307: Cannot find module './first' or its corresponding type declarations. diff --git a/tests/baselines/reference/importAssertion4.js b/tests/baselines/reference/importAssertion4.js index 7384b6feaf876..87fda74e9c1e5 100644 --- a/tests/baselines/reference/importAssertion4.js +++ b/tests/baselines/reference/importAssertion4.js @@ -1,7 +1,7 @@ //// [tests/cases/conformance/importAssertion/importAssertion4.ts] //// //// [importAssertion4.ts] -import * as f from "./first" assert +import * as f from "./first" with //// [importAssertion4.js] diff --git a/tests/baselines/reference/importAssertion4.symbols b/tests/baselines/reference/importAssertion4.symbols index f178cf3e7781d..2d7072bd868d3 100644 --- a/tests/baselines/reference/importAssertion4.symbols +++ b/tests/baselines/reference/importAssertion4.symbols @@ -1,6 +1,6 @@ //// [tests/cases/conformance/importAssertion/importAssertion4.ts] //// === importAssertion4.ts === -import * as f from "./first" assert +import * as f from "./first" with >f : Symbol(f, Decl(importAssertion4.ts, 0, 6)) diff --git a/tests/baselines/reference/importAssertion4.types b/tests/baselines/reference/importAssertion4.types index 63da5b2055435..d6bc0814f4273 100644 --- a/tests/baselines/reference/importAssertion4.types +++ b/tests/baselines/reference/importAssertion4.types @@ -1,7 +1,7 @@ //// [tests/cases/conformance/importAssertion/importAssertion4.ts] //// === importAssertion4.ts === -import * as f from "./first" assert +import * as f from "./first" with >f : any > : ^^^ diff --git a/tests/baselines/reference/importAssertion5.errors.txt b/tests/baselines/reference/importAssertion5.errors.txt index 4d252f5e87b83..7544fab91c1bd 100644 --- a/tests/baselines/reference/importAssertion5.errors.txt +++ b/tests/baselines/reference/importAssertion5.errors.txt @@ -3,10 +3,10 @@ importAssertion5.ts(2,1): error TS1005: '}' expected. ==== importAssertion5.ts (2 errors) ==== - import * as f from "./first" assert { + import * as f from "./first" with { ~~~~~~~~~ !!! error TS2307: Cannot find module './first' or its corresponding type declarations. !!! error TS1005: '}' expected. -!!! related TS1007 importAssertion5.ts:1:37: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file +!!! related TS1007 importAssertion5.ts:1:35: The parser expected to find a '}' to match the '{' token here. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertion5.js b/tests/baselines/reference/importAssertion5.js index 553eb0030c032..9c3bd53d1ea08 100644 --- a/tests/baselines/reference/importAssertion5.js +++ b/tests/baselines/reference/importAssertion5.js @@ -1,7 +1,7 @@ //// [tests/cases/conformance/importAssertion/importAssertion5.ts] //// //// [importAssertion5.ts] -import * as f from "./first" assert { +import * as f from "./first" with { //// [importAssertion5.js] diff --git a/tests/baselines/reference/importAssertion5.symbols b/tests/baselines/reference/importAssertion5.symbols index c1994ea98fff1..df373df9eb522 100644 --- a/tests/baselines/reference/importAssertion5.symbols +++ b/tests/baselines/reference/importAssertion5.symbols @@ -1,6 +1,6 @@ //// [tests/cases/conformance/importAssertion/importAssertion5.ts] //// === importAssertion5.ts === -import * as f from "./first" assert { +import * as f from "./first" with { >f : Symbol(f, Decl(importAssertion5.ts, 0, 6)) diff --git a/tests/baselines/reference/importAssertion5.types b/tests/baselines/reference/importAssertion5.types index e65b4a083bcb4..eba320c792004 100644 --- a/tests/baselines/reference/importAssertion5.types +++ b/tests/baselines/reference/importAssertion5.types @@ -1,7 +1,7 @@ //// [tests/cases/conformance/importAssertion/importAssertion5.ts] //// === importAssertion5.ts === -import * as f from "./first" assert { +import * as f from "./first" with { >f : any > : ^^^ diff --git a/tests/baselines/reference/importAssertionNonstring.errors.txt b/tests/baselines/reference/importAssertionNonstring.errors.txt index a220b1f213eaa..07b37195a015a 100644 --- a/tests/baselines/reference/importAssertionNonstring.errors.txt +++ b/tests/baselines/reference/importAssertionNonstring.errors.txt @@ -1,78 +1,60 @@ -mod.mts(1,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. mod.mts(1,37): error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'number' is not assignable to type 'string'. -mod.mts(1,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(3,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -mod.mts(3,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(5,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +mod.mts(1,50): error TS2858: Import attribute values must be string literal expressions. +mod.mts(3,50): error TS2858: Import attribute values must be string literal expressions. mod.mts(5,37): error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'RegExp' is not assignable to type 'string'. -mod.mts(5,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(7,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +mod.mts(5,50): error TS2858: Import attribute values must be string literal expressions. mod.mts(7,37): error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type 'string[]' is not assignable to type 'string'. -mod.mts(7,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(9,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +mod.mts(7,50): error TS2858: Import attribute values must be string literal expressions. mod.mts(9,37): error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. Property 'field' is incompatible with index signature. Type '{ a: number; }' is not assignable to type 'string'. -mod.mts(9,52): error TS2837: Import assertion values must be string literal expressions. -mod.mts(11,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -mod.mts(11,66): error TS2837: Import assertion values must be string literal expressions. +mod.mts(9,50): error TS2858: Import attribute values must be string literal expressions. +mod.mts(11,64): error TS2858: Import attribute values must be string literal expressions. -==== mod.mts (16 errors) ==== - import * as thing1 from "./mod.mjs" assert {field: 0}; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~~~~~~~~~~~~~ +==== mod.mts (10 errors) ==== + import * as thing1 from "./mod.mjs" with {field: 0}; + ~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ field: 0; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'number' is not assignable to type 'string'. - ~ -!!! error TS2837: Import assertion values must be string literal expressions. + ~ +!!! error TS2858: Import attribute values must be string literal expressions. - import * as thing2 from "./mod.mjs" assert {field: `a`}; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~ -!!! error TS2837: Import assertion values must be string literal expressions. + import * as thing2 from "./mod.mjs" with {field: `a`}; + ~~~ +!!! error TS2858: Import attribute values must be string literal expressions. - import * as thing3 from "./mod.mjs" assert {field: /a/g}; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~~~~~~~~~~~~~~~~ + import * as thing3 from "./mod.mjs" with {field: /a/g}; + ~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ field: RegExp; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'RegExp' is not assignable to type 'string'. - ~~~~ -!!! error TS2837: Import assertion values must be string literal expressions. + ~~~~ +!!! error TS2858: Import attribute values must be string literal expressions. - import * as thing4 from "./mod.mjs" assert {field: ["a"]}; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~~~~~~~~~~~~~~~~~ + import * as thing4 from "./mod.mjs" with {field: ["a"]}; + ~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ field: string[]; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type 'string[]' is not assignable to type 'string'. - ~~~~~ -!!! error TS2837: Import assertion values must be string literal expressions. + ~~~~~ +!!! error TS2858: Import attribute values must be string literal expressions. - import * as thing5 from "./mod.mjs" assert {field: { a: 0 }}; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~~~~~~~~~~~~~~~~~~~~ + import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; + ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2322: Type '{ field: { a: number; }; }' is not assignable to type 'ImportAttributes'. !!! error TS2322: Property 'field' is incompatible with index signature. !!! error TS2322: Type '{ a: number; }' is not assignable to type 'string'. - ~~~~~~~~ -!!! error TS2837: Import assertion values must be string literal expressions. + ~~~~~~~~ +!!! error TS2858: Import attribute values must be string literal expressions. - import * as thing6 from "./mod.mjs" assert {type: "json", field: 0..toString()} - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~~~~~~~~~ -!!! error TS2837: Import assertion values must be string literal expressions. \ No newline at end of file + import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} + ~~~~~~~~~~~~~ +!!! error TS2858: Import attribute values must be string literal expressions. \ No newline at end of file diff --git a/tests/baselines/reference/importAssertionNonstring.js b/tests/baselines/reference/importAssertionNonstring.js index 5aa6284fc6d91..1e5665b1ab357 100644 --- a/tests/baselines/reference/importAssertionNonstring.js +++ b/tests/baselines/reference/importAssertionNonstring.js @@ -1,17 +1,17 @@ //// [tests/cases/compiler/importAssertionNonstring.ts] //// //// [mod.mts] -import * as thing1 from "./mod.mjs" assert {field: 0}; +import * as thing1 from "./mod.mjs" with {field: 0}; -import * as thing2 from "./mod.mjs" assert {field: `a`}; +import * as thing2 from "./mod.mjs" with {field: `a`}; -import * as thing3 from "./mod.mjs" assert {field: /a/g}; +import * as thing3 from "./mod.mjs" with {field: /a/g}; -import * as thing4 from "./mod.mjs" assert {field: ["a"]}; +import * as thing4 from "./mod.mjs" with {field: ["a"]}; -import * as thing5 from "./mod.mjs" assert {field: { a: 0 }}; +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; -import * as thing6 from "./mod.mjs" assert {type: "json", field: 0..toString()} +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} //// [mod.mjs] export {}; diff --git a/tests/baselines/reference/importAssertionNonstring.symbols b/tests/baselines/reference/importAssertionNonstring.symbols index 6fe1aa4cff016..8cbd1f497cffb 100644 --- a/tests/baselines/reference/importAssertionNonstring.symbols +++ b/tests/baselines/reference/importAssertionNonstring.symbols @@ -1,23 +1,23 @@ //// [tests/cases/compiler/importAssertionNonstring.ts] //// === mod.mts === -import * as thing1 from "./mod.mjs" assert {field: 0}; +import * as thing1 from "./mod.mjs" with {field: 0}; >thing1 : Symbol(thing1, Decl(mod.mts, 0, 6)) -import * as thing2 from "./mod.mjs" assert {field: `a`}; +import * as thing2 from "./mod.mjs" with {field: `a`}; >thing2 : Symbol(thing2, Decl(mod.mts, 2, 6)) -import * as thing3 from "./mod.mjs" assert {field: /a/g}; +import * as thing3 from "./mod.mjs" with {field: /a/g}; >thing3 : Symbol(thing3, Decl(mod.mts, 4, 6)) -import * as thing4 from "./mod.mjs" assert {field: ["a"]}; +import * as thing4 from "./mod.mjs" with {field: ["a"]}; >thing4 : Symbol(thing4, Decl(mod.mts, 6, 6)) -import * as thing5 from "./mod.mjs" assert {field: { a: 0 }}; +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; >thing5 : Symbol(thing5, Decl(mod.mts, 8, 6)) ->a : Symbol(a, Decl(mod.mts, 8, 52)) +>a : Symbol(a, Decl(mod.mts, 8, 50)) -import * as thing6 from "./mod.mjs" assert {type: "json", field: 0..toString()} +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} >thing6 : Symbol(thing6, Decl(mod.mts, 10, 6)) >0..toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) >toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) diff --git a/tests/baselines/reference/importAssertionNonstring.types b/tests/baselines/reference/importAssertionNonstring.types index 23f42c74e574a..e8bbd6233a08a 100644 --- a/tests/baselines/reference/importAssertionNonstring.types +++ b/tests/baselines/reference/importAssertionNonstring.types @@ -1,19 +1,19 @@ //// [tests/cases/compiler/importAssertionNonstring.ts] //// === mod.mts === -import * as thing1 from "./mod.mjs" assert {field: 0}; +import * as thing1 from "./mod.mjs" with {field: 0}; >thing1 : typeof thing1 > : ^^^^^^^^^^^^^ >field : any > : ^^^ -import * as thing2 from "./mod.mjs" assert {field: `a`}; +import * as thing2 from "./mod.mjs" with {field: `a`}; >thing2 : typeof thing1 > : ^^^^^^^^^^^^^ >field : any > : ^^^ -import * as thing3 from "./mod.mjs" assert {field: /a/g}; +import * as thing3 from "./mod.mjs" with {field: /a/g}; >thing3 : typeof thing1 > : ^^^^^^^^^^^^^ >field : any @@ -21,7 +21,7 @@ import * as thing3 from "./mod.mjs" assert {field: /a/g}; >/a/g : RegExp > : ^^^^^^ -import * as thing4 from "./mod.mjs" assert {field: ["a"]}; +import * as thing4 from "./mod.mjs" with {field: ["a"]}; >thing4 : typeof thing1 > : ^^^^^^^^^^^^^ >field : any @@ -31,7 +31,7 @@ import * as thing4 from "./mod.mjs" assert {field: ["a"]}; >"a" : "a" > : ^^^ -import * as thing5 from "./mod.mjs" assert {field: { a: 0 }}; +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; >thing5 : typeof thing1 > : ^^^^^^^^^^^^^ >field : any @@ -43,7 +43,7 @@ import * as thing5 from "./mod.mjs" assert {field: { a: 0 }}; >0 : 0 > : ^ -import * as thing6 from "./mod.mjs" assert {type: "json", field: 0..toString()} +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} >thing6 : typeof thing1 > : ^^^^^^^^^^^^^ >type : any diff --git a/tests/baselines/reference/importAssertionsDeprecated.errors.txt b/tests/baselines/reference/importAssertionsDeprecated.errors.txt new file mode 100644 index 0000000000000..7150d1f0b92f1 --- /dev/null +++ b/tests/baselines/reference/importAssertionsDeprecated.errors.txt @@ -0,0 +1,29 @@ +/a.ts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/b.ts(1,37): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/c.ts(1,51): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + +==== /a.ts (1 errors) ==== + import json from "./package.json" assert { type: "json" }; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + +==== /b.ts (1 errors) ==== + import * as data from "./data.json" assert { type: "json" }; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + +==== /c.ts (1 errors) ==== + export { default as config } from "./config.json" assert { type: "json" }; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + +==== /package.json (0 errors) ==== + {} + +==== /data.json (0 errors) ==== + {} + +==== /config.json (0 errors) ==== + {} + \ No newline at end of file diff --git a/tests/baselines/reference/importAssertionsDeprecated.js b/tests/baselines/reference/importAssertionsDeprecated.js new file mode 100644 index 0000000000000..6803afaf8fccb --- /dev/null +++ b/tests/baselines/reference/importAssertionsDeprecated.js @@ -0,0 +1,27 @@ +//// [tests/cases/compiler/importAssertionsDeprecated.ts] //// + +//// [a.ts] +import json from "./package.json" assert { type: "json" }; + +//// [b.ts] +import * as data from "./data.json" assert { type: "json" }; + +//// [c.ts] +export { default as config } from "./config.json" assert { type: "json" }; + +//// [package.json] +{} + +//// [data.json] +{} + +//// [config.json] +{} + + +//// [a.js] +export {}; +//// [b.js] +export {}; +//// [c.js] +export { default as config } from "./config.json" assert { type: "json" }; diff --git a/tests/baselines/reference/importAssertionsDeprecatedIgnored.js b/tests/baselines/reference/importAssertionsDeprecatedIgnored.js new file mode 100644 index 0000000000000..37b068224eb3c --- /dev/null +++ b/tests/baselines/reference/importAssertionsDeprecatedIgnored.js @@ -0,0 +1,28 @@ +//// [tests/cases/compiler/importAssertionsDeprecatedIgnored.ts] //// + +//// [a.ts] +// With ignoreDeprecations: "6.0", import assertions should not produce a deprecation error. +import json from "./package.json" assert { type: "json" }; + +//// [b.ts] +import * as data from "./data.json" assert { type: "json" }; + +//// [c.ts] +export { default as config } from "./config.json" assert { type: "json" }; + +//// [package.json] +{} + +//// [data.json] +{} + +//// [config.json] +{} + + +//// [a.js] +export {}; +//// [b.js] +export {}; +//// [c.js] +export { default as config } from "./config.json" assert { type: "json" }; diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt index fd0b3b9ea497a..349452d912702 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).errors.txt @@ -1,16 +1,16 @@ -index.ts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -otherc.cts(1,35): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +index.ts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +otherc.cts(1,35): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. ==== index.ts (1 errors) ==== - import json from "./package.json" assert { type: "json" }; - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import json from "./package.json" with { type: "json" }; + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. ==== otherc.cts (1 errors) ==== - import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine + import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + const json2 = import("./package.json", { with: { type: "json" } }); // should be fine ==== package.json (0 errors) ==== { "name": "pkg", diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).js b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).js index 091166d523cd1..aabf659267a9b 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).js @@ -1,10 +1,10 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// //// [index.ts] -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; //// [otherc.cts] -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine //// [package.json] { "name": "pkg", @@ -17,4 +17,4 @@ export {}; //// [otherc.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).symbols b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).symbols index 881cb771218da..6ecfd579757dc 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).symbols +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).symbols @@ -1,18 +1,18 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// === index.ts === -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; >json : Symbol(json, Decl(index.ts, 0, 6)) === otherc.cts === -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes >json : Symbol(json, Decl(otherc.cts, 0, 6)) -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine >json2 : Symbol(json2, Decl(otherc.cts, 1, 5)) >"./package.json" : Symbol("package", Decl(package.json, 0, 0)) ->assert : Symbol(assert, Decl(otherc.cts, 1, 40)) ->type : Symbol(type, Decl(otherc.cts, 1, 50)) +>with : Symbol(with, Decl(otherc.cts, 1, 40)) +>type : Symbol(type, Decl(otherc.cts, 1, 48)) === package.json === { diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).types b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).types index 9780c35bba0cc..e505bfd6108a3 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node16).types +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node16).types @@ -1,30 +1,30 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// === index.ts === -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; >json : { name: string; private: boolean; type: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ === otherc.cts === -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes >json : { name: string; private: boolean; type: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine >json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import("./package.json", { assert: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"./package.json" : "./package.json" > : ^^^^^^^^^^^^^^^^ ->{ assert: { type: "json" } } : { assert: { type: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; } -> : ^^^^^^^^^^^^^^^^^ +>{ with: { type: "json" } } : { with: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; } +> : ^^^^^^^^^^^^^^^^^ >{ type: "json" } : { type: string; } > : ^^^^^^^^^^^^^^^^^ >type : string diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt index b1d54f8e2145b..055ec052beab1 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).errors.txt @@ -1,13 +1,13 @@ -otherc.cts(1,35): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ==== index.ts (0 errors) ==== - import json from "./package.json" assert { type: "json" }; + import json from "./package.json" with { type: "json" }; ==== otherc.cts (1 errors) ==== - import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions - ~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine + import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + const json2 = import("./package.json", { with: { type: "json" } }); // should be fine ==== package.json (0 errors) ==== { "name": "pkg", diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js index 091166d523cd1..aabf659267a9b 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).js @@ -1,10 +1,10 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// //// [index.ts] -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; //// [otherc.cts] -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine //// [package.json] { "name": "pkg", @@ -17,4 +17,4 @@ export {}; //// [otherc.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).symbols b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).symbols index 881cb771218da..6ecfd579757dc 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).symbols @@ -1,18 +1,18 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// === index.ts === -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; >json : Symbol(json, Decl(index.ts, 0, 6)) === otherc.cts === -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes >json : Symbol(json, Decl(otherc.cts, 0, 6)) -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine >json2 : Symbol(json2, Decl(otherc.cts, 1, 5)) >"./package.json" : Symbol("package", Decl(package.json, 0, 0)) ->assert : Symbol(assert, Decl(otherc.cts, 1, 40)) ->type : Symbol(type, Decl(otherc.cts, 1, 50)) +>with : Symbol(with, Decl(otherc.cts, 1, 40)) +>type : Symbol(type, Decl(otherc.cts, 1, 48)) === package.json === { diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).types b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).types index 9780c35bba0cc..e505bfd6108a3 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node18).types @@ -1,30 +1,30 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// === index.ts === -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; >json : { name: string; private: boolean; type: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ === otherc.cts === -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes >json : { name: string; private: boolean; type: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine >json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import("./package.json", { assert: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"./package.json" : "./package.json" > : ^^^^^^^^^^^^^^^^ ->{ assert: { type: "json" } } : { assert: { type: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; } -> : ^^^^^^^^^^^^^^^^^ +>{ with: { type: "json" } } : { with: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; } +> : ^^^^^^^^^^^^^^^^^ >{ type: "json" } : { type: string; } > : ^^^^^^^^^^^^^^^^^ >type : string diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node20).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=node20).errors.txt index 1b09957ba0b0d..055ec052beab1 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node20).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node20).errors.txt @@ -1,16 +1,13 @@ -index.ts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -otherc.cts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -==== index.ts (1 errors) ==== - import json from "./package.json" assert { type: "json" }; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +==== index.ts (0 errors) ==== + import json from "./package.json" with { type: "json" }; ==== otherc.cts (1 errors) ==== - import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine + import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + const json2 = import("./package.json", { with: { type: "json" } }); // should be fine ==== package.json (0 errors) ==== { "name": "pkg", diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node20).js b/tests/baselines/reference/nodeModulesImportAssertions(module=node20).js index 091166d523cd1..aabf659267a9b 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node20).js +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node20).js @@ -1,10 +1,10 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// //// [index.ts] -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; //// [otherc.cts] -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine //// [package.json] { "name": "pkg", @@ -17,4 +17,4 @@ export {}; //// [otherc.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node20).symbols b/tests/baselines/reference/nodeModulesImportAssertions(module=node20).symbols index 881cb771218da..6ecfd579757dc 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node20).symbols +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node20).symbols @@ -1,18 +1,18 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// === index.ts === -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; >json : Symbol(json, Decl(index.ts, 0, 6)) === otherc.cts === -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes >json : Symbol(json, Decl(otherc.cts, 0, 6)) -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine >json2 : Symbol(json2, Decl(otherc.cts, 1, 5)) >"./package.json" : Symbol("package", Decl(package.json, 0, 0)) ->assert : Symbol(assert, Decl(otherc.cts, 1, 40)) ->type : Symbol(type, Decl(otherc.cts, 1, 50)) +>with : Symbol(with, Decl(otherc.cts, 1, 40)) +>type : Symbol(type, Decl(otherc.cts, 1, 48)) === package.json === { diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=node20).types b/tests/baselines/reference/nodeModulesImportAssertions(module=node20).types index 9780c35bba0cc..e505bfd6108a3 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=node20).types +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=node20).types @@ -1,30 +1,30 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// === index.ts === -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; >json : { name: string; private: boolean; type: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ === otherc.cts === -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes >json : { name: string; private: boolean; type: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine >json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import("./package.json", { assert: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"./package.json" : "./package.json" > : ^^^^^^^^^^^^^^^^ ->{ assert: { type: "json" } } : { assert: { type: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; } -> : ^^^^^^^^^^^^^^^^^ +>{ with: { type: "json" } } : { with: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; } +> : ^^^^^^^^^^^^^^^^^ >{ type: "json" } : { type: string; } > : ^^^^^^^^^^^^^^^^^ >type : string diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt index 1b09957ba0b0d..055ec052beab1 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).errors.txt @@ -1,16 +1,13 @@ -index.ts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -otherc.cts(1,35): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +otherc.cts(1,35): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. -==== index.ts (1 errors) ==== - import json from "./package.json" assert { type: "json" }; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +==== index.ts (0 errors) ==== + import json from "./package.json" with { type: "json" }; ==== otherc.cts (1 errors) ==== - import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine + import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + const json2 = import("./package.json", { with: { type: "json" } }); // should be fine ==== package.json (0 errors) ==== { "name": "pkg", diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).js b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).js index 091166d523cd1..aabf659267a9b 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).js @@ -1,10 +1,10 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// //// [index.ts] -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; //// [otherc.cts] -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine //// [package.json] { "name": "pkg", @@ -17,4 +17,4 @@ export {}; //// [otherc.cjs] "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).symbols index 881cb771218da..6ecfd579757dc 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).symbols +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).symbols @@ -1,18 +1,18 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// === index.ts === -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; >json : Symbol(json, Decl(index.ts, 0, 6)) === otherc.cts === -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes >json : Symbol(json, Decl(otherc.cts, 0, 6)) -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine >json2 : Symbol(json2, Decl(otherc.cts, 1, 5)) >"./package.json" : Symbol("package", Decl(package.json, 0, 0)) ->assert : Symbol(assert, Decl(otherc.cts, 1, 40)) ->type : Symbol(type, Decl(otherc.cts, 1, 50)) +>with : Symbol(with, Decl(otherc.cts, 1, 40)) +>type : Symbol(type, Decl(otherc.cts, 1, 48)) === package.json === { diff --git a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).types b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).types index 9780c35bba0cc..e505bfd6108a3 100644 --- a/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesImportAssertions(module=nodenext).types @@ -1,30 +1,30 @@ //// [tests/cases/conformance/node/nodeModulesImportAssertions.ts] //// === index.ts === -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; >json : { name: string; private: boolean; type: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ === otherc.cts === -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes >json : { name: string; private: boolean; type: string; } > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >type : any > : ^^^ -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine >json2 : Promise<{ default: { name: string; private: boolean; type: string; }; }> > : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->import("./package.json", { assert: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>import("./package.json", { with: { type: "json" } }) : Promise<{ default: { name: string; private: boolean; type: string; }; }> +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >"./package.json" : "./package.json" > : ^^^^^^^^^^^^^^^^ ->{ assert: { type: "json" } } : { assert: { type: string; }; } -> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ->assert : { type: string; } -> : ^^^^^^^^^^^^^^^^^ +>{ with: { type: "json" } } : { with: { type: string; }; } +> : ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +>with : { type: string; } +> : ^^^^^^^^^^^^^^^^^ >{ type: "json" } : { type: string; } > : ^^^^^^^^^^^^^^^^^ >type : string diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt index cb0de887d53dd..3e2efccd7764f 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).errors.txt @@ -1,26 +1,26 @@ -/index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +/index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. export interface Loc extends Req, Imp {} - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js index 1b8bc65976edc..c36f9f3cd756c 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).js @@ -14,17 +14,17 @@ export interface ImportInterface {} //// [require.d.ts] export interface RequireInterface {} //// [index.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; //// [index.js] @@ -33,13 +33,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp { } -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).symbols index 97a76656c4050..5f641176ba054 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).symbols @@ -1,33 +1,33 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 82)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} ->Loc : Symbol(Loc, Decl(index.ts, 6, 87)) +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) === /node_modules/pkg/import.d.ts === diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).types index 27ce52d60a048..c0c985fc64dc0 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node16).types @@ -1,23 +1,23 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any > : ^^^ -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ >Imp : any @@ -25,11 +25,11 @@ import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "imp export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt index e77140972a1ce..bf4698ad28e95 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).errors.txt @@ -1,26 +1,26 @@ -/index.ts(6,50): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export interface Loc extends Req, Imp {} - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).js index 1b8bc65976edc..c36f9f3cd756c 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).js @@ -14,17 +14,17 @@ export interface ImportInterface {} //// [require.d.ts] export interface RequireInterface {} //// [index.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; //// [index.js] @@ -33,13 +33,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp { } -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols index 97a76656c4050..5f641176ba054 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).symbols @@ -1,33 +1,33 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 82)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} ->Loc : Symbol(Loc, Decl(index.ts, 6, 87)) +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) === /node_modules/pkg/import.d.ts === diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types index 27ce52d60a048..c0c985fc64dc0 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node18).types @@ -1,23 +1,23 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any > : ^^^ -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ >Imp : any @@ -25,11 +25,11 @@ import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "imp export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt index d2c0a64f66744..bf4698ad28e95 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).errors.txt @@ -1,26 +1,26 @@ -/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export interface Loc extends Req, Imp {} - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).js index 1b8bc65976edc..c36f9f3cd756c 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).js @@ -14,17 +14,17 @@ export interface ImportInterface {} //// [require.d.ts] export interface RequireInterface {} //// [index.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; //// [index.js] @@ -33,13 +33,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp { } -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).symbols index 97a76656c4050..5f641176ba054 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).symbols @@ -1,33 +1,33 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 82)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} ->Loc : Symbol(Loc, Decl(index.ts, 6, 87)) +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) === /node_modules/pkg/import.d.ts === diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).types index 27ce52d60a048..c0c985fc64dc0 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=node20).types @@ -1,23 +1,23 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any > : ^^^ -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ >Imp : any @@ -25,11 +25,11 @@ import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "imp export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt index d2c0a64f66744..bf4698ad28e95 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).errors.txt @@ -1,26 +1,26 @@ -/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. /index.ts(7,14): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(7,49): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export interface Loc extends Req, Imp {} - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js index 1b8bc65976edc..c36f9f3cd756c 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).js @@ -14,17 +14,17 @@ export interface ImportInterface {} //// [require.d.ts] export interface RequireInterface {} //// [index.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; //// [index.js] @@ -33,13 +33,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp { } -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).symbols index 97a76656c4050..5f641176ba054 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).symbols @@ -1,33 +1,33 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 82)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} ->Loc : Symbol(Loc, Decl(index.ts, 6, 87)) +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) === /node_modules/pkg/import.d.ts === diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).types index 27ce52d60a048..c0c985fc64dc0 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit1(module=nodenext).types @@ -1,23 +1,23 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any > : ^^^ -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ >Imp : any @@ -25,11 +25,11 @@ import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "imp export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt index c07a16f9e9aa5..374290f2fe1fc 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).errors.txt @@ -1,26 +1,26 @@ /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -/index.ts(7,49): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +/index.ts(6,50): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +/index.ts(7,49): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. export interface Loc extends Req, Imp {} - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js index fad19d466a6ac..f8733e4906188 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).js @@ -19,17 +19,17 @@ export interface RequireInterface {} "type": "module" } //// [index.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; //// [index.js] @@ -37,13 +37,13 @@ export {}; //// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp { } -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).symbols index 8d280aee6ffa1..6ac0a278ced6b 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).symbols @@ -1,33 +1,33 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 82)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >Req : Symbol(Req, Decl(index.ts, 5, 8)) -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} ->Loc : Symbol(Loc, Decl(index.ts, 6, 87)) +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) === /node_modules/pkg/import.d.ts === diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).types index 60e006fe4390a..03adc09cf6977 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node16).types @@ -1,23 +1,23 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any > : ^^^ -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ >Imp : any @@ -25,11 +25,11 @@ import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "imp export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt index 47c2ad040c0db..5c93150f88f13 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).errors.txt @@ -4,23 +4,23 @@ ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1454: `resolution-mode` can only be set for type-only imports. export interface Loc extends Req, Imp {} - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js index fad19d466a6ac..f8733e4906188 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).js @@ -19,17 +19,17 @@ export interface RequireInterface {} "type": "module" } //// [index.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; //// [index.js] @@ -37,13 +37,13 @@ export {}; //// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp { } -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols index 8d280aee6ffa1..6ac0a278ced6b 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).symbols @@ -1,33 +1,33 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 82)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >Req : Symbol(Req, Decl(index.ts, 5, 8)) -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} ->Loc : Symbol(Loc, Decl(index.ts, 6, 87)) +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) === /node_modules/pkg/import.d.ts === diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types index 60e006fe4390a..03adc09cf6977 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node18).types @@ -1,23 +1,23 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any > : ^^^ -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ >Imp : any @@ -25,11 +25,11 @@ import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "imp export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt index 77b7ff5cd3914..5c93150f88f13 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).errors.txt @@ -1,26 +1,26 @@ /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. export interface Loc extends Req, Imp {} - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).js index fad19d466a6ac..f8733e4906188 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).js @@ -19,17 +19,17 @@ export interface RequireInterface {} "type": "module" } //// [index.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; //// [index.js] @@ -37,13 +37,13 @@ export {}; //// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp { } -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).symbols index 8d280aee6ffa1..6ac0a278ced6b 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).symbols @@ -1,33 +1,33 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 82)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >Req : Symbol(Req, Decl(index.ts, 5, 8)) -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} ->Loc : Symbol(Loc, Decl(index.ts, 6, 87)) +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) === /node_modules/pkg/import.d.ts === diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).types index 60e006fe4390a..03adc09cf6977 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=node20).types @@ -1,23 +1,23 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any > : ^^^ -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ >Imp : any @@ -25,11 +25,11 @@ import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "imp export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt index 77b7ff5cd3914..5c93150f88f13 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).errors.txt @@ -1,26 +1,26 @@ /index.ts(6,14): error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. -/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -/index.ts(7,49): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS1454: `resolution-mode` can only be set for type-only imports. +/index.ts(7,49): error TS1454: `resolution-mode` can only be set for type-only imports. ==== /index.ts (3 errors) ==== - import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} - import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; + import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; ~~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'RequireInterface'. - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. + import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS1454: `resolution-mode` can only be set for type-only imports. export interface Loc extends Req, Imp {} - export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; - export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; + export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ==== /node_modules/pkg/package.json (0 errors) ==== { diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js index fad19d466a6ac..f8733e4906188 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).js @@ -19,17 +19,17 @@ export interface RequireInterface {} "type": "module" } //// [index.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; //// [index.js] @@ -37,13 +37,13 @@ export {}; //// [index.d.ts] -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } -import { type RequireInterface as Req } from "pkg" assert { "resolution-mode": "require" }; -import { type ImportInterface as Imp } from "pkg" assert { "resolution-mode": "import" }; +import { type RequireInterface as Req } from "pkg" with { "resolution-mode": "require" }; +import { type ImportInterface as Imp } from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp { } -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).symbols index 8d280aee6ffa1..6ac0a278ced6b 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).symbols @@ -1,33 +1,33 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 82)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 1, 80)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 0, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 1, 13)) -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >Req : Symbol(Req, Decl(index.ts, 5, 8)) -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(import.d.ts, 0, 0)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) export interface Loc extends Req, Imp {} ->Loc : Symbol(Loc, Decl(index.ts, 6, 87)) +>Loc : Symbol(Loc, Decl(index.ts, 6, 85)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >Imp : Symbol(Imp, Decl(index.ts, 6, 8)) -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 9, 13)) -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 10, 13)) === /node_modules/pkg/import.d.ts === diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).types index 60e006fe4390a..03adc09cf6977 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmit2(module=nodenext).types @@ -1,23 +1,23 @@ //// [tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts] //// === /index.ts === -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any > : ^^^ -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ >Imp : any @@ -25,11 +25,11 @@ import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "imp export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : ImportInterface > : ^^^^^^^^^^^^^^^ diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt index 01bef5234cff9..9a813ef6db3fa 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).errors.txt @@ -1,27 +1,27 @@ -/index.ts(2,45): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -/index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(2,45): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +/index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. -/index.ts(6,76): error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +/index.ts(4,39): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. +/index.ts(6,76): error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. ==== /index.ts (5 errors) ==== // incorrect mode - import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. - ~~~~~~~~ + import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only - import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. // not exclusively type-only - import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2821: Import assertions are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. + import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2823: Import attributes are only supported when the '--module' option is set to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js index 3b2af2656d08b..2f14482b2747a 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).js @@ -15,11 +15,11 @@ export interface ImportInterface {} export interface RequireInterface {} //// [index.ts] // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -34,6 +34,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [index.d.ts] import type { RequireInterface } from "pkg"; -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).symbols index b209c65c177c1..62130484fe9c2 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).symbols @@ -2,22 +2,22 @@ === /index.ts === // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req2 : Symbol(Req2, Decl(index.ts, 5, 37)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 115)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 113)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).types index b9bc7c1552479..b8a825c53c49e 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node16).types @@ -2,17 +2,17 @@ === /index.ts === // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt index e1be07261876a..c45ca1322b3a8 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).errors.txt @@ -1,27 +1,27 @@ -/index.ts(2,45): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. -/index.ts(6,76): error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(4,39): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (5 errors) ==== // incorrect mode - import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. - ~~~~~~~~ + import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only - import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. // not exclusively type-only - import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2836: Import assertions are not allowed on statements that compile to CommonJS 'require' calls. + import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).js index 3b2af2656d08b..2f14482b2747a 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).js @@ -15,11 +15,11 @@ export interface ImportInterface {} export interface RequireInterface {} //// [index.ts] // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -34,6 +34,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [index.d.ts] import type { RequireInterface } from "pkg"; -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols index b209c65c177c1..62130484fe9c2 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).symbols @@ -2,22 +2,22 @@ === /index.ts === // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req2 : Symbol(Req2, Decl(index.ts, 5, 37)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 115)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 113)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types index b9bc7c1552479..b8a825c53c49e 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node18).types @@ -2,17 +2,17 @@ === /index.ts === // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt index 11d577b0ea7d6..c45ca1322b3a8 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).errors.txt @@ -1,27 +1,27 @@ -/index.ts(2,45): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -/index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -/index.ts(6,76): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(4,39): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (5 errors) ==== // incorrect mode - import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~~~~ + import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only - import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. // not exclusively type-only - import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).js index 3b2af2656d08b..2f14482b2747a 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).js @@ -15,11 +15,11 @@ export interface ImportInterface {} export interface RequireInterface {} //// [index.ts] // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -34,6 +34,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [index.d.ts] import type { RequireInterface } from "pkg"; -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).symbols index b209c65c177c1..62130484fe9c2 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).symbols @@ -2,22 +2,22 @@ === /index.ts === // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req2 : Symbol(Req2, Decl(index.ts, 5, 37)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 115)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 113)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).types index b9bc7c1552479..b8a825c53c49e 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=node20).types @@ -2,17 +2,17 @@ === /index.ts === // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt index 11d577b0ea7d6..c45ca1322b3a8 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -1,27 +1,27 @@ -/index.ts(2,45): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -/index.ts(2,73): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(2,45): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(2,71): error TS1453: `resolution-mode` should be either `require` or `import`. /index.ts(4,10): error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. -/index.ts(4,39): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -/index.ts(6,76): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(4,39): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. +/index.ts(6,76): error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. ==== /index.ts (5 errors) ==== // incorrect mode - import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~~~~ + import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. + ~~~~~~~~ !!! error TS1453: `resolution-mode` should be either `require` or `import`. // not type-only - import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; + import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; ~~~~~~~~~~~~~~~ !!! error TS2305: Module '"pkg"' has no exported member 'ImportInterface'. - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. // not exclusively type-only - import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; - ~~~~~~ -!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2856: Import attributes are not allowed on statements that compile to CommonJS 'require' calls. export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js index 3b2af2656d08b..2f14482b2747a 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).js @@ -15,11 +15,11 @@ export interface ImportInterface {} export interface RequireInterface {} //// [index.ts] // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; export interface LocalInterface extends RequireInterface, ImportInterface {} @@ -34,6 +34,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); //// [index.d.ts] import type { RequireInterface } from "pkg"; -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface { } diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).symbols b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).symbols index b209c65c177c1..62130484fe9c2 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).symbols +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).symbols @@ -2,22 +2,22 @@ === /index.ts === // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req : Symbol(Req, Decl(index.ts, 5, 8)) >RequireInterface : Symbol(RequireInterface, Decl(require.d.ts, 0, 0)) >Req2 : Symbol(Req2, Decl(index.ts, 5, 37)) export interface LocalInterface extends RequireInterface, ImportInterface {} ->LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 115)) +>LocalInterface : Symbol(LocalInterface, Decl(index.ts, 5, 113)) >RequireInterface : Symbol(RequireInterface, Decl(index.ts, 1, 13)) >ImportInterface : Symbol(ImportInterface, Decl(index.ts, 3, 8)) diff --git a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).types b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).types index b9bc7c1552479..b8a825c53c49e 100644 --- a/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).types +++ b/tests/baselines/reference/nodeModulesImportModeDeclarationEmitErrors1(module=nodenext).types @@ -2,17 +2,17 @@ === /index.ts === // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; >RequireInterface : RequireInterface > : ^^^^^^^^^^^^^^^^ // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; >ImportInterface : any > : ^^^ // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; >RequireInterface : any > : ^^^ >Req : any diff --git a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).js b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).js index 961512bfab79f..7521cbe1c791f 100644 --- a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).js +++ b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).js @@ -20,15 +20,15 @@ export declare const x: "script"; //// [app.ts] import type { x as Default } from "foo"; -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +import type { x as Import } from "foo" with { "resolution-mode": "import" }; +import type { x as Require } from "foo" with { "resolution-mode": "require" }; type _Default = typeof Default; type _Import = typeof Import; type _Require = typeof Require; // resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +import type { x as ImportRelative } from "./other" with { "resolution-mode": "import" }; +import type { x as RequireRelative } from "./other" with { "resolution-mode": "require" }; type _ImportRelative = typeof ImportRelative; type _RequireRelative = typeof RequireRelative; @@ -50,13 +50,13 @@ export const x = "other"; export declare const x = "other"; //// [app.d.ts] import type { x as Default } from "foo"; -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +import type { x as Import } from "foo" with { "resolution-mode": "import" }; +import type { x as Require } from "foo" with { "resolution-mode": "require" }; type _Default = typeof Default; type _Import = typeof Import; type _Require = typeof Require; -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +import type { x as ImportRelative } from "./other" with { "resolution-mode": "import" }; +import type { x as RequireRelative } from "./other" with { "resolution-mode": "require" }; type _ImportRelative = typeof ImportRelative; type _RequireRelative = typeof RequireRelative; export { _Default, _Import, _Require, _ImportRelative, _RequireRelative }; diff --git a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).symbols b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).symbols index 1d28242ebf843..9f7f9cabf1c65 100644 --- a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).symbols +++ b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).symbols @@ -13,16 +13,16 @@ import type { x as Default } from "foo"; >x : Symbol(Default, Decl(index.d.mts, 0, 20)) >Default : Symbol(Default, Decl(app.ts, 0, 13)) -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; +import type { x as Import } from "foo" with { "resolution-mode": "import" }; >x : Symbol(Default, Decl(index.d.mts, 0, 20)) >Import : Symbol(Import, Decl(app.ts, 1, 13)) -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +import type { x as Require } from "foo" with { "resolution-mode": "require" }; >x : Symbol(Require, Decl(index.d.cts, 0, 20)) >Require : Symbol(Require, Decl(app.ts, 2, 13)) type _Default = typeof Default; ->_Default : Symbol(_Default, Decl(app.ts, 2, 80)) +>_Default : Symbol(_Default, Decl(app.ts, 2, 78)) >Default : Symbol(Default, Decl(app.ts, 0, 13)) type _Import = typeof Import; @@ -34,16 +34,16 @@ type _Require = typeof Require; >Require : Symbol(Require, Decl(app.ts, 2, 13)) // resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; +import type { x as ImportRelative } from "./other" with { "resolution-mode": "import" }; >x : Symbol(ImportRelative, Decl(other.ts, 0, 12)) >ImportRelative : Symbol(ImportRelative, Decl(app.ts, 8, 13)) -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +import type { x as RequireRelative } from "./other" with { "resolution-mode": "require" }; >x : Symbol(ImportRelative, Decl(other.ts, 0, 12)) >RequireRelative : Symbol(RequireRelative, Decl(app.ts, 9, 13)) type _ImportRelative = typeof ImportRelative; ->_ImportRelative : Symbol(_ImportRelative, Decl(app.ts, 9, 92)) +>_ImportRelative : Symbol(_ImportRelative, Decl(app.ts, 9, 90)) >ImportRelative : Symbol(ImportRelative, Decl(app.ts, 8, 13)) type _RequireRelative = typeof RequireRelative; diff --git a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).types b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).types index 014ff21824252..ab37f21407f5d 100644 --- a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).types +++ b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=bundler).types @@ -17,13 +17,13 @@ import type { x as Default } from "foo"; >Default : any > : ^^^ -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; +import type { x as Import } from "foo" with { "resolution-mode": "import" }; >x : "module" > : ^^^^^^^^ >Import : any > : ^^^ -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +import type { x as Require } from "foo" with { "resolution-mode": "require" }; >x : "script" > : ^^^^^^^^ >Require : any @@ -48,13 +48,13 @@ type _Require = typeof Require; > : ^^^^^^^^ // resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; +import type { x as ImportRelative } from "./other" with { "resolution-mode": "import" }; >x : "other" > : ^^^^^^^ >ImportRelative : any > : ^^^ -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +import type { x as RequireRelative } from "./other" with { "resolution-mode": "require" }; >x : "other" > : ^^^^^^^ >RequireRelative : any diff --git a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).errors.txt b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).errors.txt index a5ade620990a9..d32ba51e9ae55 100644 --- a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).errors.txt +++ b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).errors.txt @@ -33,10 +33,10 @@ error TS5107: Option 'moduleResolution=classic' is deprecated and will stop func import type { x as Default } from "foo"; ~~~~~ !!! error TS2792: Cannot find module 'foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - import type { x as Import } from "foo" assert { "resolution-mode": "import" }; + import type { x as Import } from "foo" with { "resolution-mode": "import" }; ~~~~~ !!! error TS2792: Cannot find module 'foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? - import type { x as Require } from "foo" assert { "resolution-mode": "require" }; + import type { x as Require } from "foo" with { "resolution-mode": "require" }; ~~~~~ !!! error TS2792: Cannot find module 'foo'. Did you mean to set the 'moduleResolution' option to 'nodenext', or to add aliases to the 'paths' option? type _Default = typeof Default; @@ -44,8 +44,8 @@ error TS5107: Option 'moduleResolution=classic' is deprecated and will stop func type _Require = typeof Require; // resolution-mode does not enforce file extension in `bundler`, just sets conditions - import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; - import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; + import type { x as ImportRelative } from "./other" with { "resolution-mode": "import" }; + import type { x as RequireRelative } from "./other" with { "resolution-mode": "require" }; type _ImportRelative = typeof ImportRelative; type _RequireRelative = typeof RequireRelative; diff --git a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).js b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).js index 961512bfab79f..7521cbe1c791f 100644 --- a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).js +++ b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).js @@ -20,15 +20,15 @@ export declare const x: "script"; //// [app.ts] import type { x as Default } from "foo"; -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +import type { x as Import } from "foo" with { "resolution-mode": "import" }; +import type { x as Require } from "foo" with { "resolution-mode": "require" }; type _Default = typeof Default; type _Import = typeof Import; type _Require = typeof Require; // resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +import type { x as ImportRelative } from "./other" with { "resolution-mode": "import" }; +import type { x as RequireRelative } from "./other" with { "resolution-mode": "require" }; type _ImportRelative = typeof ImportRelative; type _RequireRelative = typeof RequireRelative; @@ -50,13 +50,13 @@ export const x = "other"; export declare const x = "other"; //// [app.d.ts] import type { x as Default } from "foo"; -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +import type { x as Import } from "foo" with { "resolution-mode": "import" }; +import type { x as Require } from "foo" with { "resolution-mode": "require" }; type _Default = typeof Default; type _Import = typeof Import; type _Require = typeof Require; -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +import type { x as ImportRelative } from "./other" with { "resolution-mode": "import" }; +import type { x as RequireRelative } from "./other" with { "resolution-mode": "require" }; type _ImportRelative = typeof ImportRelative; type _RequireRelative = typeof RequireRelative; export { _Default, _Import, _Require, _ImportRelative, _RequireRelative }; diff --git a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).symbols b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).symbols index a9c303545a796..77429d8486708 100644 --- a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).symbols +++ b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).symbols @@ -12,14 +12,14 @@ export declare const x: "script"; import type { x as Default } from "foo"; >Default : Symbol(Default, Decl(app.ts, 0, 13)) -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; +import type { x as Import } from "foo" with { "resolution-mode": "import" }; >Import : Symbol(Import, Decl(app.ts, 1, 13)) -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +import type { x as Require } from "foo" with { "resolution-mode": "require" }; >Require : Symbol(Require, Decl(app.ts, 2, 13)) type _Default = typeof Default; ->_Default : Symbol(_Default, Decl(app.ts, 2, 80)) +>_Default : Symbol(_Default, Decl(app.ts, 2, 78)) >Default : Symbol(Default, Decl(app.ts, 0, 13)) type _Import = typeof Import; @@ -31,16 +31,16 @@ type _Require = typeof Require; >Require : Symbol(Require, Decl(app.ts, 2, 13)) // resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; +import type { x as ImportRelative } from "./other" with { "resolution-mode": "import" }; >x : Symbol(ImportRelative, Decl(other.ts, 0, 12)) >ImportRelative : Symbol(ImportRelative, Decl(app.ts, 8, 13)) -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +import type { x as RequireRelative } from "./other" with { "resolution-mode": "require" }; >x : Symbol(ImportRelative, Decl(other.ts, 0, 12)) >RequireRelative : Symbol(RequireRelative, Decl(app.ts, 9, 13)) type _ImportRelative = typeof ImportRelative; ->_ImportRelative : Symbol(_ImportRelative, Decl(app.ts, 9, 92)) +>_ImportRelative : Symbol(_ImportRelative, Decl(app.ts, 9, 90)) >ImportRelative : Symbol(ImportRelative, Decl(app.ts, 8, 13)) type _RequireRelative = typeof RequireRelative; diff --git a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).types b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).types index 1480d5b8ee051..58093995059a7 100644 --- a/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).types +++ b/tests/baselines/reference/resolutionModeTypeOnlyImport1(moduleresolution=classic).types @@ -17,13 +17,13 @@ import type { x as Default } from "foo"; >Default : any > : ^^^ -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; +import type { x as Import } from "foo" with { "resolution-mode": "import" }; >x : any > : ^^^ >Import : any > : ^^^ -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +import type { x as Require } from "foo" with { "resolution-mode": "require" }; >x : any > : ^^^ >Require : any @@ -48,13 +48,13 @@ type _Require = typeof Require; > : ^^^ // resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; +import type { x as ImportRelative } from "./other" with { "resolution-mode": "import" }; >x : "other" > : ^^^^^^^ >ImportRelative : any > : ^^^ -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +import type { x as RequireRelative } from "./other" with { "resolution-mode": "require" }; >x : "other" > : ^^^^^^^ >RequireRelative : any diff --git a/tests/cases/compiler/importAssertionNonstring.ts b/tests/cases/compiler/importAssertionNonstring.ts index 901ba80e22359..8904a5a68e6c9 100644 --- a/tests/cases/compiler/importAssertionNonstring.ts +++ b/tests/cases/compiler/importAssertionNonstring.ts @@ -1,14 +1,14 @@ // @target: es2015 // @module: nodenext // @filename: mod.mts -import * as thing1 from "./mod.mjs" assert {field: 0}; +import * as thing1 from "./mod.mjs" with {field: 0}; -import * as thing2 from "./mod.mjs" assert {field: `a`}; +import * as thing2 from "./mod.mjs" with {field: `a`}; -import * as thing3 from "./mod.mjs" assert {field: /a/g}; +import * as thing3 from "./mod.mjs" with {field: /a/g}; -import * as thing4 from "./mod.mjs" assert {field: ["a"]}; +import * as thing4 from "./mod.mjs" with {field: ["a"]}; -import * as thing5 from "./mod.mjs" assert {field: { a: 0 }}; +import * as thing5 from "./mod.mjs" with {field: { a: 0 }}; -import * as thing6 from "./mod.mjs" assert {type: "json", field: 0..toString()} \ No newline at end of file +import * as thing6 from "./mod.mjs" with {type: "json", field: 0..toString()} \ No newline at end of file diff --git a/tests/cases/compiler/importAssertionsDeprecated.ts b/tests/cases/compiler/importAssertionsDeprecated.ts new file mode 100644 index 0000000000000..cc16c0f2b0d60 --- /dev/null +++ b/tests/cases/compiler/importAssertionsDeprecated.ts @@ -0,0 +1,21 @@ +// @target: esnext +// @module: esnext +// @noTypesAndSymbols: true + +// @Filename: /a.ts +import json from "./package.json" assert { type: "json" }; + +// @Filename: /b.ts +import * as data from "./data.json" assert { type: "json" }; + +// @Filename: /c.ts +export { default as config } from "./config.json" assert { type: "json" }; + +// @Filename: /package.json +{} + +// @Filename: /data.json +{} + +// @Filename: /config.json +{} diff --git a/tests/cases/compiler/importAssertionsDeprecatedIgnored.ts b/tests/cases/compiler/importAssertionsDeprecatedIgnored.ts new file mode 100644 index 0000000000000..121dbf2d74603 --- /dev/null +++ b/tests/cases/compiler/importAssertionsDeprecatedIgnored.ts @@ -0,0 +1,23 @@ +// @target: esnext +// @module: esnext +// @ignoreDeprecations: 6.0 +// @noTypesAndSymbols: true + +// @Filename: /a.ts +// With ignoreDeprecations: "6.0", import assertions should not produce a deprecation error. +import json from "./package.json" assert { type: "json" }; + +// @Filename: /b.ts +import * as data from "./data.json" assert { type: "json" }; + +// @Filename: /c.ts +export { default as config } from "./config.json" assert { type: "json" }; + +// @Filename: /package.json +{} + +// @Filename: /data.json +{} + +// @Filename: /config.json +{} diff --git a/tests/cases/conformance/importAssertion/importAssertion1.ts b/tests/cases/conformance/importAssertion/importAssertion1.ts index b547158cf14cc..9bdfd335df526 100644 --- a/tests/cases/conformance/importAssertion/importAssertion1.ts +++ b/tests/cases/conformance/importAssertion/importAssertion1.ts @@ -7,17 +7,17 @@ export const a = 1; export const b = 2; // @filename: 1.ts -import './0' assert { type: "json" } -import { a, b } from './0' assert { "type": "json" } -import * as foo from './0' assert { type: "json" } +import './0' with { type: "json" } +import { a, b } from './0' with { "type": "json" } +import * as foo from './0' with { type: "json" } a; b; foo.a; foo.b; // @filename: 2.ts -import { a, b } from './0' assert {} -import { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +import { a, b } from './0' with {} +import { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } a; b; c; @@ -25,13 +25,13 @@ d; // @filename: 3.ts const a = import('./0') -const b = import('./0', { assert: { type: "json" } }) -const c = import('./0', { assert: { type: "json", ttype: "typo" } }) -const d = import('./0', { assert: {} }) +const b = import('./0', { with: { type: "json" } }) +const c = import('./0', { with: { type: "json", ttype: "typo" } }) +const d = import('./0', { with: {} }) const dd = import('./0', {}) declare function foo(): any; const e = import('./0', foo()) const f = import() const g = import('./0', {}, {}) -const h = import('./0', { assert: { type: "json" }},) +const h = import('./0', { with: { type: "json" }},) diff --git a/tests/cases/conformance/importAssertion/importAssertion2.ts b/tests/cases/conformance/importAssertion/importAssertion2.ts index 42a26af43eb7c..89af9980758a2 100644 --- a/tests/cases/conformance/importAssertion/importAssertion2.ts +++ b/tests/cases/conformance/importAssertion/importAssertion2.ts @@ -7,11 +7,11 @@ export const a = 1; export const b = 2; // @filename: 1.ts -export {} from './0' assert { type: "json" } -export { a, b } from './0' assert { type: "json" } -export * from './0' assert { type: "json" } -export * as ns from './0' assert { type: "json" } +export {} from './0' with { type: "json" } +export { a, b } from './0' with { type: "json" } +export * from './0' with { type: "json" } +export * as ns from './0' with { type: "json" } // @filename: 2.ts -export { a, b } from './0' assert {} -export { a as c, b as d } from './0' assert { a: "a", b: "b", c: "c" } +export { a, b } from './0' with {} +export { a as c, b as d } from './0' with { a: "a", b: "b", c: "c" } diff --git a/tests/cases/conformance/importAssertion/importAssertion3.ts b/tests/cases/conformance/importAssertion/importAssertion3.ts index 28479378b162d..d3c669f8e642a 100644 --- a/tests/cases/conformance/importAssertion/importAssertion3.ts +++ b/tests/cases/conformance/importAssertion/importAssertion3.ts @@ -6,10 +6,10 @@ export interface I { } // @filename: 1.ts -export type {} from './0' assert { type: "json" } -export type { I } from './0' assert { type: "json" } +export type {} from './0' with { type: "json" } +export type { I } from './0' with { type: "json" } // @filename: 2.ts -import type { I } from './0' assert { type: "json" } -import type * as foo from './0' assert { type: "json" } +import type { I } from './0' with { type: "json" } +import type * as foo from './0' with { type: "json" } diff --git a/tests/cases/conformance/importAssertion/importAssertion4.ts b/tests/cases/conformance/importAssertion/importAssertion4.ts index 7f5b209a8f9e8..9cd9455e6d312 100644 --- a/tests/cases/conformance/importAssertion/importAssertion4.ts +++ b/tests/cases/conformance/importAssertion/importAssertion4.ts @@ -1,3 +1,3 @@ // @module: commonjs // @target: es2015 -import * as f from "./first" assert +import * as f from "./first" with diff --git a/tests/cases/conformance/importAssertion/importAssertion5.ts b/tests/cases/conformance/importAssertion/importAssertion5.ts index 1a67bdc98a152..10b3343c5f7c7 100644 --- a/tests/cases/conformance/importAssertion/importAssertion5.ts +++ b/tests/cases/conformance/importAssertion/importAssertion5.ts @@ -1,3 +1,3 @@ // @module: commonjs // @target: es2015 -import * as f from "./first" assert { +import * as f from "./first" with { diff --git a/tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts b/tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts index bcbf3566ecc8d..f808c68d12bf5 100644 --- a/tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts +++ b/tests/cases/conformance/moduleResolution/resolutionModeTypeOnlyImport1.ts @@ -24,15 +24,15 @@ export declare const x: "script"; // @Filename: /app.ts import type { x as Default } from "foo"; -import type { x as Import } from "foo" assert { "resolution-mode": "import" }; -import type { x as Require } from "foo" assert { "resolution-mode": "require" }; +import type { x as Import } from "foo" with { "resolution-mode": "import" }; +import type { x as Require } from "foo" with { "resolution-mode": "require" }; type _Default = typeof Default; type _Import = typeof Import; type _Require = typeof Require; // resolution-mode does not enforce file extension in `bundler`, just sets conditions -import type { x as ImportRelative } from "./other" assert { "resolution-mode": "import" }; -import type { x as RequireRelative } from "./other" assert { "resolution-mode": "require" }; +import type { x as ImportRelative } from "./other" with { "resolution-mode": "import" }; +import type { x as RequireRelative } from "./other" with { "resolution-mode": "require" }; type _ImportRelative = typeof ImportRelative; type _RequireRelative = typeof RequireRelative; diff --git a/tests/cases/conformance/node/nodeModulesImportAssertions.ts b/tests/cases/conformance/node/nodeModulesImportAssertions.ts index f7e50e461f338..b57351ea5459c 100644 --- a/tests/cases/conformance/node/nodeModulesImportAssertions.ts +++ b/tests/cases/conformance/node/nodeModulesImportAssertions.ts @@ -2,10 +2,10 @@ // @module: node16,node18,node20,nodenext // @resolveJsonModule: true // @filename: index.ts -import json from "./package.json" assert { type: "json" }; +import json from "./package.json" with { type: "json" }; // @filename: otherc.cts -import json from "./package.json" assert { type: "json" }; // should error, cjs mode imports don't support assertions -const json2 = import("./package.json", { assert: { type: "json" } }); // should be fine +import json from "./package.json" with { type: "json" }; // should error, cjs mode imports don't support attributes +const json2 = import("./package.json", { with: { type: "json" } }); // should be fine // @filename: package.json { "name": "pkg", diff --git a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts index acf3482e79bf6..425ec617014d5 100644 --- a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts +++ b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit1.ts @@ -17,14 +17,14 @@ export interface ImportInterface {} // @filename: /node_modules/pkg/require.d.ts export interface RequireInterface {} // @filename: /index.ts -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts index 0d1050da7d551..dff5292d77b95 100644 --- a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts +++ b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmit2.ts @@ -22,14 +22,14 @@ export interface RequireInterface {} "type": "module" } // @filename: /index.ts -import type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -import type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +import type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; export interface LocalInterface extends RequireInterface, ImportInterface {} -import {type RequireInterface as Req} from "pkg" assert { "resolution-mode": "require" }; -import {type ImportInterface as Imp} from "pkg" assert { "resolution-mode": "import" }; +import {type RequireInterface as Req} from "pkg" with { "resolution-mode": "require" }; +import {type ImportInterface as Imp} from "pkg" with { "resolution-mode": "import" }; export interface Loc extends Req, Imp {} -export type { RequireInterface } from "pkg" assert { "resolution-mode": "require" }; -export type { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +export type { RequireInterface } from "pkg" with { "resolution-mode": "require" }; +export type { ImportInterface } from "pkg" with { "resolution-mode": "import" }; diff --git a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts index a5f02035768ea..beccfce3d2449 100644 --- a/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts +++ b/tests/cases/conformance/node/nodeModulesImportModeDeclarationEmitErrors1.ts @@ -18,11 +18,11 @@ export interface ImportInterface {} export interface RequireInterface {} // @filename: /index.ts // incorrect mode -import type { RequireInterface } from "pkg" assert { "resolution-mode": "foobar" }; +import type { RequireInterface } from "pkg" with { "resolution-mode": "foobar" }; // not type-only -import { ImportInterface } from "pkg" assert { "resolution-mode": "import" }; +import { ImportInterface } from "pkg" with { "resolution-mode": "import" }; // not exclusively type-only -import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" assert { "resolution-mode": "require" }; +import {type RequireInterface as Req, RequireInterface as Req2} from "pkg" with { "resolution-mode": "require" }; export interface LocalInterface extends RequireInterface, ImportInterface {} diff --git a/tests/cases/fourslash/getOccurrencesNonStringImportAssertion.ts b/tests/cases/fourslash/getOccurrencesNonStringImportAssertion.ts index b1c28856ef11a..1ea21d59310f9 100644 --- a/tests/cases/fourslash/getOccurrencesNonStringImportAssertion.ts +++ b/tests/cases/fourslash/getOccurrencesNonStringImportAssertion.ts @@ -1,7 +1,7 @@ /// // @module: node18 -////import * as react from "react" assert { cache: /**/0 }; +////import * as react from "react" with { cache: /**/0 }; ////react.Children; verify.baselineDocumentHighlights(""); diff --git a/tests/cases/fourslash/organizeImportsAttributes.ts b/tests/cases/fourslash/organizeImportsAttributes.ts index 2eb0bf8269b29..1cfa4b0da8faa 100644 --- a/tests/cases/fourslash/organizeImportsAttributes.ts +++ b/tests/cases/fourslash/organizeImportsAttributes.ts @@ -2,8 +2,8 @@ //// import { A } from "./file"; //// import { type B } from "./file"; -//// import { C } from "./file" assert { type: "a" }; -//// import { A as D } from "./file" assert { type: "b" }; +//// import { C } from "./file" with { type: "a" }; +//// import { A as D } from "./file" with { type: "b" }; //// import { E } from "./file" with { type: "a" }; //// import { A as F } from "./file" with { type: "b" }; //// @@ -11,10 +11,8 @@ verify.organizeImports( `import { A, type B } from "./file"; -import { C } from "./file" assert { type: "a" }; -import { A as D } from "./file" assert { type: "b" }; -import { E } from "./file" with { type: "a" }; -import { A as F } from "./file" with { type: "b" }; +import { C, E } from "./file" with { type: "a" }; +import { A as D, A as F } from "./file" with { type: "b" }; type G = A | B | C | D | E | F;`); \ No newline at end of file diff --git a/tests/cases/fourslash/organizeImportsAttributes2.ts b/tests/cases/fourslash/organizeImportsAttributes2.ts index 2bc650dfbceca..7c91bb62c6bf0 100644 --- a/tests/cases/fourslash/organizeImportsAttributes2.ts +++ b/tests/cases/fourslash/organizeImportsAttributes2.ts @@ -1,20 +1,19 @@ /// ////import { A } from "./a"; -////import { C } from "./a" assert { type: "a" }; +////import { C } from "./a" with { type: "a" }; ////import { Z } from "./z"; -////import { A as D } from "./a" assert { type: "b" }; +////import { A as D } from "./a" with { type: "b" }; ////import { E } from "./a" with { type: "a" }; -////import { F } from "./a" assert { type: "a" }; +////import { F } from "./a" with { type: "a" }; ////import { B } from "./a"; //// ////export type G = A | B | C | D | E | F | Z; verify.organizeImports( `import { A, B } from "./a"; -import { C, F } from "./a" assert { type: "a" }; -import { A as D } from "./a" assert { type: "b" }; -import { E } from "./a" with { type: "a" }; +import { C, E, F } from "./a" with { type: "a" }; +import { A as D } from "./a" with { type: "b" }; import { Z } from "./z"; export type G = A | B | C | D | E | F | Z;`); \ No newline at end of file diff --git a/tests/cases/fourslash/organizeImportsAttributes3.ts b/tests/cases/fourslash/organizeImportsAttributes3.ts index d8ad60a8112a6..b3c6dda182867 100644 --- a/tests/cases/fourslash/organizeImportsAttributes3.ts +++ b/tests/cases/fourslash/organizeImportsAttributes3.ts @@ -1,20 +1,20 @@ /// ////import { A } from "./a"; -////import { C } from "./a" assert { type: "a" }; +////import { C } from "./a" with { type: "a" }; ////import { Z } from "./z"; -////import { A as D } from "./a" assert { type: "b" }; -////import { E } from "./a" assert { type: /* comment*/ "a" }; -////import { F } from "./a" assert {type: "a" }; -////import { Y } from "./a" assert{ type: "b" /* comment*/}; +////import { A as D } from "./a" with { type: "b" }; +////import { E } from "./a" with { type: /* comment*/ "a" }; +////import { F } from "./a" with {type: "a" }; +////import { Y } from "./a" with{ type: "b" /* comment*/}; ////import { B } from "./a"; //// ////export type G = A | B | C | D | E | F | Y | Z; verify.organizeImports( `import { A, B } from "./a"; -import { C, E, F } from "./a" assert { type: "a" }; -import { A as D, Y } from "./a" assert { type: "b" }; +import { C, E, F } from "./a" with { type: "a" }; +import { A as D, Y } from "./a" with { type: "b" }; import { Z } from "./z"; export type G = A | B | C | D | E | F | Y | Z;`); \ No newline at end of file diff --git a/tests/cases/fourslash/organizeImportsAttributes4.ts b/tests/cases/fourslash/organizeImportsAttributes4.ts index bded70d338c6b..48b2af7f5690c 100644 --- a/tests/cases/fourslash/organizeImportsAttributes4.ts +++ b/tests/cases/fourslash/organizeImportsAttributes4.ts @@ -1,21 +1,21 @@ /// -////import { A } from "./a" assert { foo: "foo", bar: "bar" }; -////import { B } from "./a" assert { bar: "bar", foo: "foo" }; -////import { D } from "./a" assert { bar: "foo", foo: "bar" }; -////import { E } from "./a" assert { foo: 'bar', bar: "foo" }; -////import { C } from "./a" assert { foo: "bar", bar: "foo" }; -////import { F } from "./a" assert { foo: "42" }; -////import { Y } from "./a" assert { foo: 42 }; -////import { Z } from "./a" assert { foo: "42" }; +////import { A } from "./a" with { foo: "foo", bar: "bar" }; +////import { B } from "./a" with { bar: "bar", foo: "foo" }; +////import { D } from "./a" with { bar: "foo", foo: "bar" }; +////import { E } from "./a" with { foo: 'bar', bar: "foo" }; +////import { C } from "./a" with { foo: "bar", bar: "foo" }; +////import { F } from "./a" with { foo: "42" }; +////import { Y } from "./a" with { foo: 42 }; +////import { Z } from "./a" with { foo: "42" }; //// ////export type G = A | B | C | D | E | F | Y | Z; verify.organizeImports( -`import { A, B } from "./a" assert { foo: "foo", bar: "bar" }; -import { C, D, E } from "./a" assert { bar: "foo", foo: "bar" }; -import { F, Z } from "./a" assert { foo: "42" }; -import { Y } from "./a" assert { foo: 42 }; +`import { A, B } from "./a" with { foo: "foo", bar: "bar" }; +import { C, D, E } from "./a" with { bar: "foo", foo: "bar" }; +import { F, Z } from "./a" with { foo: "42" }; +import { Y } from "./a" with { foo: 42 }; export type G = A | B | C | D | E | F | Y | Z;`); \ No newline at end of file diff --git a/tests/cases/fourslash/outliningSpansForImportsAndExports.ts b/tests/cases/fourslash/outliningSpansForImportsAndExports.ts index 05781bc8106d2..52a3266b38cb6 100644 --- a/tests/cases/fourslash/outliningSpansForImportsAndExports.ts +++ b/tests/cases/fourslash/outliningSpansForImportsAndExports.ts @@ -10,12 +10,12 @@ //// b2, //// }|] from "b"; //// ; -//// import j1 from "./j" assert { type: "json" }; +//// import j1 from "./j" with { type: "json" }; //// ; -//// import j2 from "./j" assert { +//// import j2 from "./j" with { //// }; //// ; -//// import j3 from "./j" assert [|{ +//// import j3 from "./j" with [|{ //// type: "json" //// }|]; //// ; diff --git a/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateInvalidLocation.ts b/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateInvalidLocation.ts index 9abc6840992f5..8b2243e10c50a 100644 --- a/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateInvalidLocation.ts +++ b/tests/cases/fourslash/refactorConvertStringOrTemplateLiteral_ToTemplateInvalidLocation.ts @@ -2,8 +2,8 @@ //// import * as a from "/*1a*/f/*1b*/oobar"; //// export * as b from "/*2a*/f/*2b*/oobar"; -//// import * as c from "foobar" assert { "/*3a*/f/*3b*/oobar": "something" }; -//// import * as d from "foobar" assert { "something": "/*4a*/f/*4b*/oobar" }; +//// import * as c from "foobar" with { "/*3a*/f/*3b*/oobar": "something" }; +//// import * as d from "foobar" with { "something": "/*4a*/f/*4b*/oobar" }; //// //// let x = { //// "/*5a*/f/*5b*/oobar": 1234,