File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24641,24 +24641,24 @@ namespace ts {
2464124641 }
2464224642
2464324643 function checkGrammarImportCallExpression(node: ImportCall): boolean {
24644- const arguments = node.arguments;
24645- if (arguments.length !== 1) {
24646- return grammarErrorOnNode(node, Diagnostics.Dynamic_import_must_have_one_specifier_as_an_argument);
24644+ if (modulekind === ModuleKind.ES2015) {
24645+ return grammarErrorOnNode(node, Diagnostics.Dynamic_import_cannot_be_used_when_targeting_ECMAScript_2015_modules);
2464724646 }
2464824647
2464924648 if (node.typeArguments) {
2465024649 return grammarErrorOnNode(node, Diagnostics.Dynamic_import_cannot_have_type_arguments);
2465124650 }
2465224651
24652+ const arguments = node.arguments;
24653+ if (arguments.length !== 1) {
24654+ return grammarErrorOnNode(node, Diagnostics.Dynamic_import_must_have_one_specifier_as_an_argument);
24655+ }
24656+
2465324657 // see: parseArgumentOrArrayLiteralElement...we use this function which parse arguments of callExpression to parse specifier for dynamic import.
2465424658 // parseArgumentOrArrayLiteralElement allows spread element to be in an argument list which is not allowed as specifier in dynamic import.
2465524659 if (isSpreadExpression(arguments[0])) {
2465624660 return grammarErrorOnNode(arguments[0], Diagnostics.Specifier_of_dynamic_import_cannot_be_spread_element);
2465724661 }
24658-
24659- if (modulekind === ModuleKind.ES2015) {
24660- grammarErrorOnNode(node, Diagnostics.Dynamic_import_cannot_be_used_when_targeting_ECMAScript_2015_modules);
24661- }
2466224662 }
2466324663 }
2466424664
You can’t perform that action at this time.
0 commit comments