File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18702,10 +18702,7 @@ namespace ts {
1870218702 }
1870318703
1870418704 if (node.keywordToken === SyntaxKind.ImportKeyword) {
18705- const file = getSourceFileOfNode(node);
18706- Debug.assert(!!(file.flags & NodeFlags.PossiblyContainsImportMeta), "Containing file is missing import meta node flag.");
18707- Debug.assert(!!file.externalModuleIndicator, "Containing file should be a module.");
18708- return node.name.escapedText === "meta" ? getGlobalImportMetaType() : unknownType;
18705+ return checkImportMetaProperty(node);
1870918706 }
1871018707 }
1871118708
@@ -18725,6 +18722,16 @@ namespace ts {
1872518722 }
1872618723 }
1872718724
18725+ function checkImportMetaProperty(node: MetaProperty) {
18726+ if (languageVersion < ScriptTarget.ESNext && modulekind < ModuleKind.ESNext) {
18727+ error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
18728+ }
18729+ const file = getSourceFileOfNode(node);
18730+ Debug.assert(!!(file.flags & NodeFlags.PossiblyContainsImportMeta), "Containing file is missing import meta node flag.");
18731+ Debug.assert(!!file.externalModuleIndicator, "Containing file should be a module.");
18732+ return node.name.escapedText === "meta" ? getGlobalImportMetaType() : unknownType;
18733+ }
18734+
1872818735 function getTypeOfParameter(symbol: Symbol) {
1872918736 const type = getTypeOfSymbol(symbol);
1873018737 if (strictNullChecks) {
Original file line number Diff line number Diff line change 967967 "category" : " Error" ,
968968 "code" : 1342
969969 },
970+ "The 'import.meta' meta-property is only allowed using 'ESNext' for the 'target' and 'module' compiler options." : {
971+ "category" : " Error" ,
972+ "code" : 1343
973+ },
970974
971975 "Duplicate identifier '{0}'." : {
972976 "category" : " Error" ,
You can’t perform that action at this time.
0 commit comments