mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-16 15:44:16 -06:00
'modulekind' -> 'moduleKind'
This commit is contained in:
parent
1ea269af87
commit
0feefab765
@ -64,7 +64,7 @@ namespace ts {
|
||||
|
||||
const compilerOptions = host.getCompilerOptions();
|
||||
const languageVersion = getEmitScriptTarget(compilerOptions);
|
||||
const modulekind = getEmitModuleKind(compilerOptions);
|
||||
const moduleKind = getEmitModuleKind(compilerOptions);
|
||||
const allowSyntheticDefaultImports = getAllowSyntheticDefaultImports(compilerOptions);
|
||||
const strictNullChecks = getStrictOptionValue(compilerOptions, "strictNullChecks");
|
||||
const strictFunctionTypes = getStrictOptionValue(compilerOptions, "strictFunctionTypes");
|
||||
@ -1085,7 +1085,7 @@ namespace ts {
|
||||
const declarationFile = getSourceFileOfNode(declaration);
|
||||
const useFile = getSourceFileOfNode(usage);
|
||||
if (declarationFile !== useFile) {
|
||||
if ((modulekind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||
|
||||
if ((moduleKind && (declarationFile.externalModuleIndicator || useFile.externalModuleIndicator)) ||
|
||||
(!compilerOptions.outFile && !compilerOptions.out) ||
|
||||
isInTypeQuery(usage) ||
|
||||
declaration.flags & NodeFlags.Ambient) {
|
||||
@ -18723,7 +18723,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkImportMetaProperty(node: MetaProperty) {
|
||||
if (languageVersion < ScriptTarget.ESNext && modulekind < ModuleKind.ESNext) {
|
||||
if (languageVersion < ScriptTarget.ESNext && moduleKind < ModuleKind.ESNext) {
|
||||
error(node, Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
|
||||
}
|
||||
const file = getSourceFileOfNode(node);
|
||||
@ -22329,7 +22329,7 @@ namespace ts {
|
||||
|
||||
function checkCollisionWithRequireExportsInGeneratedCode(node: Node, name: Identifier) {
|
||||
// No need to check for require or exports for ES6 modules and later
|
||||
if (modulekind >= ModuleKind.ES2015 || compilerOptions.noEmit) {
|
||||
if (moduleKind >= ModuleKind.ES2015 || compilerOptions.noEmit) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -24518,7 +24518,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (modulekind >= ModuleKind.ES2015 && !(node.flags & NodeFlags.Ambient)) {
|
||||
if (moduleKind >= ModuleKind.ES2015 && !(node.flags & NodeFlags.Ambient)) {
|
||||
// Import equals declaration is deprecated in es6 or above
|
||||
grammarErrorOnNode(node, Diagnostics.Import_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead);
|
||||
}
|
||||
@ -24556,7 +24556,7 @@ namespace ts {
|
||||
error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
||||
}
|
||||
|
||||
if (modulekind !== ModuleKind.System && modulekind !== ModuleKind.ES2015 && modulekind !== ModuleKind.ESNext) {
|
||||
if (moduleKind !== ModuleKind.System && moduleKind !== ModuleKind.ES2015 && moduleKind !== ModuleKind.ESNext) {
|
||||
checkExternalEmitHelpers(node, ExternalEmitHelpers.ExportStar);
|
||||
}
|
||||
}
|
||||
@ -24629,11 +24629,11 @@ namespace ts {
|
||||
}
|
||||
|
||||
if (node.isExportEquals && !(node.flags & NodeFlags.Ambient)) {
|
||||
if (modulekind >= ModuleKind.ES2015) {
|
||||
if (moduleKind >= ModuleKind.ES2015) {
|
||||
// export assignment is not supported in es6 modules
|
||||
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or_another_module_format_instead);
|
||||
}
|
||||
else if (modulekind === ModuleKind.System) {
|
||||
else if (moduleKind === ModuleKind.System) {
|
||||
// system modules does not support export assignment
|
||||
grammarErrorOnNode(node, Diagnostics.Export_assignment_is_not_supported_when_module_flag_is_system);
|
||||
}
|
||||
@ -27790,7 +27790,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkGrammarImportCallExpression(node: ImportCall): boolean {
|
||||
if (modulekind === ModuleKind.ES2015) {
|
||||
if (moduleKind === ModuleKind.ES2015) {
|
||||
return grammarErrorOnNode(node, Diagnostics.Dynamic_import_cannot_be_used_when_targeting_ECMAScript_2015_modules);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user