mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Allow dynamic import attributes in --module preserve (#59005)
This commit is contained in:
@@ -51914,13 +51914,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
|
||||
const nodeArguments = node.arguments;
|
||||
if (moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.NodeNext && moduleKind !== ModuleKind.Node16) {
|
||||
if (moduleKind !== ModuleKind.ESNext && moduleKind !== ModuleKind.NodeNext && moduleKind !== ModuleKind.Node16 && moduleKind !== ModuleKind.Preserve) {
|
||||
// We are allowed trailing comma after proposal-import-assertions.
|
||||
checkGrammarForDisallowedTrailingComma(nodeArguments);
|
||||
|
||||
if (nodeArguments.length > 1) {
|
||||
const importAttributesArgument = nodeArguments[1];
|
||||
return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_or_nodenext);
|
||||
return grammarErrorOnNode(importAttributesArgument, Diagnostics.Dynamic_imports_only_support_a_second_argument_when_the_module_option_is_set_to_esnext_node16_nodenext_or_preserve);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1028,7 +1028,7 @@
|
||||
"category": "Error",
|
||||
"code": 1323
|
||||
},
|
||||
"Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', or 'nodenext'.": {
|
||||
"Dynamic imports only support a second argument when the '--module' option is set to 'esnext', 'node16', 'nodenext', or 'preserve'.": {
|
||||
"category": "Error",
|
||||
"code": 1324
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user