diff --git a/internal/checker/checker.go b/internal/checker/checker.go index cf0a0622f7f..00463f27071 100644 --- a/internal/checker/checker.go +++ b/internal/checker/checker.go @@ -3223,9 +3223,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 } @@ -3235,9 +3233,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 } @@ -5199,14 +5195,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 @@ -5252,40 +5245,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 + return // Other grammar checks do not apply to type-only imports with resolution mode attributes } 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 { @@ -8140,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/internal/parser/parser.go b/internal/parser/parser.go index caf06552239..b00fdb770c0 100644 --- a/internal/parser/parser.go +++ b/internal/parser/parser.go @@ -2433,6 +2433,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 @@ -2497,6 +2500,9 @@ func (p *Parser) parseExportDeclaration(pos int, jsdoc jsdocScannerInfo, modifie } } 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() @@ -2968,6 +2974,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/importTypeAssertionDeprecation.errors.txt b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt new file mode 100644 index 00000000000..b87fd180b7c --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt @@ -0,0 +1,24 @@ +/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 (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'. + type B = import("./types", { assert: { "resolution-mode": "require" } }).MyType; + ~~~~~~ +!!! 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 1a405ead3d3..b571300dcac 100644 --- a/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt.diff +++ b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecation.errors.txt.diff @@ -3,26 +3,21 @@ @@= 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'. -- -- --==== /types.d.ts (0 errors) ==== -- export interface MyType { x: string } -- --==== /main.ts (4 errors) ==== -- type A = import("./types", { assert: { "resolution-mode": "import" } }).MyType; ++/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'. + +@@= skipped -8, +8 lines =@@ + + ==== /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'. -- type B = import("./types", { assert: { "resolution-mode": "require" } }).MyType; ++ ~~~~~~ + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + type B = import("./types", { assert: { "resolution-mode": "require" } }).MyType; - ~ --!!! 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 ++ ~~~~~~ + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + + 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 new file mode 100644 index 00000000000..cfe028fefa3 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecationIgnored.errors.txt @@ -0,0 +1,25 @@ +/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 (4 errors) ==== + // With ignoreDeprecations: "6.0", import type assertions should not produce a deprecation error. + type A = import("./types", { assert: { "resolution-mode": "import" } }).MyType; + ~~~~~~ +!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. + type B = import("./types", { assert: { "resolution-mode": "require" } }).MyType; + ~~~~~~ +!!! 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 new file mode 100644 index 00000000000..264a9fadfa8 --- /dev/null +++ b/testdata/baselines/reference/submodule/compiler/importTypeAssertionDeprecationIgnored.errors.txt.diff @@ -0,0 +1,29 @@ +--- old.importTypeAssertionDeprecationIgnored.errors.txt ++++ new.importTypeAssertionDeprecationIgnored.errors.txt +@@= skipped -0, +0 lines =@@ +- ++/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 (4 errors) ==== ++ // With ignoreDeprecations: "6.0", import type assertions should not produce a deprecation error. ++ type A = import("./types", { assert: { "resolution-mode": "import" } }).MyType; ++ ~~~~~~ ++!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. ++ type B = import("./types", { assert: { "resolution-mode": "require" } }).MyType; ++ ~~~~~~ ++!!! 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/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt index 8e8ed30de6b..cd39735b156 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt @@ -27,11 +27,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 +67,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'. @@ -168,20 +168,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 +283,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 index d8f543e51ec..decf54ad19c 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node16).errors.txt.diff @@ -5,31 +5,41 @@ /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(4,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(4,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,58): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(7,58): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(7,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 -44, +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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(3,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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(6,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 -101, +97 lines =@@ !!! error TS2304: Cannot find name 'ImportInterface'. ~ @@ -40,28 +50,34 @@ export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. & import("pkg", { assert: {"bad": "import"} }).ImportInterface; - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. ~~~~~~~~~~~~~~~ !!! 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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + ==== /other3.ts (16 errors) ==== @@= skipped -124, +116 lines =@@ !!! error TS1134: Variable declaration expected. ~ @@ -71,25 +87,31 @@ export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. & import("pkg", { assert: {} }).ImportInterface; - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - ~~~~~~~~~~~~~~~ \ No newline at end of file ++ ~~~~~~ + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~~~~~~~~~~ + !!! 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 8e8ed30de6b..cd39735b156 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt @@ -27,11 +27,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 +67,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'. @@ -168,20 +168,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 +283,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 index 908c0723598..701525eea48 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node18).errors.txt.diff @@ -5,31 +5,41 @@ /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(4,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(4,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,58): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(7,58): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(7,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 -44, +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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(3,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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(6,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 -101, +97 lines =@@ !!! error TS2304: Cannot find name 'ImportInterface'. ~ @@ -40,28 +50,34 @@ export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. & import("pkg", { assert: {"bad": "import"} }).ImportInterface; - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. ~~~~~~~~~~~~~~~ !!! 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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + ==== /other3.ts (16 errors) ==== @@= skipped -124, +116 lines =@@ !!! error TS1134: Variable declaration expected. ~ @@ -71,25 +87,31 @@ export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. & import("pkg", { assert: {} }).ImportInterface; - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - ~~~~~~~~~~~~~~~ \ No newline at end of file ++ ~~~~~~ + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~~~~~~~~~~ + !!! 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 8e8ed30de6b..cd39735b156 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt @@ -27,11 +27,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 +67,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'. @@ -168,20 +168,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 +283,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 index e04024e2b85..fd469d22069 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=node20).errors.txt.diff @@ -5,31 +5,41 @@ /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(4,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(4,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,58): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(7,58): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(7,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 -44, +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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(3,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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(6,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 -101, +97 lines =@@ !!! error TS2304: Cannot find name 'ImportInterface'. ~ @@ -40,28 +50,34 @@ export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. & import("pkg", { assert: {"bad": "import"} }).ImportInterface; - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. ~~~~~~~~~~~~~~~ !!! 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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + ==== /other3.ts (16 errors) ==== @@= skipped -124, +116 lines =@@ !!! error TS1134: Variable declaration expected. ~ @@ -71,25 +87,31 @@ export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. & import("pkg", { assert: {} }).ImportInterface; - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - ~~~~~~~~~~~~~~~ \ No newline at end of file ++ ~~~~~~ + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~~~~~~~~~~ + !!! 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 8e8ed30de6b..cd39735b156 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt @@ -27,11 +27,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 +67,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'. @@ -168,20 +168,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 +283,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 index aa879672a6c..ef5d4d76a63 100644 --- a/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff +++ b/testdata/baselines/reference/submodule/conformance/nodeModulesImportTypeModeDeclarationEmitErrors1(module=nodenext).errors.txt.diff @@ -5,31 +5,41 @@ /other.ts(7,79): error TS2304: Cannot find name 'ImportInterface'. /other.ts(7,94): error TS1128: Declaration or statement expected. -/other2.ts(3,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(3,32): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(4,31): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(4,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,58): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. +-/other2.ts(6,59): error TS1455: `resolution-mode` is the only valid key for type import assertions. -/other2.ts(7,58): error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other2.ts(7,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 -44, +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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(2,31): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(3,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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(5,58): error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. +-/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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - /other5.ts(6,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 -101, +97 lines =@@ !!! error TS2304: Cannot find name 'ImportInterface'. ~ @@ -40,28 +50,34 @@ export type LocalInterface = & import("pkg", { assert: {"bad": "require"} }).RequireInterface - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. & import("pkg", { assert: {"bad": "import"} }).ImportInterface; - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. ~~~~~~~~~~~~~~~ !!! 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 TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. export const b = (null as any as import("pkg", { assert: {"bad": "import"} }).ImportInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~~~~ - !!! 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 TS1455: `resolution-mode` is the only valid key for type import assertions. ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + ==== /other3.ts (16 errors) ==== @@= skipped -124, +116 lines =@@ !!! error TS1134: Variable declaration expected. ~ @@ -71,25 +87,31 @@ export type LocalInterface = & import("pkg", { assert: {} }).RequireInterface - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. & import("pkg", { assert: {} }).ImportInterface; - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. ~~~~~~~~~~~~~~~ !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. export const a = (null as any as import("pkg", { assert: {} }).RequireInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! 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 TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. export const b = (null as any as import("pkg", { assert: {} }).ImportInterface); - ~ --!!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. - ~~ - !!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. - ~~~~~~~~~~~~~~~ \ No newline at end of file ++ ~~~~~~ + !!! error TS2880: Import assertions have been replaced by import attributes. Use 'with' instead of 'assert'. +- ~~ +-!!! error TS1456: Type import assertions should have exactly one key - `resolution-mode` - with value `import` or `require`. + ~~~~~~~~~~~~~~~ + !!! error TS2694: Namespace '"/node_modules/pkg/require"' has no exported member 'ImportInterface'. + \ No newline at end of file