From e99e2c5808eec14142b0cc44a266c1a31501757a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 22:51:39 +0000 Subject: [PATCH 1/4] Initial plan From 88f025bf9e3b3692f6f1ad17221c7e646ad7e1d3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 12 Feb 2026 23:18:46 +0000 Subject: [PATCH 2/4] Reject import assert in parser and remove checker assert-specific logic Error at parse time when 'assert' keyword is used for import attributes (in all 3 parse locations: tryParseImportAttributes, parseExportDeclaration, parseImportType). Remove checker logic that distinguished between 'assert' and 'with' tokens, always using 'import attributes' messages. Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- internal/checker/checker.go | 35 +---- internal/parser/parser.go | 9 ++ .../importAssertionsDeprecated.errors.txt | 29 ++++ ...importAssertionsDeprecated.errors.txt.diff | 33 ----- ...portAssertionsDeprecatedIgnored.errors.txt | 30 ++++ ...ssertionsDeprecatedIgnored.errors.txt.diff | 34 +++++ .../parseAssertEntriesError.errors.txt | 11 +- .../parseAssertEntriesError.errors.txt.diff | 57 ++++++++ ...DeclarationEmit1(module=node16).errors.txt | 35 +++++ ...rationEmit1(module=node16).errors.txt.diff | 39 ++++++ ...DeclarationEmit1(module=node18).errors.txt | 35 +++++ ...rationEmit1(module=node18).errors.txt.diff | 39 ++++++ ...DeclarationEmit1(module=node20).errors.txt | 35 +++++ ...rationEmit1(module=node20).errors.txt.diff | 39 ++++++ ...clarationEmit1(module=nodenext).errors.txt | 35 +++++ ...tionEmit1(module=nodenext).errors.txt.diff | 39 ++++++ ...ationEmitErrors1(module=node16).errors.txt | 68 ++++----- ...EmitErrors1(module=node16).errors.txt.diff | 129 ++++++++++++++++++ ...ationEmitErrors1(module=node18).errors.txt | 68 ++++----- ...EmitErrors1(module=node18).errors.txt.diff | 129 ++++++++++++++++++ ...ationEmitErrors1(module=node20).errors.txt | 68 ++++----- ...EmitErrors1(module=node20).errors.txt.diff | 129 ++++++++++++++++++ ...ionEmitErrors1(module=nodenext).errors.txt | 68 ++++----- ...itErrors1(module=nodenext).errors.txt.diff | 129 ++++++++++++++++++ ...Type1(moduleresolution=bundler).errors.txt | 43 ++++++ ...(moduleresolution=bundler).errors.txt.diff | 47 +++++++ 26 files changed, 1225 insertions(+), 187 deletions(-) create mode 100644 testdata/baselines/reference/submodule/compiler/importAssertionsDeprecated.errors.txt delete mode 100644 testdata/baselines/reference/submodule/compiler/importAssertionsDeprecated.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/importAssertionsDeprecatedIgnored.errors.txt create mode 100644 testdata/baselines/reference/submodule/compiler/importAssertionsDeprecatedIgnored.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/compiler/parseAssertEntriesError.errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff create mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=bundler).errors.txt create mode 100644 testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=bundler).errors.txt.diff diff --git a/internal/checker/checker.go b/internal/checker/checker.go index c4ec0ee2252..61454c3be69 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -3231,9 +3231,7 @@ func (c *Checker) checkImportType(node *ast.Node) { func (c *Checker) getResolutionModeOverride(node *ast.ImportAttributes, reportErrors bool) core.ResolutionMode { if len(node.Attributes.Nodes) != 1 { if reportErrors { - c.grammarErrorOnNode(node.AsNode(), core.IfElse(node.Token == ast.KindWithKeyword, - diagnostics.Type_import_attributes_should_have_exactly_one_key_resolution_mode_with_value_import_or_require, - diagnostics.Type_import_assertions_should_have_exactly_one_key_resolution_mode_with_value_import_or_require)) + c.grammarErrorOnNode(node.AsNode(), diagnostics.Type_import_attributes_should_have_exactly_one_key_resolution_mode_with_value_import_or_require) } return core.ResolutionModeNone } @@ -3243,9 +3241,7 @@ func (c *Checker) getResolutionModeOverride(node *ast.ImportAttributes, reportEr } if elem.Name().Text() != "resolution-mode" { if reportErrors { - c.grammarErrorOnNode(elem.Name(), core.IfElse(node.Token == ast.KindWithKeyword, - diagnostics.X_resolution_mode_is_the_only_valid_key_for_type_import_attributes, - diagnostics.X_resolution_mode_is_the_only_valid_key_for_type_import_assertions)) + c.grammarErrorOnNode(elem.Name(), diagnostics.X_resolution_mode_is_the_only_valid_key_for_type_import_attributes) } return core.ResolutionModeNone } @@ -5207,14 +5203,11 @@ func (c *Checker) checkExternalImportOrExportDeclaration(node *ast.Node) bool { if !ast.IsImportEqualsDeclaration(node) { attributes := ast.GetImportAttributes(node) if attributes != nil { - diagnostic := core.IfElse(attributes.AsImportAttributes().Token == ast.KindWithKeyword, - diagnostics.Import_attribute_values_must_be_string_literal_expressions, - diagnostics.Import_assertion_values_must_be_string_literal_expressions) hasError := false for _, attr := range attributes.AsImportAttributes().Attributes.Nodes { if !ast.IsStringLiteral(attr.AsImportAttribute().Value) { hasError = true - c.error(attr.AsImportAttribute().Value, diagnostic) + c.error(attr.AsImportAttribute().Value, diagnostics.Import_attribute_values_must_be_string_literal_expressions) } } return !hasError @@ -5260,40 +5253,24 @@ func (c *Checker) checkImportAttributes(declaration *ast.Node) { } isTypeOnly := ast.IsExclusivelyTypeOnlyImportOrExport(declaration) override := c.getResolutionModeOverride(node.AsImportAttributes(), isTypeOnly) - isImportAttributes := node.AsImportAttributes().Token == ast.KindWithKeyword if isTypeOnly && override != core.ResolutionModeNone { return // Other grammar checks do not apply to type-only imports with resolution mode assertions } if !c.moduleKind.SupportsImportAttributes() { - if isImportAttributes { - c.grammarErrorOnNode(node, diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_node20_nodenext_or_preserve) - } else { - c.grammarErrorOnNode(node, diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_node18_node20_nodenext_or_preserve) - } - return - } - - if core.ModuleKindNode20 <= c.moduleKind && c.moduleKind <= core.ModuleKindNodeNext && !isImportAttributes { - c.grammarErrorOnNode(node, diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert) + c.grammarErrorOnNode(node, diagnostics.Import_attributes_are_only_supported_when_the_module_option_is_set_to_esnext_node18_node20_nodenext_or_preserve) return } if moduleSpecifier := getModuleSpecifierFromNode(declaration); moduleSpecifier != nil { if c.getEmitSyntaxForModuleSpecifierExpression(moduleSpecifier) == core.ModuleKindCommonJS { - if isImportAttributes { - c.grammarErrorOnNode(node, diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls) - } else { - c.grammarErrorOnNode(node, diagnostics.Import_assertions_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls) - } + c.grammarErrorOnNode(node, diagnostics.Import_attributes_are_not_allowed_on_statements_that_compile_to_CommonJS_require_calls) return } } if isTypeOnly { - c.grammarErrorOnNode(node, core.IfElse(isImportAttributes, - diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports, - diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports)) + c.grammarErrorOnNode(node, diagnostics.Import_attributes_cannot_be_used_with_type_only_imports_or_exports) return } if override != core.ResolutionModeNone { diff --git a/internal/parser/parser.go b/internal/parser/parser.go index 66cc07bf5d3..47fef4cb432 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -2379,6 +2379,9 @@ func (p *Parser) parseModuleExportName(disallowKeywords bool) (node *ast.Node, n func (p *Parser) tryParseImportAttributes() *ast.Node { if p.token == ast.KindWithKeyword || (p.token == ast.KindAssertKeyword && !p.hasPrecedingLineBreak()) { + if p.token == ast.KindAssertKeyword { + p.parseErrorAtCurrentToken(diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert) + } return p.parseImportAttributes(p.token, false /*skipKeyword*/) } return nil @@ -2443,6 +2446,9 @@ func (p *Parser) parseExportDeclaration(pos int, hasJSDoc bool, modifiers *ast.M } } if moduleSpecifier != nil && (p.token == ast.KindWithKeyword || p.token == ast.KindAssertKeyword) && !p.hasPrecedingLineBreak() { + if p.token == ast.KindAssertKeyword { + p.parseErrorAtCurrentToken(diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert) + } attributes = p.parseImportAttributes(p.token, false /*skipKeyword*/) } p.parseSemicolon() @@ -2914,6 +2920,9 @@ func (p *Parser) parseImportType() *ast.Node { p.parseExpected(ast.KindOpenBraceToken) currentToken := p.token if currentToken == ast.KindWithKeyword || currentToken == ast.KindAssertKeyword { + if currentToken == ast.KindAssertKeyword { + p.parseErrorAtCurrentToken(diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert) + } p.nextToken() } else { p.parseErrorAtCurrentToken(diagnostics.X_0_expected, scanner.TokenToString(ast.KindWithKeyword)) diff --git a/testdata/baselines/reference/submodule/compiler/importAssertionsDeprecated.errors.txt b/testdata/baselines/reference/submodule/compiler/importAssertionsDeprecated.errors.txt new file mode 100644 index 00000000000..7150d1f0b92 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/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/testdata/baselines/reference/submodule/compiler/importAssertionsDeprecated.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/importAssertionsDeprecated.errors.txt.diff deleted file mode 100644 index 6c617071758..00000000000 --- a/testdata/baselines/reference/submodule/compiler/importAssertionsDeprecated.errors.txt.diff +++ /dev/null @@ -1,33 +0,0 @@ ---- old.importAssertionsDeprecated.errors.txt -+++ new.importAssertionsDeprecated.errors.txt -@@= skipped -0, +0 lines =@@ --/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/testdata/baselines/reference/submodule/compiler/importAssertionsDeprecatedIgnored.errors.txt b/testdata/baselines/reference/submodule/compiler/importAssertionsDeprecatedIgnored.errors.txt new file mode 100644 index 00000000000..5668eab27b1 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/importAssertionsDeprecatedIgnored.errors.txt @@ -0,0 +1,30 @@ +/a.ts(2,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) ==== + // With ignoreDeprecations: "6.0", import assertions should not produce a deprecation error. + 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/testdata/baselines/reference/submodule/compiler/importAssertionsDeprecatedIgnored.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/importAssertionsDeprecatedIgnored.errors.txt.diff new file mode 100644 index 00000000000..2b4576cb603 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/importAssertionsDeprecatedIgnored.errors.txt.diff @@ -0,0 +1,34 @@ +--- old.importAssertionsDeprecatedIgnored.errors.txt ++++ new.importAssertionsDeprecatedIgnored.errors.txt +@@= skipped -0, +0 lines =@@ +- ++/a.ts(2,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) ==== ++ // With ignoreDeprecations: "6.0", import assertions should not produce a deprecation error. ++ 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/testdata/baselines/reference/submodule/compiler/parseAssertEntriesError.errors.txt b/testdata/baselines/reference/submodule/compiler/parseAssertEntriesError.errors.txt index b0784172a9a..b40678ca6e2 100644 --- a/testdata/baselines/reference/submodule/compiler/parseAssertEntriesError.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/parseAssertEntriesError.errors.txt @@ -1,4 +1,5 @@ /index.ts(2,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /index.ts(2,32): error TS1478: Identifier or string literal expected. /index.ts(2,32): error TS2695: Left side of comma operator is unused and has no side effects. /index.ts(2,55): error TS1005: ';' expected. @@ -10,6 +11,7 @@ /index.ts(3,36): error TS1005: ':' expected. /index.ts(3,70): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. /index.ts(5,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /index.ts(5,59): error TS1478: Identifier or string literal expected. /index.ts(5,59): error TS2695: Left side of comma operator is unused and has no side effects. /index.ts(5,82): error TS1005: ';' expected. @@ -21,6 +23,7 @@ /index.ts(5,98): error TS2304: Cannot find name 'RequireInterface'. /index.ts(5,114): error TS1128: Declaration or statement expected. /index.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /index.ts(6,59): error TS1478: Identifier or string literal expected. /index.ts(6,59): error TS2695: Left side of comma operator is unused and has no side effects. /index.ts(6,82): error TS1005: ';' expected. @@ -33,11 +36,13 @@ /index.ts(6,112): error TS1128: Declaration or statement expected. -==== /index.ts (33 errors) ==== +==== /index.ts (36 errors) ==== export type LocalInterface = & import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~ !!! error TS1478: Identifier or string literal expected. ~~~~ @@ -63,6 +68,8 @@ export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface); ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~ !!! error TS1478: Identifier or string literal expected. ~~~~ @@ -86,6 +93,8 @@ export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface); ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~ !!! error TS1478: Identifier or string literal expected. ~~~~ diff --git a/testdata/baselines/reference/submodule/compiler/parseAssertEntriesError.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/parseAssertEntriesError.errors.txt.diff new file mode 100644 index 00000000000..8a70a857be2 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/parseAssertEntriesError.errors.txt.diff @@ -0,0 +1,57 @@ +--- old.parseAssertEntriesError.errors.txt ++++ new.parseAssertEntriesError.errors.txt +@@= skipped -0, +0 lines =@@ + /index.ts(2,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ++/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /index.ts(2,32): error TS1478: Identifier or string literal expected. + /index.ts(2,32): error TS2695: Left side of comma operator is unused and has no side effects. + /index.ts(2,55): error TS1005: ';' expected. +@@= skipped -9, +10 lines =@@ + /index.ts(3,36): error TS1005: ':' expected. + /index.ts(3,70): error TS2339: Property 'ImportInterface' does not exist on type 'Promise<{ default: typeof import("/node_modules/pkg/import"); }>'. + /index.ts(5,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ++/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /index.ts(5,59): error TS1478: Identifier or string literal expected. + /index.ts(5,59): error TS2695: Left side of comma operator is unused and has no side effects. + /index.ts(5,82): error TS1005: ';' expected. +@@= skipped -11, +12 lines =@@ + /index.ts(5,98): error TS2304: Cannot find name 'RequireInterface'. + /index.ts(5,114): error TS1128: Declaration or statement expected. + /index.ts(6,34): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ++/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /index.ts(6,59): error TS1478: Identifier or string literal expected. + /index.ts(6,59): error TS2695: Left side of comma operator is unused and has no side effects. + /index.ts(6,82): error TS1005: ';' expected. +@@= skipped -12, +13 lines =@@ + /index.ts(6,112): error TS1128: Declaration or statement expected. + + +-==== /index.ts (33 errors) ==== ++==== /index.ts (36 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface + ~~~~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~ + !!! error TS1478: Identifier or string literal expected. + ~~~~ +@@= skipped -30, +32 lines =@@ + export const a = (null as any as import("pkg", { assert: {1234, "resolution-mode": "require"} }).RequireInterface); + ~~~~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~ + !!! error TS1478: Identifier or string literal expected. + ~~~~ +@@= skipped -23, +25 lines =@@ + export const b = (null as any as import("pkg", { assert: {1234, "resolution-mode": "import"} }).ImportInterface); + ~~~~~~~~~~~~~~~~~~~~~~~~~ + !!! error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~ + !!! error TS1478: Identifier or string literal expected. + ~~~~ \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt new file mode 100644 index 00000000000..20df6682666 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt @@ -0,0 +1,35 @@ +/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + +==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt.diff new file mode 100644 index 00000000000..2b92a18e93a --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt.diff @@ -0,0 +1,39 @@ +--- old.nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt ++++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node16).errors.txt +@@= skipped -0, +0 lines =@@ +- ++/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++ ++==== /index.ts (4 errors) ==== ++ export type LocalInterface = ++ & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++ export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++==== /node_modules/pkg/package.json (0 errors) ==== ++ { ++ "name": "pkg", ++ "version": "0.0.1", ++ "exports": { ++ "import": "./import.js", ++ "require": "./require.js" ++ } ++ } ++==== /node_modules/pkg/import.d.ts (0 errors) ==== ++ export interface ImportInterface {} ++==== /node_modules/pkg/require.d.ts (0 errors) ==== ++ export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt new file mode 100644 index 00000000000..20df6682666 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt @@ -0,0 +1,35 @@ +/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + +==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt.diff new file mode 100644 index 00000000000..297e3c56c8d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt.diff @@ -0,0 +1,39 @@ +--- old.nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt ++++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node18).errors.txt +@@= skipped -0, +0 lines =@@ +- ++/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++ ++==== /index.ts (4 errors) ==== ++ export type LocalInterface = ++ & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++ export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++==== /node_modules/pkg/package.json (0 errors) ==== ++ { ++ "name": "pkg", ++ "version": "0.0.1", ++ "exports": { ++ "import": "./import.js", ++ "require": "./require.js" ++ } ++ } ++==== /node_modules/pkg/import.d.ts (0 errors) ==== ++ export interface ImportInterface {} ++==== /node_modules/pkg/require.d.ts (0 errors) ==== ++ export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt new file mode 100644 index 00000000000..20df6682666 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt @@ -0,0 +1,35 @@ +/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + +==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt.diff new file mode 100644 index 00000000000..777c5dc2dca --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt.diff @@ -0,0 +1,39 @@ +--- old.nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt ++++ new.nodeModulesImportTypeModeDeclarationEmit1(module=node20).errors.txt +@@= skipped -0, +0 lines =@@ +- ++/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++ ++==== /index.ts (4 errors) ==== ++ export type LocalInterface = ++ & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++ export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++==== /node_modules/pkg/package.json (0 errors) ==== ++ { ++ "name": "pkg", ++ "version": "0.0.1", ++ "exports": { ++ "import": "./import.js", ++ "require": "./require.js" ++ } ++ } ++==== /node_modules/pkg/import.d.ts (0 errors) ==== ++ export interface ImportInterface {} ++==== /node_modules/pkg/require.d.ts (0 errors) ==== ++ export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt new file mode 100644 index 00000000000..20df6682666 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt @@ -0,0 +1,35 @@ +/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + +==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + +==== /node_modules/pkg/package.json (0 errors) ==== + { + "name": "pkg", + "version": "0.0.1", + "exports": { + "import": "./import.js", + "require": "./require.js" + } + } +==== /node_modules/pkg/import.d.ts (0 errors) ==== + export interface ImportInterface {} +==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt.diff new file mode 100644 index 00000000000..c506afdf80c --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt.diff @@ -0,0 +1,39 @@ +--- old.nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt ++++ new.nodeModulesImportTypeModeDeclarationEmit1(module=nodenext).errors.txt +@@= skipped -0, +0 lines =@@ +- ++/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++ ++==== /index.ts (4 errors) ==== ++ export type LocalInterface = ++ & import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++ export const a = (null as any as import("pkg", { assert: {"resolution-mode": "require"} }).RequireInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++==== /node_modules/pkg/package.json (0 errors) ==== ++ { ++ "name": "pkg", ++ "version": "0.0.1", ++ "exports": { ++ "import": "./import.js", ++ "require": "./require.js" ++ } ++ } ++==== /node_modules/pkg/import.d.ts (0 errors) ==== ++ export interface ImportInterface {} ++==== /node_modules/pkg/require.d.ts (0 errors) ==== ++ export interface RequireInterface {} \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt index 5172f49a5c8..72bd482752c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt @@ -1,5 +1,7 @@ -/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -27,11 +29,11 @@ /other.ts(7,79): error TS1434: Unexpected keyword or identifier. /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other2.ts(4,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other2.ts(7,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(3,21): error TS1005: '{' expected. @@ -67,11 +69,11 @@ /other4.ts(10,56): error TS1005: ',' expected. /other4.ts(10,57): error TS1134: Variable declaration expected. /other4.ts(10,73): error TS1005: ',' expected. -/other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other5.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other5.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -88,17 +90,21 @@ export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (2 errors) ==== +==== /index.ts (4 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -!!! error TS1453: `resolution-mode` should be either `require` or `import`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); - ~~~~~~~~ -!!! error TS1453: `resolution-mode` should be either `require` or `import`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface = @@ -168,20 +174,20 @@ // wrong assertion key export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {"bad": "import"} }).ImportInterface; - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. ==== /other3.ts (16 errors) ==== @@ -283,20 +289,20 @@ ==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {} }).ImportInterface; - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt.diff new file mode 100644 index 00000000000..f753a6f160d --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt.diff @@ -0,0 +1,129 @@ +--- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt ++++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt +@@= skipped -0, +0 lines =@@ +-/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. +-/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. ++/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + /other.ts(3,22): error TS1005: 'with' expected. + /other.ts(3,39): error TS1005: ';' expected. +@@= skipped -26, +28 lines =@@ + /other.ts(7,79): error TS1434: Unexpected keyword or identifier. + /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. + /other.ts(7,94): error TS1128: Declaration or statement expected. +-/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. ++/other2.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other2.ts(4,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +-/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. ++/other2.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other2.ts(7,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + /other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + /other3.ts(3,21): error TS1005: '{' expected. +@@= skipped -40, +40 lines =@@ + /other4.ts(10,56): error TS1005: ',' expected. + /other4.ts(10,57): error TS1134: Variable declaration expected. + /other4.ts(10,73): error TS1005: ',' expected. +-/other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++/other5.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other5.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +-/other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++/other5.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other5.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + +@@= skipped -21, +21 lines =@@ + export interface ImportInterface {} + ==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} +-==== /index.ts (2 errors) ==== ++==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface +- ~~~~~~~~ +-!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); +- ~~~~~~~~ +-!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ==== /other.ts (27 errors) ==== + // missing assert: + export type LocalInterface = +@@= skipped -80, +84 lines =@@ + // wrong assertion key + export type LocalInterface = + & import("pkg", { assert: {"bad": "require"} }).RequireInterface +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"bad": "import"} }).ImportInterface; +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + ==== /other3.ts (16 errors) ==== +@@= skipped -115, +115 lines =@@ + ==== /other5.ts (6 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {} }).RequireInterface +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {} }).ImportInterface; +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt index 5172f49a5c8..72bd482752c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt @@ -1,5 +1,7 @@ -/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -27,11 +29,11 @@ /other.ts(7,79): error TS1434: Unexpected keyword or identifier. /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other2.ts(4,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other2.ts(7,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(3,21): error TS1005: '{' expected. @@ -67,11 +69,11 @@ /other4.ts(10,56): error TS1005: ',' expected. /other4.ts(10,57): error TS1134: Variable declaration expected. /other4.ts(10,73): error TS1005: ',' expected. -/other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other5.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other5.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -88,17 +90,21 @@ export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (2 errors) ==== +==== /index.ts (4 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -!!! error TS1453: `resolution-mode` should be either `require` or `import`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); - ~~~~~~~~ -!!! error TS1453: `resolution-mode` should be either `require` or `import`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface = @@ -168,20 +174,20 @@ // wrong assertion key export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {"bad": "import"} }).ImportInterface; - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. ==== /other3.ts (16 errors) ==== @@ -283,20 +289,20 @@ ==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {} }).ImportInterface; - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff new file mode 100644 index 00000000000..06dd49c9d88 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff @@ -0,0 +1,129 @@ +--- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt ++++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt +@@= skipped -0, +0 lines =@@ +-/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. +-/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. ++/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + /other.ts(3,22): error TS1005: 'with' expected. + /other.ts(3,39): error TS1005: ';' expected. +@@= skipped -26, +28 lines =@@ + /other.ts(7,79): error TS1434: Unexpected keyword or identifier. + /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. + /other.ts(7,94): error TS1128: Declaration or statement expected. +-/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. ++/other2.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other2.ts(4,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +-/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. ++/other2.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other2.ts(7,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + /other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + /other3.ts(3,21): error TS1005: '{' expected. +@@= skipped -40, +40 lines =@@ + /other4.ts(10,56): error TS1005: ',' expected. + /other4.ts(10,57): error TS1134: Variable declaration expected. + /other4.ts(10,73): error TS1005: ',' expected. +-/other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++/other5.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other5.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +-/other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++/other5.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other5.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + +@@= skipped -21, +21 lines =@@ + export interface ImportInterface {} + ==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} +-==== /index.ts (2 errors) ==== ++==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface +- ~~~~~~~~ +-!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); +- ~~~~~~~~ +-!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ==== /other.ts (27 errors) ==== + // missing assert: + export type LocalInterface = +@@= skipped -80, +84 lines =@@ + // wrong assertion key + export type LocalInterface = + & import("pkg", { assert: {"bad": "require"} }).RequireInterface +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"bad": "import"} }).ImportInterface; +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + ==== /other3.ts (16 errors) ==== +@@= skipped -115, +115 lines =@@ + ==== /other5.ts (6 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {} }).RequireInterface +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {} }).ImportInterface; +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt index 5172f49a5c8..72bd482752c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt @@ -1,5 +1,7 @@ -/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -27,11 +29,11 @@ /other.ts(7,79): error TS1434: Unexpected keyword or identifier. /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other2.ts(4,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other2.ts(7,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(3,21): error TS1005: '{' expected. @@ -67,11 +69,11 @@ /other4.ts(10,56): error TS1005: ',' expected. /other4.ts(10,57): error TS1134: Variable declaration expected. /other4.ts(10,73): error TS1005: ',' expected. -/other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other5.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other5.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -88,17 +90,21 @@ export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (2 errors) ==== +==== /index.ts (4 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -!!! error TS1453: `resolution-mode` should be either `require` or `import`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); - ~~~~~~~~ -!!! error TS1453: `resolution-mode` should be either `require` or `import`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface = @@ -168,20 +174,20 @@ // wrong assertion key export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {"bad": "import"} }).ImportInterface; - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. ==== /other3.ts (16 errors) ==== @@ -283,20 +289,20 @@ ==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {} }).ImportInterface; - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff new file mode 100644 index 00000000000..63e4e0674dd --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff @@ -0,0 +1,129 @@ +--- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt ++++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt +@@= skipped -0, +0 lines =@@ +-/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. +-/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. ++/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + /other.ts(3,22): error TS1005: 'with' expected. + /other.ts(3,39): error TS1005: ';' expected. +@@= skipped -26, +28 lines =@@ + /other.ts(7,79): error TS1434: Unexpected keyword or identifier. + /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. + /other.ts(7,94): error TS1128: Declaration or statement expected. +-/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. ++/other2.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other2.ts(4,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +-/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. ++/other2.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other2.ts(7,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + /other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + /other3.ts(3,21): error TS1005: '{' expected. +@@= skipped -40, +40 lines =@@ + /other4.ts(10,56): error TS1005: ',' expected. + /other4.ts(10,57): error TS1134: Variable declaration expected. + /other4.ts(10,73): error TS1005: ',' expected. +-/other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++/other5.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other5.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +-/other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++/other5.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other5.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + +@@= skipped -21, +21 lines =@@ + export interface ImportInterface {} + ==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} +-==== /index.ts (2 errors) ==== ++==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface +- ~~~~~~~~ +-!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); +- ~~~~~~~~ +-!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ==== /other.ts (27 errors) ==== + // missing assert: + export type LocalInterface = +@@= skipped -80, +84 lines =@@ + // wrong assertion key + export type LocalInterface = + & import("pkg", { assert: {"bad": "require"} }).RequireInterface +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"bad": "import"} }).ImportInterface; +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + ==== /other3.ts (16 errors) ==== +@@= skipped -115, +115 lines =@@ + ==== /other5.ts (6 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {} }).RequireInterface +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {} }).ImportInterface; +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt index 5172f49a5c8..72bd482752c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -1,5 +1,7 @@ -/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. -/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. +/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other.ts(3,22): error TS1005: 'with' expected. /other.ts(3,39): error TS1005: ';' expected. @@ -27,11 +29,11 @@ /other.ts(7,79): error TS1434: Unexpected keyword or identifier. /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other2.ts(4,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +/other2.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other2.ts(7,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. /other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? /other3.ts(3,21): error TS1005: '{' expected. @@ -67,11 +69,11 @@ /other4.ts(10,56): error TS1005: ',' expected. /other4.ts(10,57): error TS1134: Variable declaration expected. /other4.ts(10,73): error TS1005: ',' expected. -/other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other5.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. -/other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. -/other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +/other5.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/other5.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. @@ -88,17 +90,21 @@ export interface ImportInterface {} ==== /node_modules/pkg/require.d.ts (0 errors) ==== export interface RequireInterface {} -==== /index.ts (2 errors) ==== +==== /index.ts (4 errors) ==== export type LocalInterface = & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface - ~~~~~~~~ -!!! error TS1453: `resolution-mode` should be either `require` or `import`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); - ~~~~~~~~ -!!! error TS1453: `resolution-mode` should be either `require` or `import`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== /other.ts (27 errors) ==== // missing assert: export type LocalInterface = @@ -168,20 +174,20 @@ // wrong assertion key export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {"bad": "import"} }).ImportInterface; - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); - ~~~~~ -!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. ==== /other3.ts (16 errors) ==== @@ -283,20 +289,20 @@ ==== /other5.ts (6 errors) ==== export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. & import("pkg", { assert: {} }).ImportInterface; - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); - ~~ -!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff new file mode 100644 index 00000000000..1add7309d41 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff @@ -0,0 +1,129 @@ +--- old.nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt ++++ new.nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt +@@= skipped -0, +0 lines =@@ +-/index.ts(2,51): error TS1453: `resolution-mode` should be either `require` or `import`. +-/index.ts(5,78): error TS1453: `resolution-mode` should be either `require` or `import`. ++/index.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/index.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + /other.ts(3,22): error TS1005: 'with' expected. + /other.ts(3,39): error TS1005: ';' expected. +@@= skipped -26, +28 lines =@@ + /other.ts(7,79): error TS1434: Unexpected keyword or identifier. + /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. + /other.ts(7,94): error TS1128: Declaration or statement expected. +-/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(4,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. ++/other2.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other2.ts(4,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other2.ts(4,52): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +-/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(7,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. ++/other2.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other2.ts(7,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other2.ts(7,79): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + /other3.ts(3,7): error TS1340: Module 'pkg' does not refer to a type, but is used as a type here. Did you mean 'typeof import('pkg')'? + /other3.ts(3,21): error TS1005: '{' expected. +@@= skipped -40, +40 lines =@@ + /other4.ts(10,56): error TS1005: ',' expected. + /other4.ts(10,57): error TS1134: Variable declaration expected. + /other4.ts(10,73): error TS1005: ',' expected. +-/other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/other5.ts(3,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++/other5.ts(2,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other5.ts(3,23): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other5.ts(3,37): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. +-/other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/other5.ts(6,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++/other5.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/other5.ts(6,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /other5.ts(6,64): error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + +@@= skipped -21, +21 lines =@@ + export interface ImportInterface {} + ==== /node_modules/pkg/require.d.ts (0 errors) ==== + export interface RequireInterface {} +-==== /index.ts (2 errors) ==== ++==== /index.ts (4 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface +- ~~~~~~~~ +-!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + export const a = (null as any as import("pkg", { assert: {"resolution-mode": "foobar"} }).RequireInterface); +- ~~~~~~~~ +-!!! error TS1453: `resolution-mode` should be either `require` or `import`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"resolution-mode": "import"} }).ImportInterface); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ==== /other.ts (27 errors) ==== + // missing assert: + export type LocalInterface = +@@= skipped -80, +84 lines =@@ + // wrong assertion key + export type LocalInterface = + & import("pkg", { assert: {"bad": "require"} }).RequireInterface +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {"bad": "import"} }).ImportInterface; +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { assert: {"bad": "require"} }).RequireInterface); +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); +- ~~~~~ +-!!! error TS1455: `resolution-mode` is the only valid key for type import assertions. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + ==== /other3.ts (16 errors) ==== +@@= skipped -115, +115 lines =@@ + ==== /other5.ts (6 errors) ==== + export type LocalInterface = + & import("pkg", { assert: {} }).RequireInterface +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + & import("pkg", { assert: {} }).ImportInterface; +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + + export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=bundler).errors.txt b/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=bundler).errors.txt new file mode 100644 index 00000000000..7d587732686 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=bundler).errors.txt @@ -0,0 +1,43 @@ +/app.ts(2,38): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/app.ts(3,39): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/app.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/app.ts(6,51): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + +==== /node_modules/@types/foo/package.json (0 errors) ==== + { + "name": "@types/foo", + "version": "1.0.0", + "exports": { + ".": { + "import": "./index.d.mts", + "require": "./index.d.cts" + } + } + } + +==== /node_modules/@types/foo/index.d.mts (0 errors) ==== + export declare const x: "module"; + +==== /node_modules/@types/foo/index.d.cts (0 errors) ==== + export declare const x: "script"; + +==== /app.ts (4 errors) ==== + type Default = typeof import("foo").x; + type Import = typeof import("foo", { assert: { "resolution-mode": "import" } }).x; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + type Require = typeof import("foo", { assert: { "resolution-mode": "require" } }).x; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + // resolution-mode does not enforce file extension in `bundler`, just sets conditions + type ImportRelative = typeof import("./other", { assert: { "resolution-mode": "import" } }).x; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + type RequireRelative = typeof import("./other", { assert: { "resolution-mode": "require" } }).x; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + +==== /other.ts (0 errors) ==== + export const x = "other"; + \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=bundler).errors.txt.diff b/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=bundler).errors.txt.diff new file mode 100644 index 00000000000..f35844f63b8 --- /dev/null +++ b/testdata/baselines/reference/submodule/conformance/resolutionModeImportType1(moduleresolution=bundler).errors.txt.diff @@ -0,0 +1,47 @@ +--- old.resolutionModeImportType1(moduleresolution=bundler).errors.txt ++++ new.resolutionModeImportType1(moduleresolution=bundler).errors.txt +@@= skipped -0, +0 lines =@@ +- ++/app.ts(2,38): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/app.ts(3,39): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/app.ts(5,50): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/app.ts(6,51): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++ ++==== /node_modules/@types/foo/package.json (0 errors) ==== ++ { ++ "name": "@types/foo", ++ "version": "1.0.0", ++ "exports": { ++ ".": { ++ "import": "./index.d.mts", ++ "require": "./index.d.cts" ++ } ++ } ++ } ++ ++==== /node_modules/@types/foo/index.d.mts (0 errors) ==== ++ export declare const x: "module"; ++ ++==== /node_modules/@types/foo/index.d.cts (0 errors) ==== ++ export declare const x: "script"; ++ ++==== /app.ts (4 errors) ==== ++ type Default = typeof import("foo").x; ++ type Import = typeof import("foo", { assert: { "resolution-mode": "import" } }).x; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ type Require = typeof import("foo", { assert: { "resolution-mode": "require" } }).x; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ // resolution-mode does not enforce file extension in `bundler`, just sets conditions ++ type ImportRelative = typeof import("./other", { assert: { "resolution-mode": "import" } }).x; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ type RequireRelative = typeof import("./other", { assert: { "resolution-mode": "require" } }).x; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ ++==== /other.ts (0 errors) ==== ++ export const x = "other"; ++ \ No newline at end of file From b5abc81b52e43f7a56c8db8619f24f599086d4a7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 19:33:15 +0000 Subject: [PATCH 3/4] Add checker-level check for assert in dynamic import() calls For dynamic import() calls, 'assert' is a property name in an object literal, not syntax-level, so it can't be caught at parse time. Add a checker-level error using c.error() (not grammarErrorOnNode, which would be suppressed by parse diagnostics from import type assert errors in the same file). Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- internal/checker/checker.go | 8 ++++++++ .../importTypeAssertionDeprecation.errors.txt | 8 +++++++- ...rtTypeAssertionDeprecation.errors.txt.diff | 19 +++++-------------- ...TypeAssertionDeprecationIgnored.errors.txt | 8 +++++++- ...ssertionDeprecationIgnored.errors.txt.diff | 8 +++++++- 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/internal/checker/checker.go b/internal/checker/checker.go index b7630088000..a5813735d95 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -8117,6 +8117,14 @@ func (c *Checker) checkImportCallExpression(node *ast.Node) *Type { if importCallOptionsType != c.emptyObjectType { c.checkTypeAssignableTo(optionsType, c.getNullableType(importCallOptionsType, TypeFlagsUndefined), args[1], nil) } + if ast.IsObjectLiteralExpression(args[1]) { + for _, prop := range args[1].AsObjectLiteralExpression().Properties.Nodes { + if ast.IsPropertyAssignment(prop) && ast.IsIdentifier(prop.Name()) && prop.Name().Text() == "assert" { + c.error(prop.Name(), diagnostics.Import_assertions_have_been_replaced_by_import_attributes_Use_with_instead_of_assert) + break + } + } + } } // resolveExternalModuleName will return undefined if the moduleReferenceExpression is not a string literal moduleSymbol := c.resolveExternalModuleName(node, specifier, false /*ignoreErrors*/) diff --git a/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt index 65cbdc7eabd..b87fd180b7c 100644 --- a/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt @@ -1,11 +1,13 @@ /main.ts(1,30): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /main.ts(2,30): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/main.ts(4,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/main.ts(5,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== /types.d.ts (0 errors) ==== export interface MyType { x: string } -==== /main.ts (2 errors) ==== +==== /main.ts (4 errors) ==== type A = import("./types", { assert: { "resolution-mode": "import" } }).MyType; ~~~~~~ !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. @@ -14,5 +16,9 @@ !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. const a = import("./types", { assert: { "resolution-mode": "import" } }); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. const b = import("./types", { assert: { "resolution-mode": "require" } }); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt.diff index 4b8da45e242..b571300dcac 100644 --- a/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt.diff @@ -3,17 +3,14 @@ @@= skipped -0, +0 lines =@@ -/main.ts(1,38): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. -/main.ts(2,38): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --/main.ts(4,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. --/main.ts(5,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/main.ts(1,30): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/main.ts(2,30): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /main.ts(4,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + /main.ts(5,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - - ==== /types.d.ts (0 errors) ==== - export interface MyType { x: string } +@@= skipped -8, +8 lines =@@ --==== /main.ts (4 errors) ==== -+==== /main.ts (2 errors) ==== + ==== /main.ts (4 errors) ==== type A = import("./types", { assert: { "resolution-mode": "import" } }).MyType; - ~ + ~~~~~~ @@ -23,10 +20,4 @@ + ~~~~~~ !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - const a = import("./types", { assert: { "resolution-mode": "import" } }); -- ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - const b = import("./types", { assert: { "resolution-mode": "require" } }); -- ~~~~~~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - \ No newline at end of file + const a = import("./types", { assert: { "resolution-mode": "import" } }); \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecationIgnored.errors.txt b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecationIgnored.errors.txt index 7579b6344d7..cfe028fefa3 100644 --- a/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecationIgnored.errors.txt +++ b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecationIgnored.errors.txt @@ -1,11 +1,13 @@ /main.ts(2,30): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. /main.ts(3,30): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/main.ts(5,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/main.ts(6,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ==== /types.d.ts (0 errors) ==== export interface MyType { x: string } -==== /main.ts (2 errors) ==== +==== /main.ts (4 errors) ==== // With ignoreDeprecations: "6.0", import type assertions should not produce a deprecation error. type A = import("./types", { assert: { "resolution-mode": "import" } }).MyType; ~~~~~~ @@ -15,5 +17,9 @@ !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. const a = import("./types", { assert: { "resolution-mode": "import" } }); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. const b = import("./types", { assert: { "resolution-mode": "require" } }); + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. \ No newline at end of file diff --git a/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecationIgnored.errors.txt.diff b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecationIgnored.errors.txt.diff index a3b33300bf3..264a9fadfa8 100644 --- a/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecationIgnored.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecationIgnored.errors.txt.diff @@ -4,12 +4,14 @@ - +/main.ts(2,30): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +/main.ts(3,30): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/main.ts(5,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++/main.ts(6,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + +==== /types.d.ts (0 errors) ==== + export interface MyType { x: string } + -+==== /main.ts (2 errors) ==== ++==== /main.ts (4 errors) ==== + // With ignoreDeprecations: "6.0", import type assertions should not produce a deprecation error. + type A = import("./types", { assert: { "resolution-mode": "import" } }).MyType; + ~~~~~~ @@ -19,5 +21,9 @@ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + const a = import("./types", { assert: { "resolution-mode": "import" } }); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + const b = import("./types", { assert: { "resolution-mode": "require" } }); ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + \ No newline at end of file From 3eb2e8c3a8edb9dc8d07b5a8ce35673a56ce79ed Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 20:08:27 +0000 Subject: [PATCH 4/4] Update comment: 'resolution mode assertions' -> 'resolution mode attributes' Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com> --- internal/checker/checker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/checker/checker.go b/internal/checker/checker.go index a5813735d95..00463f27071 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -5246,7 +5246,7 @@ func (c *Checker) checkImportAttributes(declaration *ast.Node) { isTypeOnly := ast.IsExclusivelyTypeOnlyImportOrExport(declaration) override := c.getResolutionModeOverride(node.AsImportAttributes(), isTypeOnly) if isTypeOnly && override != core.ResolutionModeNone { - return // Other grammar checks do not apply to type-only imports with resolution mode assertions + return // Other grammar checks do not apply to type-only imports with resolution mode attributes } if !c.moduleKind.SupportsImportAttributes() {