Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import assertion #40698

Merged
merged 37 commits into from
Sep 20, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e1b3b78
Add parsing
Kingwl Sep 22, 2020
66d2273
fix all api
Kingwl Sep 22, 2020
5f3cea6
check gramma of import call
Kingwl Sep 22, 2020
5a1af04
Add more part of assertion
Kingwl Sep 22, 2020
4b51ca9
Add some case
Kingwl Sep 22, 2020
375b433
Add baseline
Kingwl Sep 22, 2020
41a881c
use module insted of target
Kingwl Sep 23, 2020
46a3eb1
strip assertion in d.ts
Kingwl Sep 23, 2020
a484ea2
Merge branch 'master' into import_assertion
Kingwl Sep 23, 2020
d64f7ba
Merge branch 'master' into import_assertion
Kingwl Nov 12, 2020
68c8c5d
Merge branch 'master' into import_assertion
Kingwl Dec 31, 2020
29fe0d3
Merge branch 'master' into import_assertion
Kingwl Jan 7, 2021
adcfd1b
Update new baseline
Kingwl Jan 7, 2021
fb01eb3
Merge branch 'master' into import_assertion
Kingwl Mar 8, 2021
4f22a60
accept baseline
Kingwl Mar 8, 2021
f5e594d
Revert error number changes
Kingwl Mar 9, 2021
60434d1
Update diagnostic message
Kingwl Mar 9, 2021
ff87d3e
Accept baseline
Kingwl Mar 9, 2021
43b67b9
Merge branch 'master' into import_assertion
Kingwl Mar 15, 2021
c69a05b
rename path
Kingwl Mar 15, 2021
d1c48b5
Fix cr issues
Kingwl Mar 15, 2021
d14f93a
Accept baseline
Kingwl Mar 15, 2021
aa8b856
Accept baseline
Kingwl Mar 15, 2021
7a5ec34
Merge branch 'master' into import_assertion
Kingwl Mar 18, 2021
9cea9cf
Error if assertion and typeonly import
Kingwl Mar 18, 2021
6337a7e
Merge branch 'main' into import_assertion
Kingwl Jun 17, 2021
eee2cab
Accept baseline
Kingwl Jun 17, 2021
2857d69
Merge branch 'main' into import_assertion
Kingwl Jul 9, 2021
88e39d5
Make lint happy
Kingwl Jul 9, 2021
f941d92
Merge branch 'main' into import_assertion
Kingwl Aug 13, 2021
106ff06
Add some comment
Kingwl Aug 13, 2021
7df4964
Merge branch 'main' into import_assertion
Kingwl Sep 14, 2021
6ea3c55
Fix cr issues
Kingwl Sep 14, 2021
fc51c42
Fix more issue
Kingwl Sep 14, 2021
bf7ca71
Incorporate PR feedback, fix module resolution for import()
rbuckton Sep 17, 2021
463138a
Merge branch 'main' into import_assertion
rbuckton Sep 17, 2021
b07c6e9
Add contextual type and completions for ImportCall options argument
rbuckton Sep 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 16 additions & 20 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39000,11 +39000,11 @@ namespace ts {
function checkAssertClause(declaration: ImportDeclaration | ExportDeclaration) {
if (declaration.assertClause) {
if (moduleKind !== ModuleKind.ESNext) {
error(declaration.assertClause, Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext);
return grammarErrorOnNode(declaration.assertClause, Diagnostics.Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext);
}

if (isImportDeclaration(declaration) ? declaration.importClause?.isTypeOnly : declaration.isTypeOnly) {
error(declaration.assertClause, Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
return grammarErrorOnNode(declaration.assertClause, Diagnostics.Import_assertions_cannot_be_used_with_type_only_imports_or_exports);
}
}
}
Expand Down Expand Up @@ -43162,7 +43162,16 @@ namespace ts {
return false;
}

function checkGrammarImportCallArguments(node: ImportCall, nodeArguments: NodeArray<Expression>): boolean {
function checkGrammarImportCallExpression(node: ImportCall): boolean {
if (moduleKind === ModuleKind.ES2015) {
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_or_umd);
}

if (node.typeArguments) {
return grammarErrorOnNode(node, Diagnostics.Dynamic_import_cannot_have_type_arguments);
}

const nodeArguments = node.arguments;
if (moduleKind !== ModuleKind.ESNext) {
// We are allowed trailing comma after proposal-import-assertions.
checkGrammarForDisallowedTrailingComma(nodeArguments);
Expand All @@ -43172,28 +43181,15 @@ namespace ts {
return grammarErrorOnNode(assertionArgument, Diagnostics.Dynamic_import_only_supports_a_second_argument_when_the_module_option_is_set_to_esnext);
}
}
if (nodeArguments.length !== 1) {
return grammarErrorOnNode(node, Diagnostics.Dynamic_import_must_only_have_a_specifier_and_an_optional_assertion_as_arguments);
}
return false;
}

function checkGrammarImportCallExpression(node: ImportCall): boolean {
if (moduleKind === ModuleKind.ES2015) {
return grammarErrorOnNode(node, Diagnostics.Dynamic_imports_are_only_supported_when_the_module_flag_is_set_to_es2020_esnext_commonjs_amd_system_or_umd);
}

if (node.typeArguments) {
return grammarErrorOnNode(node, Diagnostics.Dynamic_import_cannot_have_type_arguments);
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: remove extra space

Suggested change
if (nodeArguments.length === 0 || nodeArguments.length > 2) {
if (nodeArguments.length === 0 || nodeArguments.length > 2) {

return grammarErrorOnNode(node, Diagnostics.Dynamic_import_must_only_have_a_specifier_and_an_optional_assertion_as_arguments);
}

const nodeArguments = node.arguments;
if (checkGrammarImportCallArguments(node, nodeArguments)) {
return true;
}
// see: parseArgumentOrArrayLiteralElement...we use this function which parse arguments of callExpression to parse specifier for dynamic import.
// parseArgumentOrArrayLiteralElement allows spread element to be in an argument list which is not allowed as specifier in dynamic import.
if (nodeArguments.length && isSpreadElement(nodeArguments[0])) {
const spreadElement = forEach(nodeArguments, isSpreadElement);
if (spreadElement) {
return grammarErrorOnNode(nodeArguments[0], Diagnostics.Specifier_of_dynamic_import_cannot_be_spread_element);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. This doesn't quite do what we want. We want to report the error on the spread element, not the first argument (which might not be the spread element). I think we want this instead:

Suggested change
const spreadElement = forEach(nodeArguments, isSpreadElement);
if (spreadElement) {
return grammarErrorOnNode(nodeArguments[0], Diagnostics.Specifier_of_dynamic_import_cannot_be_spread_element);
}
const spreadElement = find(nodeArguments, isSpreadElement);
if (spreadElement) {
return grammarErrorOnNode(spreadElement, Diagnostics.Specifier_of_dynamic_import_cannot_be_spread_element);
}

return false;
Expand Down
18 changes: 17 additions & 1 deletion src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -1372,9 +1372,25 @@
"category": "Error",
"code": 1443
},
"'{0}' is a type and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled.": {
"category": "Error",
"code": 1444
},
"'{0}' resolves to a type-only declaration and must be imported using a type-only import when 'preserveValueImports' and 'isolatedModules' are both enabled.": {
"category": "Error",
"code": 1446
},
"'{0}' resolves to a type-only declaration and must be re-exported using a type-only re-export when 'isolatedModules' is enabled.": {
"category": "Error",
"code": 1448
},
"Preserve unused imported values in the JavaScript output that would otherwise be removed.": {
"category": "Message",
"code": 1449
},
"Dynamic import must only have a specifier and an optional assertion as arguments": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Dynamic import must only have a specifier and an optional assertion as arguments": {
"Dynamic imports can only accept a path and an optional assertion as arguments": {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, but I think module specifier is a more correct term than path

"category": "Message",
"code": 1444
"code": 1450
},

"The types of '{0}' are incompatible between these types.": {
Expand Down
6 changes: 2 additions & 4 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3327,8 +3327,7 @@ namespace ts {
}
emitExpression(node.moduleSpecifier);
if (node.assertClause) {
writeSpace();
emit(node.assertClause);
emitWithLeadingSpace(node.assertClause);
}
writeTrailingSemicolon();
}
Expand Down Expand Up @@ -3399,8 +3398,7 @@ namespace ts {
emitExpression(node.moduleSpecifier);
}
if (node.assertClause) {
writeSpace();
emit(node.assertClause);
emitWithLeadingSpace(node.assertClause);
}
writeTrailingSemicolon();
}
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7341,8 +7341,8 @@ namespace ts {
updateNamespaceExportDeclaration(node: NamespaceExportDeclaration, name: Identifier): NamespaceExportDeclaration;
createImportEqualsDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: string | Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
updateImportEqualsDeclaration(node: ImportEqualsDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, name: Identifier, moduleReference: ModuleReference): ImportEqualsDeclaration;
createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration;
updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause: AssertClause | undefined): ImportDeclaration;
createImportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration;
updateImportDeclaration(node: ImportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, importClause: ImportClause | undefined, moduleSpecifier: Expression, assertClause?: AssertClause): ImportDeclaration;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would leave | undefined here instead of adding ?. My previous comment was specific to the create. For a create, there's no sense breaking existing code because they weren't previously passing an argument. For an update, we do want to break existing code because there's now a new node they may not be appropriately handling.

createImportClause(isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
updateImportClause(node: ImportClause, isTypeOnly: boolean, name: Identifier | undefined, namedBindings: NamedImportBindings | undefined): ImportClause;
createAssertClause(elements: NodeArray<AssertEntry>, multiLine?: boolean): AssertClause;
Expand All @@ -7360,7 +7360,7 @@ namespace ts {
createExportAssignment(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isExportEquals: boolean | undefined, expression: Expression): ExportAssignment;
updateExportAssignment(node: ExportAssignment, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, expression: Expression): ExportAssignment;
createExportDeclaration(decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier?: Expression, assertClause?: AssertClause): ExportDeclaration;
updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause: AssertClause | undefined): ExportDeclaration;
updateExportDeclaration(node: ExportDeclaration, decorators: readonly Decorator[] | undefined, modifiers: readonly Modifier[] | undefined, isTypeOnly: boolean, exportClause: NamedExportBindings | undefined, moduleSpecifier: Expression | undefined, assertClause?: AssertClause): ExportDeclaration;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also would leave | undefined here. We want to break callers here since they could be forgetting to handle a node they weren't previously handling.

createNamedExports(elements: readonly ExportSpecifier[]): NamedExports;
updateNamedExports(node: NamedExports, elements: readonly ExportSpecifier[]): NamedExports;
createExportSpecifier(propertyName: string | Identifier | undefined, name: string | Identifier): ExportSpecifier;
Expand Down
1 change: 0 additions & 1 deletion src/compiler/utilitiesPublic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,6 @@ namespace ts {
/* @internal */
export function isAssignmentPattern(node: Node): node is AssignmentPattern {
const kind = node.kind;

return kind === SyntaxKind.ArrayLiteralExpression
|| kind === SyntaxKind.ObjectLiteralExpression;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/api/tsserverlibrary.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4368,7 +4368,7 @@ declare namespace ts {
function isTemplateLiteralToken(node: Node): node is TemplateLiteralToken;
function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail;
function isImportOrExportSpecifier(node: Node): node is ImportSpecifier | ExportSpecifier;
function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyCompatibleAliasDeclaration;
function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyAliasDeclaration;
function isAssertionKey(node: Node): node is AssertionKey;
function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken;
function isModifier(node: Node): node is Modifier;
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/api/typescript.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4368,7 +4368,7 @@ declare namespace ts {
function isTemplateLiteralToken(node: Node): node is TemplateLiteralToken;
function isTemplateMiddleOrTemplateTail(node: Node): node is TemplateMiddle | TemplateTail;
function isImportOrExportSpecifier(node: Node): node is ImportSpecifier | ExportSpecifier;
function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyCompatibleAliasDeclaration;
function isTypeOnlyImportOrExportDeclaration(node: Node): node is TypeOnlyAliasDeclaration;
function isAssertionKey(node: Node): node is AssertionKey;
function isStringTextContainingNode(node: Node): node is StringLiteral | TemplateLiteralToken;
function isModifier(node: Node): node is Modifier;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ tests/cases/conformance/importAssertion/3.ts(3,25): error TS1324: Dynamic import
tests/cases/conformance/importAssertion/3.ts(4,25): error TS1324: Dynamic import only supports a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(5,26): error TS1324: Dynamic import only supports a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(7,25): error TS1324: Dynamic import only supports a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(8,11): message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(8,11): message TS1450: Dynamic import must only have a specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(9,25): error TS1324: Dynamic import only supports a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(10,25): error TS1324: Dynamic import only supports a second argument when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/3.ts(10,52): error TS1009: Trailing comma not allowed.
Expand Down Expand Up @@ -65,7 +65,7 @@ tests/cases/conformance/importAssertion/3.ts(10,52): error TS1009: Trailing comm
!!! error TS1324: Dynamic import only supports a second argument when the '--module' option is set to 'esnext'.
const f = import()
~~~~~~~~
!!! message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
!!! message TS1450: Dynamic import must only have a specifier and an optional assertion as arguments
const g = import('./0', {}, {})
~~
!!! error TS1324: Dynamic import only supports a second argument when the '--module' option is set to 'esnext'.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
tests/cases/conformance/importAssertion/3.ts(2,11): message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(3,11): message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(4,11): message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(5,12): message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(7,11): message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(8,11): message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(9,11): message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(10,11): message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(8,11): message TS1450: Dynamic import must only have a specifier and an optional assertion as arguments
tests/cases/conformance/importAssertion/3.ts(9,11): message TS1450: Dynamic import must only have a specifier and an optional assertion as arguments


==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
Expand All @@ -29,32 +23,20 @@ tests/cases/conformance/importAssertion/3.ts(10,11): message TS1444: Dynamic imp
c;
d;

==== tests/cases/conformance/importAssertion/3.ts (8 errors) ====
==== tests/cases/conformance/importAssertion/3.ts (2 errors) ====
const a = import('./0')
const b = import('./0', { assert: { type: "json" } })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
const c = import('./0', { assert: { type: "json", ttype: "typo" } })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
const d = import('./0', { assert: {} })
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
const dd = import('./0', {})
~~~~~~~~~~~~~~~~~
!!! message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
declare function foo(): any;
const e = import('./0', foo())
~~~~~~~~~~~~~~~~~~~~
!!! message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
const f = import()
~~~~~~~~
!!! message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
!!! message TS1450: Dynamic import must only have a specifier and an optional assertion as arguments
const g = import('./0', {}, {})
~~~~~~~~~~~~~~~~~~~~~
!!! message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments
!!! message TS1450: Dynamic import must only have a specifier and an optional assertion as arguments
const h = import('./0', { assert: { type: "json" }},)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! message TS1444: Dynamic import must only have a specifier and an optional assertion as arguments


Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
tests/cases/conformance/importAssertion/1.ts(1,27): error TS2820: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(1,27): error TS2821: Import assertions cannot be used with type-only imports or exports.
tests/cases/conformance/importAssertion/1.ts(2,30): error TS2820: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/1.ts(2,30): error TS2821: Import assertions cannot be used with type-only imports or exports.
tests/cases/conformance/importAssertion/2.ts(1,31): error TS2820: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(1,31): error TS2821: Import assertions cannot be used with type-only imports or exports.
tests/cases/conformance/importAssertion/2.ts(2,33): error TS2820: Import assertions are only supported when the '--module' option is set to 'esnext'.
tests/cases/conformance/importAssertion/2.ts(2,33): error TS2821: Import assertions cannot be used with type-only imports or exports.


==== tests/cases/conformance/importAssertion/0.ts (0 errors) ====
export interface I { }

==== tests/cases/conformance/importAssertion/1.ts (4 errors) ====
==== tests/cases/conformance/importAssertion/1.ts (2 errors) ====
export type {} from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2820: Import assertions are only supported when the '--module' option is set to 'esnext'.
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions cannot be used with type-only imports or exports.
export type { I } from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2820: Import assertions are only supported when the '--module' option is set to 'esnext'.
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions cannot be used with type-only imports or exports.

==== tests/cases/conformance/importAssertion/2.ts (4 errors) ====
==== tests/cases/conformance/importAssertion/2.ts (2 errors) ====
import type { I } from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2820: Import assertions are only supported when the '--module' option is set to 'esnext'.
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions cannot be used with type-only imports or exports.
import type * as foo from './0' assert { type: "json" }
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2820: Import assertions are only supported when the '--module' option is set to 'esnext'.
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2821: Import assertions cannot be used with type-only imports or exports.


Loading