mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Update LKG.
This commit is contained in:
+146
-74
@@ -67,7 +67,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.versionMajorMinor = "3.6";
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
ts.version = ts.versionMajorMinor + ".3";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
ts.emptyArray = [];
|
||||
@@ -2058,8 +2058,9 @@ var ts;
|
||||
catch (e) {
|
||||
etwModule = undefined;
|
||||
}
|
||||
ts.perfLogger = etwModule ? etwModule : nullLogger;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
|
||||
ts.perfLogger = etwModule && etwModule.logEvent ? etwModule : nullLogger;
|
||||
var args = typeof process === "undefined" ? [] : process.argv;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(args));
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
@@ -19693,6 +19694,7 @@ var ts;
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_incremental_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "locale",
|
||||
@@ -19802,7 +19804,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowJs",
|
||||
@@ -19839,6 +19842,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "declarationMap",
|
||||
@@ -19847,6 +19851,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "emitDeclarationOnly",
|
||||
@@ -19854,6 +19859,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "sourceMap",
|
||||
@@ -19872,6 +19878,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "outDir",
|
||||
@@ -19899,6 +19906,7 @@ var ts;
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_project_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "tsBuildInfoFile",
|
||||
@@ -19908,6 +19916,7 @@ var ts;
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "removeComments",
|
||||
@@ -19924,6 +19933,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "importHelpers",
|
||||
@@ -19943,7 +19953,8 @@ var ts;
|
||||
name: "isolatedModules",
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule,
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "strict",
|
||||
@@ -20072,7 +20083,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "rootDirs",
|
||||
@@ -20085,7 +20097,8 @@ var ts;
|
||||
},
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "typeRoots",
|
||||
@@ -20109,7 +20122,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowSyntheticDefaultImports",
|
||||
@@ -20202,6 +20216,7 @@ var ts;
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "reactNamespace",
|
||||
@@ -20251,14 +20266,16 @@ var ts;
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts,
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "noResolve",
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files,
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "stripInternal",
|
||||
@@ -20294,6 +20311,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "preserveConstEnums",
|
||||
@@ -20309,7 +20327,8 @@ var ts;
|
||||
isFilePath: true,
|
||||
paramType: ts.Diagnostics.DIRECTORY,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "skipLibCheck",
|
||||
@@ -20390,6 +20409,9 @@ var ts;
|
||||
ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
|
||||
return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
|
||||
});
|
||||
ts.transpileOptionValueCompilerOptions = ts.optionDeclarations.filter(function (option) {
|
||||
return ts.hasProperty(option, "transpileOptionValue");
|
||||
});
|
||||
ts.buildOpts = __spreadArrays(ts.commonOptionsWithBuild, [
|
||||
{
|
||||
name: "verbose",
|
||||
@@ -24336,7 +24358,23 @@ var ts;
|
||||
if (isTopLevel) {
|
||||
bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
|
||||
var oldContainer = container;
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1:
|
||||
case 2:
|
||||
container = file;
|
||||
break;
|
||||
case 4:
|
||||
container = declName.parent.expression;
|
||||
break;
|
||||
case 3:
|
||||
container = declName.parent.expression.name;
|
||||
break;
|
||||
case 5:
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
break;
|
||||
case 0:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288, 788968);
|
||||
container = oldContainer;
|
||||
}
|
||||
@@ -34058,6 +34096,15 @@ var ts;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function extractIrreducible(types, flag) {
|
||||
if (ts.every(types, function (t) { return !!(t.flags & 1048576) && ts.some(t.types, function (tt) { return !!(tt.flags & flag); }); })) {
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = filterType(types[i], function (t) { return !(t.flags & flag); });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function intersectUnionsOfPrimitiveTypes(types) {
|
||||
var unionTypes;
|
||||
var index = ts.findIndex(types, function (t) { return !!(ts.getObjectFlags(t) & 131072); });
|
||||
@@ -34144,6 +34191,12 @@ var ts;
|
||||
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
|
||||
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 32768)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), undefinedType], 1, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 65536)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), nullType], 1, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else {
|
||||
var size = ts.reduceLeft(typeSet, function (n, t) { return n * (t.flags & 1048576 ? t.types.length : 1); }, 1);
|
||||
if (size >= 100000) {
|
||||
@@ -36395,7 +36448,7 @@ var ts;
|
||||
var isIntersectionConstituent = !!isApparentIntersectionConstituent;
|
||||
if (source.flags & 1048576) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068)) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068), isIntersectionConstituent) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068));
|
||||
}
|
||||
else {
|
||||
@@ -36418,7 +36471,7 @@ var ts;
|
||||
}
|
||||
}
|
||||
else if (source.flags & 2097152) {
|
||||
result = someTypeRelatedToType(source, target, false);
|
||||
result = someTypeRelatedToType(source, target, false, true);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 || target.flags & 66846720)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@@ -36661,14 +36714,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 && containsType(sourceTypes, target)) {
|
||||
return -1;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, undefined, isIntersectionConstituent);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@@ -37780,8 +37833,27 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (depth >= 5 && type.flags & 8388608) {
|
||||
var root = getRootObjectTypeFromIndexedAccessChain(type);
|
||||
var count = 0;
|
||||
for (var i = 0; i < depth; i++) {
|
||||
var t = stack[i];
|
||||
if (getRootObjectTypeFromIndexedAccessChain(t) === root) {
|
||||
count++;
|
||||
if (count >= 5)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function getRootObjectTypeFromIndexedAccessChain(type) {
|
||||
var t = type;
|
||||
while (t.flags & 8388608) {
|
||||
t = t.objectType;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
function isPropertyIdenticalTo(sourceProp, targetProp) {
|
||||
return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0;
|
||||
}
|
||||
@@ -38614,35 +38686,30 @@ var ts;
|
||||
return;
|
||||
}
|
||||
if (target.flags & 1048576) {
|
||||
if (source.flags & 1048576) {
|
||||
var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
target = getUnionType(targets);
|
||||
var _b = inferFromMatchingTypes(source.flags & 1048576 ? source.types : [source], target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
|
||||
return;
|
||||
if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
|
||||
return;
|
||||
target = getUnionType(targets);
|
||||
if (sources.length === 0) {
|
||||
var savePriority = priority;
|
||||
priority |= 1;
|
||||
inferFromTypes(source, target);
|
||||
priority = savePriority;
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
}
|
||||
else if (target.flags & 2097152 && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
|
||||
if (source.flags & 2097152) {
|
||||
var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
else if (target.flags & 2097152 && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t) || (isGenericMappedType(t) && !!getInferenceInfoForType(getHomomorphicTypeVariable(t) || neverType)); })) {
|
||||
if (!(source.flags & 1048576)) {
|
||||
var _d = inferFromMatchingTypes(source.flags & 2097152 ? source.types : [source], target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getIntersectionType(sources);
|
||||
target = getIntersectionType(targets);
|
||||
}
|
||||
else if (!(source.flags & 1048576)) {
|
||||
if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (target.flags & (8388608 | 33554432)) {
|
||||
target = getActualTypeVariable(target);
|
||||
@@ -38766,22 +38833,11 @@ var ts;
|
||||
visited.set(key, inferencePriority);
|
||||
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
|
||||
}
|
||||
function inferFromMatchingType(source, targets, matches) {
|
||||
var matched = false;
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
if (matches(source, t)) {
|
||||
inferFromTypes(source, t);
|
||||
matched = true;
|
||||
}
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
function inferFromMatchingTypes(sources, targets, matches) {
|
||||
var matchedSources;
|
||||
var matchedTargets;
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
|
||||
var s = sources_1[_a];
|
||||
if (matches(s, t)) {
|
||||
@@ -38835,8 +38891,8 @@ var ts;
|
||||
var sources = source.flags & 1048576 ? source.types : [source];
|
||||
var matched_1 = new Array(sources.length);
|
||||
var inferenceCircularity = false;
|
||||
for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
|
||||
var t = targets_3[_i];
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
nakedTypeVariable = t;
|
||||
typeVariableCount++;
|
||||
@@ -38862,8 +38918,8 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
|
||||
var t = targets_4[_a];
|
||||
for (var _a = 0, targets_3 = targets; _a < targets_3.length; _a++) {
|
||||
var t = targets_3[_a];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
typeVariableCount++;
|
||||
}
|
||||
@@ -38875,8 +38931,8 @@ var ts;
|
||||
if (targetFlags & 2097152 ? typeVariableCount === 1 : typeVariableCount > 0) {
|
||||
var savePriority = priority;
|
||||
priority |= 1;
|
||||
for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
|
||||
var t = targets_5[_b];
|
||||
for (var _b = 0, targets_4 = targets; _b < targets_4.length; _b++) {
|
||||
var t = targets_4[_b];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
inferFromTypes(source, t);
|
||||
}
|
||||
@@ -43255,7 +43311,7 @@ var ts;
|
||||
if (ts.isJsxOpeningLikeElement(node)) {
|
||||
if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "jsx should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -43267,7 +43323,7 @@ var ts;
|
||||
var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;
|
||||
if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage_1, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "this parameter should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1;
|
||||
@@ -43282,7 +43338,7 @@ var ts;
|
||||
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43292,7 +43348,7 @@ var ts;
|
||||
if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, undefined, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(errorNode, spreadType, restType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
@@ -56998,11 +57054,9 @@ var ts;
|
||||
function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {
|
||||
context.startLexicalEnvironment();
|
||||
statements = visitNodes(statements, visitor, ts.isStatement, start);
|
||||
if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {
|
||||
statements = ts.setTextRange(ts.createNodeArray(__spreadArrays([ts.createExpressionStatement(ts.createLiteral("use strict"))], statements)), statements);
|
||||
}
|
||||
var declarations = context.endLexicalEnvironment();
|
||||
return ts.setTextRange(ts.createNodeArray(ts.concatenate(declarations, statements)), statements);
|
||||
if (ensureUseStrict)
|
||||
statements = ts.ensureUseStrict(statements);
|
||||
return ts.mergeLexicalEnvironment(statements, context.endLexicalEnvironment());
|
||||
}
|
||||
ts.visitLexicalEnvironment = visitLexicalEnvironment;
|
||||
function visitParameterList(nodes, visitor, context, nodesVisitor) {
|
||||
@@ -70149,6 +70203,8 @@ var ts;
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
if (configFile.options.emitDeclarationOnly)
|
||||
return undefined;
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json");
|
||||
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir), isJsonFile ?
|
||||
".json" :
|
||||
@@ -70179,7 +70235,7 @@ var ts;
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json"))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
if (js && configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
@@ -70207,6 +70263,11 @@ var ts;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
if (ts.fileExtensionIs(inputFileName, ".json"))
|
||||
continue;
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
return getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
}
|
||||
}
|
||||
var buildInfoPath = getOutputPathForBuildInfo(configFile.options);
|
||||
if (buildInfoPath)
|
||||
@@ -77116,11 +77177,16 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var emitOutput = ts.getFileEmitOutput(programOfThisState, sourceFile, true, cancellationToken);
|
||||
if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) {
|
||||
latestSignature = computeHash(emitOutput.outputFiles[0].text);
|
||||
var emitOutput_1 = ts.getFileEmitOutput(programOfThisState, sourceFile, true, cancellationToken);
|
||||
var firstDts_1 = emitOutput_1.outputFiles &&
|
||||
programOfThisState.getCompilerOptions().declarationMap ?
|
||||
emitOutput_1.outputFiles.length > 1 ? emitOutput_1.outputFiles[1] : undefined :
|
||||
emitOutput_1.outputFiles.length > 0 ? emitOutput_1.outputFiles[0] : undefined;
|
||||
if (firstDts_1) {
|
||||
ts.Debug.assert(ts.fileExtensionIs(firstDts_1.name, ".d.ts"), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
||||
latestSignature = computeHash(firstDts_1.text);
|
||||
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
||||
updateExportedModules(sourceFile, emitOutput.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -77410,7 +77476,6 @@ var ts;
|
||||
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
||||
return affectedFile;
|
||||
}
|
||||
seenAffectedFiles.set(affectedFile.path, true);
|
||||
affectedFilesIndex++;
|
||||
}
|
||||
state.changedFilesSet.delete(state.currentChangedFilePath);
|
||||
@@ -77547,7 +77612,7 @@ var ts;
|
||||
fn(state, referencingFilePath);
|
||||
});
|
||||
}
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, isEmitResult) {
|
||||
if (isBuildInfoEmit) {
|
||||
state.emittedBuildInfo = true;
|
||||
}
|
||||
@@ -77557,6 +77622,9 @@ var ts;
|
||||
}
|
||||
else {
|
||||
state.seenAffectedFiles.set(affected.path, true);
|
||||
if (isEmitResult) {
|
||||
(state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
|
||||
}
|
||||
if (isPendingEmit) {
|
||||
state.affectedFilesPendingEmitIndex++;
|
||||
}
|
||||
@@ -77569,6 +77637,10 @@ var ts;
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
function toAffectedFileEmitResult(state, result, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, true);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
function getSemanticDiagnosticsOfFile(state, sourceFile, cancellationToken) {
|
||||
var path = sourceFile.path;
|
||||
if (state.semanticDiagnosticsPerFile) {
|
||||
@@ -77773,7 +77845,7 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
var affected_1 = ts.Debug.assertDefined(state.program);
|
||||
return toAffectedFileResult(state, affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1, false, true);
|
||||
return toAffectedFileEmitResult(state, affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1, false, true);
|
||||
}
|
||||
isPendingEmitFile = true;
|
||||
}
|
||||
@@ -77786,7 +77858,7 @@ var ts;
|
||||
affected = program;
|
||||
}
|
||||
}
|
||||
return toAffectedFileResult(state, ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
|
||||
return toAffectedFileEmitResult(state, ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
|
||||
}
|
||||
function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
|
||||
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
|
||||
@@ -77884,7 +77956,7 @@ var ts;
|
||||
compilerOptions: convertFromReusableCompilerOptions(program.options, toAbsolutePath),
|
||||
referencedMap: getMapOfReferencedSet(program.referencedMap, toPath),
|
||||
exportedModulesMap: getMapOfReferencedSet(program.exportedModulesMap, toPath),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return ts.isString(value) ? value : value[0]; }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toPath(ts.isString(value) ? value : value[0]); }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
hasReusableDiagnostic: true
|
||||
};
|
||||
return {
|
||||
|
||||
+177
-99
@@ -94,7 +94,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.6";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
ts.version = ts.versionMajorMinor + ".3";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -2434,9 +2434,10 @@ var ts;
|
||||
catch (e) {
|
||||
etwModule = undefined;
|
||||
}
|
||||
/** Performance logger that will generate ETW events if possible */
|
||||
ts.perfLogger = etwModule ? etwModule : nullLogger;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
|
||||
/** Performance logger that will generate ETW events if possible - check for `logEvent` member, as `etwModule` will be `{}` when browserified */
|
||||
ts.perfLogger = etwModule && etwModule.logEvent ? etwModule : nullLogger;
|
||||
var args = typeof process === "undefined" ? [] : process.argv;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(args));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
@@ -24413,6 +24414,7 @@ var ts;
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_incremental_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "locale",
|
||||
@@ -24524,7 +24526,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowJs",
|
||||
@@ -24561,6 +24564,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "declarationMap",
|
||||
@@ -24569,6 +24573,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "emitDeclarationOnly",
|
||||
@@ -24576,6 +24581,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "sourceMap",
|
||||
@@ -24594,6 +24600,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "outDir",
|
||||
@@ -24621,6 +24628,7 @@ var ts;
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_project_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "tsBuildInfoFile",
|
||||
@@ -24630,6 +24638,7 @@ var ts;
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "removeComments",
|
||||
@@ -24646,6 +24655,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "importHelpers",
|
||||
@@ -24665,7 +24675,8 @@ var ts;
|
||||
name: "isolatedModules",
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule,
|
||||
transpileOptionValue: true
|
||||
},
|
||||
// Strict Type Checks
|
||||
{
|
||||
@@ -24799,7 +24810,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
// this option can only be specified in tsconfig.json
|
||||
@@ -24814,7 +24826,8 @@ var ts;
|
||||
},
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "typeRoots",
|
||||
@@ -24838,7 +24851,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowSyntheticDefaultImports",
|
||||
@@ -24935,6 +24949,7 @@ var ts;
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "reactNamespace",
|
||||
@@ -24984,14 +24999,20 @@ var ts;
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts,
|
||||
// We are not returning a sourceFile for lib file when asked by the program,
|
||||
// so pass --noLib to avoid reporting a file not found error.
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "noResolve",
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files,
|
||||
// We are not doing a full typecheck, we are not resolving the whole context,
|
||||
// so pass --noResolve to avoid reporting missing file errors.
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "stripInternal",
|
||||
@@ -25027,6 +25048,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "preserveConstEnums",
|
||||
@@ -25042,7 +25064,8 @@ var ts;
|
||||
isFilePath: true,
|
||||
paramType: ts.Diagnostics.DIRECTORY,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "skipLibCheck",
|
||||
@@ -25129,6 +25152,10 @@ var ts;
|
||||
return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
|
||||
});
|
||||
/* @internal */
|
||||
ts.transpileOptionValueCompilerOptions = ts.optionDeclarations.filter(function (option) {
|
||||
return ts.hasProperty(option, "transpileOptionValue");
|
||||
});
|
||||
/* @internal */
|
||||
ts.buildOpts = __spreadArrays(ts.commonOptionsWithBuild, [
|
||||
{
|
||||
name: "verbose",
|
||||
@@ -29795,7 +29822,23 @@ var ts;
|
||||
if (isTopLevel) {
|
||||
bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
|
||||
var oldContainer = container;
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 2 /* ModuleExports */:
|
||||
container = file;
|
||||
break;
|
||||
case 4 /* ThisProperty */:
|
||||
container = declName.parent.expression;
|
||||
break;
|
||||
case 3 /* PrototypeProperty */:
|
||||
container = declName.parent.expression.name;
|
||||
break;
|
||||
case 5 /* Property */:
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
break;
|
||||
case 0 /* None */:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
container = oldContainer;
|
||||
}
|
||||
@@ -41018,6 +41061,15 @@ var ts;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function extractIrreducible(types, flag) {
|
||||
if (ts.every(types, function (t) { return !!(t.flags & 1048576 /* Union */) && ts.some(t.types, function (tt) { return !!(tt.flags & flag); }); })) {
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = filterType(types[i], function (t) { return !(t.flags & flag); });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// If the given list of types contains more than one union of primitive types, replace the
|
||||
// first with a union containing an intersection of those primitive types, then remove the
|
||||
// other unions and return true. Otherwise, do nothing and return false.
|
||||
@@ -41136,6 +41188,12 @@ var ts;
|
||||
// reduced we'll never reduce again, so this occurs at most once.
|
||||
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 32768 /* Undefined */)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), undefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 65536 /* Null */)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else {
|
||||
// We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of
|
||||
// the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain.
|
||||
@@ -43656,7 +43714,7 @@ var ts;
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */)) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */), isIntersectionConstituent) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */));
|
||||
}
|
||||
else {
|
||||
@@ -43694,7 +43752,7 @@ var ts;
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false);
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false, /*isIntersectionConstituent*/ true);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 /* StructuredOrInstantiable */ || target.flags & 66846720 /* StructuredOrInstantiable */)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@@ -43963,14 +44021,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 /* Union */ && containsType(sourceTypes, target)) {
|
||||
return -1 /* True */;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, /*headMessage*/ undefined, isIntersectionConstituent);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@@ -45270,6 +45328,9 @@ var ts;
|
||||
// though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely
|
||||
// expanding. Effectively, we will generate a false positive when two types are structurally equal to at least 5
|
||||
// levels, but unequal at some level beyond that.
|
||||
// In addition, this will also detect when an indexed access has been chained off of 5 or more times (which is essentially
|
||||
// the dual of the structural comparison), and likewise mark the type as deeply nested, potentially adding false positives
|
||||
// for finite but deeply expanding indexed accesses (eg, for `Q[P1][P2][P3][P4][P5]`).
|
||||
function isDeeplyNestedType(type, stack, depth) {
|
||||
// We track all object types that have an associated symbol (representing the origin of the type)
|
||||
if (depth >= 5 && type.flags & 524288 /* Object */) {
|
||||
@@ -45286,8 +45347,30 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (depth >= 5 && type.flags & 8388608 /* IndexedAccess */) {
|
||||
var root = getRootObjectTypeFromIndexedAccessChain(type);
|
||||
var count = 0;
|
||||
for (var i = 0; i < depth; i++) {
|
||||
var t = stack[i];
|
||||
if (getRootObjectTypeFromIndexedAccessChain(t) === root) {
|
||||
count++;
|
||||
if (count >= 5)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Gets the leftmost object type in a chain of indexed accesses, eg, in A[P][Q], returns A
|
||||
*/
|
||||
function getRootObjectTypeFromIndexedAccessChain(type) {
|
||||
var t = type;
|
||||
while (t.flags & 8388608 /* IndexedAccess */) {
|
||||
t = t.objectType;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
function isPropertyIdenticalTo(sourceProp, targetProp) {
|
||||
return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
|
||||
}
|
||||
@@ -46231,45 +46314,47 @@ var ts;
|
||||
return;
|
||||
}
|
||||
if (target.flags & 1048576 /* Union */) {
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
// First, infer between identically matching source and target constituents and remove the
|
||||
// matching types.
|
||||
var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
// Next, infer between closely matching source and target constituents and remove
|
||||
// the matching types. Types closely match when they are instantiations of the same
|
||||
// object type or instantiations of the same type alias.
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
target = getUnionType(targets);
|
||||
// First, infer between identically matching source and target constituents and remove the
|
||||
// matching types.
|
||||
var _b = inferFromMatchingTypes(source.flags & 1048576 /* Union */ ? source.types : [source], target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
// Next, infer between closely matching source and target constituents and remove
|
||||
// the matching types. Types closely match when they are instantiations of the same
|
||||
// object type or instantiations of the same type alias.
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
|
||||
return;
|
||||
if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
|
||||
return;
|
||||
target = getUnionType(targets);
|
||||
if (sources.length === 0) {
|
||||
// All source constituents have been matched and there is nothing further to infer from.
|
||||
// However, simply making no inferences is undesirable because it could ultimately mean
|
||||
// inferring a type parameter constraint. Instead, make a lower priority inference from
|
||||
// the full source to whatever remains in the target. For example, when inferring from
|
||||
// string to 'string | T', make a lower priority inference of string for T.
|
||||
var savePriority = priority;
|
||||
priority |= 1 /* NakedTypeVariable */;
|
||||
inferFromTypes(source, target);
|
||||
priority = savePriority;
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
}
|
||||
else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
|
||||
else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t) || (isGenericMappedType(t) && !!getInferenceInfoForType(getHomomorphicTypeVariable(t) || neverType)); })) {
|
||||
// We reduce intersection types only when they contain naked type parameters. For example, when
|
||||
// inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and
|
||||
// infer { extra: any } for T. But when inferring to 'string[] & Iterable<T>' we want to keep the
|
||||
// string[] on the source side and infer string for T.
|
||||
if (source.flags & 2097152 /* Intersection */) {
|
||||
// Likewise, we consider a homomorphic mapped type constrainted to the target type parameter as similar to a "naked type variable"
|
||||
// in such scenarios.
|
||||
if (!(source.flags & 1048576 /* Union */)) {
|
||||
// Infer between identically matching source and target constituents and remove the matching types.
|
||||
var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
var _d = inferFromMatchingTypes(source.flags & 2097152 /* Intersection */ ? source.types : [source], target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getIntersectionType(sources);
|
||||
target = getIntersectionType(targets);
|
||||
}
|
||||
else if (!(source.flags & 1048576 /* Union */)) {
|
||||
if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
|
||||
target = getActualTypeVariable(target);
|
||||
@@ -46417,22 +46502,11 @@ var ts;
|
||||
visited.set(key, inferencePriority);
|
||||
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
|
||||
}
|
||||
function inferFromMatchingType(source, targets, matches) {
|
||||
var matched = false;
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
if (matches(source, t)) {
|
||||
inferFromTypes(source, t);
|
||||
matched = true;
|
||||
}
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
function inferFromMatchingTypes(sources, targets, matches) {
|
||||
var matchedSources;
|
||||
var matchedTargets;
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
|
||||
var s = sources_1[_a];
|
||||
if (matches(s, t)) {
|
||||
@@ -46490,8 +46564,8 @@ var ts;
|
||||
// track whether inferences were made from that particular type to some target with
|
||||
// equal priority (i.e. of equal quality) to what we would infer for a naked type
|
||||
// parameter.
|
||||
for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
|
||||
var t = targets_3[_i];
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
nakedTypeVariable = t;
|
||||
typeVariableCount++;
|
||||
@@ -46524,8 +46598,8 @@ var ts;
|
||||
// We infer from types that are not naked type variables first so that inferences we
|
||||
// make from nested naked type variables and given slightly higher priority by virtue
|
||||
// of being first in the candidates array.
|
||||
for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
|
||||
var t = targets_4[_a];
|
||||
for (var _a = 0, targets_3 = targets; _a < targets_3.length; _a++) {
|
||||
var t = targets_3[_a];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
typeVariableCount++;
|
||||
}
|
||||
@@ -46541,8 +46615,8 @@ var ts;
|
||||
if (targetFlags & 2097152 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) {
|
||||
var savePriority = priority;
|
||||
priority |= 1 /* NakedTypeVariable */;
|
||||
for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
|
||||
var t = targets_5[_b];
|
||||
for (var _b = 0, targets_4 = targets; _b < targets_4.length; _b++) {
|
||||
var t = targets_4[_b];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
inferFromTypes(source, t);
|
||||
}
|
||||
@@ -51750,7 +51824,7 @@ var ts;
|
||||
if (ts.isJsxOpeningLikeElement(node)) {
|
||||
if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "jsx should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -51765,7 +51839,7 @@ var ts;
|
||||
var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;
|
||||
if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage_1, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "this parameter should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1;
|
||||
@@ -51783,7 +51857,7 @@ var ts;
|
||||
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51793,7 +51867,7 @@ var ts;
|
||||
if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, /*containingMessageChain*/ undefined, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(errorNode, spreadType, restType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
@@ -67606,11 +67680,9 @@ var ts;
|
||||
function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {
|
||||
context.startLexicalEnvironment();
|
||||
statements = visitNodes(statements, visitor, ts.isStatement, start);
|
||||
if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {
|
||||
statements = ts.setTextRange(ts.createNodeArray(__spreadArrays([ts.createExpressionStatement(ts.createLiteral("use strict"))], statements)), statements);
|
||||
}
|
||||
var declarations = context.endLexicalEnvironment();
|
||||
return ts.setTextRange(ts.createNodeArray(ts.concatenate(declarations, statements)), statements);
|
||||
if (ensureUseStrict)
|
||||
statements = ts.ensureUseStrict(statements); // tslint:disable-line no-unnecessary-qualifier
|
||||
return ts.mergeLexicalEnvironment(statements, context.endLexicalEnvironment());
|
||||
}
|
||||
ts.visitLexicalEnvironment = visitLexicalEnvironment;
|
||||
/**
|
||||
@@ -86110,6 +86182,8 @@ var ts;
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
if (configFile.options.emitDeclarationOnly)
|
||||
return undefined;
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
||||
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir), isJsonFile ?
|
||||
".json" /* Json */ :
|
||||
@@ -86141,7 +86215,7 @@ var ts;
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
if (js && configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
@@ -86170,6 +86244,11 @@ var ts;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
return getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
}
|
||||
}
|
||||
var buildInfoPath = getOutputPathForBuildInfo(configFile.options);
|
||||
if (buildInfoPath)
|
||||
@@ -93878,11 +93957,16 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var emitOutput = ts.getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken);
|
||||
if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) {
|
||||
latestSignature = computeHash(emitOutput.outputFiles[0].text);
|
||||
var emitOutput_1 = ts.getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken);
|
||||
var firstDts_1 = emitOutput_1.outputFiles &&
|
||||
programOfThisState.getCompilerOptions().declarationMap ?
|
||||
emitOutput_1.outputFiles.length > 1 ? emitOutput_1.outputFiles[1] : undefined :
|
||||
emitOutput_1.outputFiles.length > 0 ? emitOutput_1.outputFiles[0] : undefined;
|
||||
if (firstDts_1) {
|
||||
ts.Debug.assert(ts.fileExtensionIs(firstDts_1.name, ".d.ts" /* Dts */), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
||||
latestSignature = computeHash(firstDts_1.text);
|
||||
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
||||
updateExportedModules(sourceFile, emitOutput.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -94257,7 +94341,6 @@ var ts;
|
||||
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
||||
return affectedFile;
|
||||
}
|
||||
seenAffectedFiles.set(affectedFile.path, true);
|
||||
affectedFilesIndex++;
|
||||
}
|
||||
// Remove the changed file from the change set
|
||||
@@ -94447,7 +94530,7 @@ var ts;
|
||||
* This is called after completing operation on the next affected file.
|
||||
* The operations here are postponed to ensure that cancellation during the iteration is handled correctly
|
||||
*/
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, isEmitResult) {
|
||||
if (isBuildInfoEmit) {
|
||||
state.emittedBuildInfo = true;
|
||||
}
|
||||
@@ -94457,6 +94540,9 @@ var ts;
|
||||
}
|
||||
else {
|
||||
state.seenAffectedFiles.set(affected.path, true);
|
||||
if (isEmitResult) {
|
||||
(state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
|
||||
}
|
||||
if (isPendingEmit) {
|
||||
state.affectedFilesPendingEmitIndex++;
|
||||
}
|
||||
@@ -94472,6 +94558,13 @@ var ts;
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
/**
|
||||
* Returns the result with affected file
|
||||
*/
|
||||
function toAffectedFileEmitResult(state, result, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, /*isEmitResult*/ true);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
/**
|
||||
* Gets the semantic diagnostics either from cache if present, or otherwise from program and caches it
|
||||
* Note that it is assumed that the when asked about semantic diagnostics, the file has been taken out of affected files/changed file set
|
||||
@@ -94701,7 +94794,7 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
var affected_1 = ts.Debug.assertDefined(state.program);
|
||||
return toAffectedFileResult(state,
|
||||
return toAffectedFileEmitResult(state,
|
||||
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
||||
// Otherwise just affected file
|
||||
affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1,
|
||||
@@ -94720,7 +94813,7 @@ var ts;
|
||||
affected = program;
|
||||
}
|
||||
}
|
||||
return toAffectedFileResult(state,
|
||||
return toAffectedFileEmitResult(state,
|
||||
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
||||
// Otherwise just affected file
|
||||
ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
|
||||
@@ -94860,7 +94953,7 @@ var ts;
|
||||
compilerOptions: convertFromReusableCompilerOptions(program.options, toAbsolutePath),
|
||||
referencedMap: getMapOfReferencedSet(program.referencedMap, toPath),
|
||||
exportedModulesMap: getMapOfReferencedSet(program.exportedModulesMap, toPath),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return ts.isString(value) ? value : value[0]; }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toPath(ts.isString(value) ? value : value[0]); }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
hasReusableDiagnostic: true
|
||||
};
|
||||
return {
|
||||
@@ -111841,29 +111934,14 @@ var ts;
|
||||
options[key] = defaultOptions[key];
|
||||
}
|
||||
}
|
||||
options.isolatedModules = true;
|
||||
for (var _i = 0, transpileOptionValueCompilerOptions_1 = ts.transpileOptionValueCompilerOptions; _i < transpileOptionValueCompilerOptions_1.length; _i++) {
|
||||
var option = transpileOptionValueCompilerOptions_1[_i];
|
||||
options[option.name] = option.transpileOptionValue;
|
||||
}
|
||||
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
|
||||
options.suppressOutputPathCheck = true;
|
||||
// Filename can be non-ts file.
|
||||
options.allowNonTsExtensions = true;
|
||||
// We are not returning a sourceFile for lib file when asked by the program,
|
||||
// so pass --noLib to avoid reporting a file not found error.
|
||||
options.noLib = true;
|
||||
// Clear out other settings that would not be used in transpiling this module
|
||||
options.lib = undefined;
|
||||
options.types = undefined;
|
||||
options.noEmit = undefined;
|
||||
options.noEmitOnError = undefined;
|
||||
options.paths = undefined;
|
||||
options.rootDirs = undefined;
|
||||
options.declaration = undefined;
|
||||
options.composite = undefined;
|
||||
options.declarationDir = undefined;
|
||||
options.out = undefined;
|
||||
options.outFile = undefined;
|
||||
// We are not doing a full typecheck, we are not resolving the whole context,
|
||||
// so pass --noResolve to avoid reporting missing file errors.
|
||||
options.noResolve = true;
|
||||
// if jsx is specified then treat file as .tsx
|
||||
var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts");
|
||||
var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217
|
||||
|
||||
+177
-99
@@ -93,7 +93,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.6";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
ts.version = ts.versionMajorMinor + ".3";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -2433,9 +2433,10 @@ var ts;
|
||||
catch (e) {
|
||||
etwModule = undefined;
|
||||
}
|
||||
/** Performance logger that will generate ETW events if possible */
|
||||
ts.perfLogger = etwModule ? etwModule : nullLogger;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
|
||||
/** Performance logger that will generate ETW events if possible - check for `logEvent` member, as `etwModule` will be `{}` when browserified */
|
||||
ts.perfLogger = etwModule && etwModule.logEvent ? etwModule : nullLogger;
|
||||
var args = typeof process === "undefined" ? [] : process.argv;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(args));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
@@ -24412,6 +24413,7 @@ var ts;
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_incremental_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "locale",
|
||||
@@ -24523,7 +24525,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowJs",
|
||||
@@ -24560,6 +24563,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "declarationMap",
|
||||
@@ -24568,6 +24572,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "emitDeclarationOnly",
|
||||
@@ -24575,6 +24580,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "sourceMap",
|
||||
@@ -24593,6 +24599,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "outDir",
|
||||
@@ -24620,6 +24627,7 @@ var ts;
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_project_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "tsBuildInfoFile",
|
||||
@@ -24629,6 +24637,7 @@ var ts;
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "removeComments",
|
||||
@@ -24645,6 +24654,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "importHelpers",
|
||||
@@ -24664,7 +24674,8 @@ var ts;
|
||||
name: "isolatedModules",
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule,
|
||||
transpileOptionValue: true
|
||||
},
|
||||
// Strict Type Checks
|
||||
{
|
||||
@@ -24798,7 +24809,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
// this option can only be specified in tsconfig.json
|
||||
@@ -24813,7 +24825,8 @@ var ts;
|
||||
},
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "typeRoots",
|
||||
@@ -24837,7 +24850,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowSyntheticDefaultImports",
|
||||
@@ -24934,6 +24948,7 @@ var ts;
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "reactNamespace",
|
||||
@@ -24983,14 +24998,20 @@ var ts;
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts,
|
||||
// We are not returning a sourceFile for lib file when asked by the program,
|
||||
// so pass --noLib to avoid reporting a file not found error.
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "noResolve",
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files,
|
||||
// We are not doing a full typecheck, we are not resolving the whole context,
|
||||
// so pass --noResolve to avoid reporting missing file errors.
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "stripInternal",
|
||||
@@ -25026,6 +25047,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "preserveConstEnums",
|
||||
@@ -25041,7 +25063,8 @@ var ts;
|
||||
isFilePath: true,
|
||||
paramType: ts.Diagnostics.DIRECTORY,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "skipLibCheck",
|
||||
@@ -25128,6 +25151,10 @@ var ts;
|
||||
return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
|
||||
});
|
||||
/* @internal */
|
||||
ts.transpileOptionValueCompilerOptions = ts.optionDeclarations.filter(function (option) {
|
||||
return ts.hasProperty(option, "transpileOptionValue");
|
||||
});
|
||||
/* @internal */
|
||||
ts.buildOpts = __spreadArrays(ts.commonOptionsWithBuild, [
|
||||
{
|
||||
name: "verbose",
|
||||
@@ -29794,7 +29821,23 @@ var ts;
|
||||
if (isTopLevel) {
|
||||
bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
|
||||
var oldContainer = container;
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 2 /* ModuleExports */:
|
||||
container = file;
|
||||
break;
|
||||
case 4 /* ThisProperty */:
|
||||
container = declName.parent.expression;
|
||||
break;
|
||||
case 3 /* PrototypeProperty */:
|
||||
container = declName.parent.expression.name;
|
||||
break;
|
||||
case 5 /* Property */:
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
break;
|
||||
case 0 /* None */:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
container = oldContainer;
|
||||
}
|
||||
@@ -41017,6 +41060,15 @@ var ts;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function extractIrreducible(types, flag) {
|
||||
if (ts.every(types, function (t) { return !!(t.flags & 1048576 /* Union */) && ts.some(t.types, function (tt) { return !!(tt.flags & flag); }); })) {
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = filterType(types[i], function (t) { return !(t.flags & flag); });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// If the given list of types contains more than one union of primitive types, replace the
|
||||
// first with a union containing an intersection of those primitive types, then remove the
|
||||
// other unions and return true. Otherwise, do nothing and return false.
|
||||
@@ -41135,6 +41187,12 @@ var ts;
|
||||
// reduced we'll never reduce again, so this occurs at most once.
|
||||
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 32768 /* Undefined */)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), undefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 65536 /* Null */)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else {
|
||||
// We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of
|
||||
// the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain.
|
||||
@@ -43655,7 +43713,7 @@ var ts;
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */)) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */), isIntersectionConstituent) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */));
|
||||
}
|
||||
else {
|
||||
@@ -43693,7 +43751,7 @@ var ts;
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false);
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false, /*isIntersectionConstituent*/ true);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 /* StructuredOrInstantiable */ || target.flags & 66846720 /* StructuredOrInstantiable */)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@@ -43962,14 +44020,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 /* Union */ && containsType(sourceTypes, target)) {
|
||||
return -1 /* True */;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, /*headMessage*/ undefined, isIntersectionConstituent);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@@ -45269,6 +45327,9 @@ var ts;
|
||||
// though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely
|
||||
// expanding. Effectively, we will generate a false positive when two types are structurally equal to at least 5
|
||||
// levels, but unequal at some level beyond that.
|
||||
// In addition, this will also detect when an indexed access has been chained off of 5 or more times (which is essentially
|
||||
// the dual of the structural comparison), and likewise mark the type as deeply nested, potentially adding false positives
|
||||
// for finite but deeply expanding indexed accesses (eg, for `Q[P1][P2][P3][P4][P5]`).
|
||||
function isDeeplyNestedType(type, stack, depth) {
|
||||
// We track all object types that have an associated symbol (representing the origin of the type)
|
||||
if (depth >= 5 && type.flags & 524288 /* Object */) {
|
||||
@@ -45285,8 +45346,30 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (depth >= 5 && type.flags & 8388608 /* IndexedAccess */) {
|
||||
var root = getRootObjectTypeFromIndexedAccessChain(type);
|
||||
var count = 0;
|
||||
for (var i = 0; i < depth; i++) {
|
||||
var t = stack[i];
|
||||
if (getRootObjectTypeFromIndexedAccessChain(t) === root) {
|
||||
count++;
|
||||
if (count >= 5)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Gets the leftmost object type in a chain of indexed accesses, eg, in A[P][Q], returns A
|
||||
*/
|
||||
function getRootObjectTypeFromIndexedAccessChain(type) {
|
||||
var t = type;
|
||||
while (t.flags & 8388608 /* IndexedAccess */) {
|
||||
t = t.objectType;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
function isPropertyIdenticalTo(sourceProp, targetProp) {
|
||||
return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
|
||||
}
|
||||
@@ -46230,45 +46313,47 @@ var ts;
|
||||
return;
|
||||
}
|
||||
if (target.flags & 1048576 /* Union */) {
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
// First, infer between identically matching source and target constituents and remove the
|
||||
// matching types.
|
||||
var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
// Next, infer between closely matching source and target constituents and remove
|
||||
// the matching types. Types closely match when they are instantiations of the same
|
||||
// object type or instantiations of the same type alias.
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
target = getUnionType(targets);
|
||||
// First, infer between identically matching source and target constituents and remove the
|
||||
// matching types.
|
||||
var _b = inferFromMatchingTypes(source.flags & 1048576 /* Union */ ? source.types : [source], target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
// Next, infer between closely matching source and target constituents and remove
|
||||
// the matching types. Types closely match when they are instantiations of the same
|
||||
// object type or instantiations of the same type alias.
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
|
||||
return;
|
||||
if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
|
||||
return;
|
||||
target = getUnionType(targets);
|
||||
if (sources.length === 0) {
|
||||
// All source constituents have been matched and there is nothing further to infer from.
|
||||
// However, simply making no inferences is undesirable because it could ultimately mean
|
||||
// inferring a type parameter constraint. Instead, make a lower priority inference from
|
||||
// the full source to whatever remains in the target. For example, when inferring from
|
||||
// string to 'string | T', make a lower priority inference of string for T.
|
||||
var savePriority = priority;
|
||||
priority |= 1 /* NakedTypeVariable */;
|
||||
inferFromTypes(source, target);
|
||||
priority = savePriority;
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
}
|
||||
else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
|
||||
else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t) || (isGenericMappedType(t) && !!getInferenceInfoForType(getHomomorphicTypeVariable(t) || neverType)); })) {
|
||||
// We reduce intersection types only when they contain naked type parameters. For example, when
|
||||
// inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and
|
||||
// infer { extra: any } for T. But when inferring to 'string[] & Iterable<T>' we want to keep the
|
||||
// string[] on the source side and infer string for T.
|
||||
if (source.flags & 2097152 /* Intersection */) {
|
||||
// Likewise, we consider a homomorphic mapped type constrainted to the target type parameter as similar to a "naked type variable"
|
||||
// in such scenarios.
|
||||
if (!(source.flags & 1048576 /* Union */)) {
|
||||
// Infer between identically matching source and target constituents and remove the matching types.
|
||||
var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
var _d = inferFromMatchingTypes(source.flags & 2097152 /* Intersection */ ? source.types : [source], target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getIntersectionType(sources);
|
||||
target = getIntersectionType(targets);
|
||||
}
|
||||
else if (!(source.flags & 1048576 /* Union */)) {
|
||||
if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
|
||||
target = getActualTypeVariable(target);
|
||||
@@ -46416,22 +46501,11 @@ var ts;
|
||||
visited.set(key, inferencePriority);
|
||||
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
|
||||
}
|
||||
function inferFromMatchingType(source, targets, matches) {
|
||||
var matched = false;
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
if (matches(source, t)) {
|
||||
inferFromTypes(source, t);
|
||||
matched = true;
|
||||
}
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
function inferFromMatchingTypes(sources, targets, matches) {
|
||||
var matchedSources;
|
||||
var matchedTargets;
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
|
||||
var s = sources_1[_a];
|
||||
if (matches(s, t)) {
|
||||
@@ -46489,8 +46563,8 @@ var ts;
|
||||
// track whether inferences were made from that particular type to some target with
|
||||
// equal priority (i.e. of equal quality) to what we would infer for a naked type
|
||||
// parameter.
|
||||
for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
|
||||
var t = targets_3[_i];
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
nakedTypeVariable = t;
|
||||
typeVariableCount++;
|
||||
@@ -46523,8 +46597,8 @@ var ts;
|
||||
// We infer from types that are not naked type variables first so that inferences we
|
||||
// make from nested naked type variables and given slightly higher priority by virtue
|
||||
// of being first in the candidates array.
|
||||
for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
|
||||
var t = targets_4[_a];
|
||||
for (var _a = 0, targets_3 = targets; _a < targets_3.length; _a++) {
|
||||
var t = targets_3[_a];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
typeVariableCount++;
|
||||
}
|
||||
@@ -46540,8 +46614,8 @@ var ts;
|
||||
if (targetFlags & 2097152 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) {
|
||||
var savePriority = priority;
|
||||
priority |= 1 /* NakedTypeVariable */;
|
||||
for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
|
||||
var t = targets_5[_b];
|
||||
for (var _b = 0, targets_4 = targets; _b < targets_4.length; _b++) {
|
||||
var t = targets_4[_b];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
inferFromTypes(source, t);
|
||||
}
|
||||
@@ -51749,7 +51823,7 @@ var ts;
|
||||
if (ts.isJsxOpeningLikeElement(node)) {
|
||||
if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "jsx should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -51764,7 +51838,7 @@ var ts;
|
||||
var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;
|
||||
if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage_1, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "this parameter should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1;
|
||||
@@ -51782,7 +51856,7 @@ var ts;
|
||||
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51792,7 +51866,7 @@ var ts;
|
||||
if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, /*containingMessageChain*/ undefined, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(errorNode, spreadType, restType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
@@ -67605,11 +67679,9 @@ var ts;
|
||||
function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {
|
||||
context.startLexicalEnvironment();
|
||||
statements = visitNodes(statements, visitor, ts.isStatement, start);
|
||||
if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {
|
||||
statements = ts.setTextRange(ts.createNodeArray(__spreadArrays([ts.createExpressionStatement(ts.createLiteral("use strict"))], statements)), statements);
|
||||
}
|
||||
var declarations = context.endLexicalEnvironment();
|
||||
return ts.setTextRange(ts.createNodeArray(ts.concatenate(declarations, statements)), statements);
|
||||
if (ensureUseStrict)
|
||||
statements = ts.ensureUseStrict(statements); // tslint:disable-line no-unnecessary-qualifier
|
||||
return ts.mergeLexicalEnvironment(statements, context.endLexicalEnvironment());
|
||||
}
|
||||
ts.visitLexicalEnvironment = visitLexicalEnvironment;
|
||||
/**
|
||||
@@ -86109,6 +86181,8 @@ var ts;
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
if (configFile.options.emitDeclarationOnly)
|
||||
return undefined;
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
||||
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir), isJsonFile ?
|
||||
".json" /* Json */ :
|
||||
@@ -86140,7 +86214,7 @@ var ts;
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
if (js && configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
@@ -86169,6 +86243,11 @@ var ts;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
return getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
}
|
||||
}
|
||||
var buildInfoPath = getOutputPathForBuildInfo(configFile.options);
|
||||
if (buildInfoPath)
|
||||
@@ -93877,11 +93956,16 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var emitOutput = ts.getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken);
|
||||
if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) {
|
||||
latestSignature = computeHash(emitOutput.outputFiles[0].text);
|
||||
var emitOutput_1 = ts.getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken);
|
||||
var firstDts_1 = emitOutput_1.outputFiles &&
|
||||
programOfThisState.getCompilerOptions().declarationMap ?
|
||||
emitOutput_1.outputFiles.length > 1 ? emitOutput_1.outputFiles[1] : undefined :
|
||||
emitOutput_1.outputFiles.length > 0 ? emitOutput_1.outputFiles[0] : undefined;
|
||||
if (firstDts_1) {
|
||||
ts.Debug.assert(ts.fileExtensionIs(firstDts_1.name, ".d.ts" /* Dts */), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
||||
latestSignature = computeHash(firstDts_1.text);
|
||||
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
||||
updateExportedModules(sourceFile, emitOutput.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -94256,7 +94340,6 @@ var ts;
|
||||
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
||||
return affectedFile;
|
||||
}
|
||||
seenAffectedFiles.set(affectedFile.path, true);
|
||||
affectedFilesIndex++;
|
||||
}
|
||||
// Remove the changed file from the change set
|
||||
@@ -94446,7 +94529,7 @@ var ts;
|
||||
* This is called after completing operation on the next affected file.
|
||||
* The operations here are postponed to ensure that cancellation during the iteration is handled correctly
|
||||
*/
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, isEmitResult) {
|
||||
if (isBuildInfoEmit) {
|
||||
state.emittedBuildInfo = true;
|
||||
}
|
||||
@@ -94456,6 +94539,9 @@ var ts;
|
||||
}
|
||||
else {
|
||||
state.seenAffectedFiles.set(affected.path, true);
|
||||
if (isEmitResult) {
|
||||
(state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
|
||||
}
|
||||
if (isPendingEmit) {
|
||||
state.affectedFilesPendingEmitIndex++;
|
||||
}
|
||||
@@ -94471,6 +94557,13 @@ var ts;
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
/**
|
||||
* Returns the result with affected file
|
||||
*/
|
||||
function toAffectedFileEmitResult(state, result, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, /*isEmitResult*/ true);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
/**
|
||||
* Gets the semantic diagnostics either from cache if present, or otherwise from program and caches it
|
||||
* Note that it is assumed that the when asked about semantic diagnostics, the file has been taken out of affected files/changed file set
|
||||
@@ -94700,7 +94793,7 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
var affected_1 = ts.Debug.assertDefined(state.program);
|
||||
return toAffectedFileResult(state,
|
||||
return toAffectedFileEmitResult(state,
|
||||
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
||||
// Otherwise just affected file
|
||||
affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1,
|
||||
@@ -94719,7 +94812,7 @@ var ts;
|
||||
affected = program;
|
||||
}
|
||||
}
|
||||
return toAffectedFileResult(state,
|
||||
return toAffectedFileEmitResult(state,
|
||||
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
||||
// Otherwise just affected file
|
||||
ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
|
||||
@@ -94859,7 +94952,7 @@ var ts;
|
||||
compilerOptions: convertFromReusableCompilerOptions(program.options, toAbsolutePath),
|
||||
referencedMap: getMapOfReferencedSet(program.referencedMap, toPath),
|
||||
exportedModulesMap: getMapOfReferencedSet(program.exportedModulesMap, toPath),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return ts.isString(value) ? value : value[0]; }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toPath(ts.isString(value) ? value : value[0]); }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
hasReusableDiagnostic: true
|
||||
};
|
||||
return {
|
||||
@@ -112204,29 +112297,14 @@ var ts;
|
||||
options[key] = defaultOptions[key];
|
||||
}
|
||||
}
|
||||
options.isolatedModules = true;
|
||||
for (var _i = 0, transpileOptionValueCompilerOptions_1 = ts.transpileOptionValueCompilerOptions; _i < transpileOptionValueCompilerOptions_1.length; _i++) {
|
||||
var option = transpileOptionValueCompilerOptions_1[_i];
|
||||
options[option.name] = option.transpileOptionValue;
|
||||
}
|
||||
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
|
||||
options.suppressOutputPathCheck = true;
|
||||
// Filename can be non-ts file.
|
||||
options.allowNonTsExtensions = true;
|
||||
// We are not returning a sourceFile for lib file when asked by the program,
|
||||
// so pass --noLib to avoid reporting a file not found error.
|
||||
options.noLib = true;
|
||||
// Clear out other settings that would not be used in transpiling this module
|
||||
options.lib = undefined;
|
||||
options.types = undefined;
|
||||
options.noEmit = undefined;
|
||||
options.noEmitOnError = undefined;
|
||||
options.paths = undefined;
|
||||
options.rootDirs = undefined;
|
||||
options.declaration = undefined;
|
||||
options.composite = undefined;
|
||||
options.declarationDir = undefined;
|
||||
options.out = undefined;
|
||||
options.outFile = undefined;
|
||||
// We are not doing a full typecheck, we are not resolving the whole context,
|
||||
// so pass --noResolve to avoid reporting missing file errors.
|
||||
options.noResolve = true;
|
||||
// if jsx is specified then treat file as .tsx
|
||||
var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts");
|
||||
var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217
|
||||
|
||||
+177
-99
@@ -82,7 +82,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.6";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
ts.version = ts.versionMajorMinor + ".3";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -2422,9 +2422,10 @@ var ts;
|
||||
catch (e) {
|
||||
etwModule = undefined;
|
||||
}
|
||||
/** Performance logger that will generate ETW events if possible */
|
||||
ts.perfLogger = etwModule ? etwModule : nullLogger;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
|
||||
/** Performance logger that will generate ETW events if possible - check for `logEvent` member, as `etwModule` will be `{}` when browserified */
|
||||
ts.perfLogger = etwModule && etwModule.logEvent ? etwModule : nullLogger;
|
||||
var args = typeof process === "undefined" ? [] : process.argv;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(args));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
@@ -24401,6 +24402,7 @@ var ts;
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_incremental_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "locale",
|
||||
@@ -24512,7 +24514,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowJs",
|
||||
@@ -24549,6 +24552,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "declarationMap",
|
||||
@@ -24557,6 +24561,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "emitDeclarationOnly",
|
||||
@@ -24564,6 +24569,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "sourceMap",
|
||||
@@ -24582,6 +24588,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "outDir",
|
||||
@@ -24609,6 +24616,7 @@ var ts;
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_project_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "tsBuildInfoFile",
|
||||
@@ -24618,6 +24626,7 @@ var ts;
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "removeComments",
|
||||
@@ -24634,6 +24643,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "importHelpers",
|
||||
@@ -24653,7 +24663,8 @@ var ts;
|
||||
name: "isolatedModules",
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule,
|
||||
transpileOptionValue: true
|
||||
},
|
||||
// Strict Type Checks
|
||||
{
|
||||
@@ -24787,7 +24798,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
// this option can only be specified in tsconfig.json
|
||||
@@ -24802,7 +24814,8 @@ var ts;
|
||||
},
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "typeRoots",
|
||||
@@ -24826,7 +24839,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowSyntheticDefaultImports",
|
||||
@@ -24923,6 +24937,7 @@ var ts;
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "reactNamespace",
|
||||
@@ -24972,14 +24987,20 @@ var ts;
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts,
|
||||
// We are not returning a sourceFile for lib file when asked by the program,
|
||||
// so pass --noLib to avoid reporting a file not found error.
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "noResolve",
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files,
|
||||
// We are not doing a full typecheck, we are not resolving the whole context,
|
||||
// so pass --noResolve to avoid reporting missing file errors.
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "stripInternal",
|
||||
@@ -25015,6 +25036,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "preserveConstEnums",
|
||||
@@ -25030,7 +25052,8 @@ var ts;
|
||||
isFilePath: true,
|
||||
paramType: ts.Diagnostics.DIRECTORY,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "skipLibCheck",
|
||||
@@ -25117,6 +25140,10 @@ var ts;
|
||||
return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
|
||||
});
|
||||
/* @internal */
|
||||
ts.transpileOptionValueCompilerOptions = ts.optionDeclarations.filter(function (option) {
|
||||
return ts.hasProperty(option, "transpileOptionValue");
|
||||
});
|
||||
/* @internal */
|
||||
ts.buildOpts = __spreadArrays(ts.commonOptionsWithBuild, [
|
||||
{
|
||||
name: "verbose",
|
||||
@@ -29783,7 +29810,23 @@ var ts;
|
||||
if (isTopLevel) {
|
||||
bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
|
||||
var oldContainer = container;
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 2 /* ModuleExports */:
|
||||
container = file;
|
||||
break;
|
||||
case 4 /* ThisProperty */:
|
||||
container = declName.parent.expression;
|
||||
break;
|
||||
case 3 /* PrototypeProperty */:
|
||||
container = declName.parent.expression.name;
|
||||
break;
|
||||
case 5 /* Property */:
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
break;
|
||||
case 0 /* None */:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
container = oldContainer;
|
||||
}
|
||||
@@ -41006,6 +41049,15 @@ var ts;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function extractIrreducible(types, flag) {
|
||||
if (ts.every(types, function (t) { return !!(t.flags & 1048576 /* Union */) && ts.some(t.types, function (tt) { return !!(tt.flags & flag); }); })) {
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = filterType(types[i], function (t) { return !(t.flags & flag); });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// If the given list of types contains more than one union of primitive types, replace the
|
||||
// first with a union containing an intersection of those primitive types, then remove the
|
||||
// other unions and return true. Otherwise, do nothing and return false.
|
||||
@@ -41124,6 +41176,12 @@ var ts;
|
||||
// reduced we'll never reduce again, so this occurs at most once.
|
||||
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 32768 /* Undefined */)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), undefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 65536 /* Null */)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else {
|
||||
// We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of
|
||||
// the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain.
|
||||
@@ -43644,7 +43702,7 @@ var ts;
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */)) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */), isIntersectionConstituent) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */));
|
||||
}
|
||||
else {
|
||||
@@ -43682,7 +43740,7 @@ var ts;
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false);
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false, /*isIntersectionConstituent*/ true);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 /* StructuredOrInstantiable */ || target.flags & 66846720 /* StructuredOrInstantiable */)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@@ -43951,14 +44009,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 /* Union */ && containsType(sourceTypes, target)) {
|
||||
return -1 /* True */;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, /*headMessage*/ undefined, isIntersectionConstituent);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@@ -45258,6 +45316,9 @@ var ts;
|
||||
// though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely
|
||||
// expanding. Effectively, we will generate a false positive when two types are structurally equal to at least 5
|
||||
// levels, but unequal at some level beyond that.
|
||||
// In addition, this will also detect when an indexed access has been chained off of 5 or more times (which is essentially
|
||||
// the dual of the structural comparison), and likewise mark the type as deeply nested, potentially adding false positives
|
||||
// for finite but deeply expanding indexed accesses (eg, for `Q[P1][P2][P3][P4][P5]`).
|
||||
function isDeeplyNestedType(type, stack, depth) {
|
||||
// We track all object types that have an associated symbol (representing the origin of the type)
|
||||
if (depth >= 5 && type.flags & 524288 /* Object */) {
|
||||
@@ -45274,8 +45335,30 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (depth >= 5 && type.flags & 8388608 /* IndexedAccess */) {
|
||||
var root = getRootObjectTypeFromIndexedAccessChain(type);
|
||||
var count = 0;
|
||||
for (var i = 0; i < depth; i++) {
|
||||
var t = stack[i];
|
||||
if (getRootObjectTypeFromIndexedAccessChain(t) === root) {
|
||||
count++;
|
||||
if (count >= 5)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Gets the leftmost object type in a chain of indexed accesses, eg, in A[P][Q], returns A
|
||||
*/
|
||||
function getRootObjectTypeFromIndexedAccessChain(type) {
|
||||
var t = type;
|
||||
while (t.flags & 8388608 /* IndexedAccess */) {
|
||||
t = t.objectType;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
function isPropertyIdenticalTo(sourceProp, targetProp) {
|
||||
return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
|
||||
}
|
||||
@@ -46219,45 +46302,47 @@ var ts;
|
||||
return;
|
||||
}
|
||||
if (target.flags & 1048576 /* Union */) {
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
// First, infer between identically matching source and target constituents and remove the
|
||||
// matching types.
|
||||
var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
// Next, infer between closely matching source and target constituents and remove
|
||||
// the matching types. Types closely match when they are instantiations of the same
|
||||
// object type or instantiations of the same type alias.
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
target = getUnionType(targets);
|
||||
// First, infer between identically matching source and target constituents and remove the
|
||||
// matching types.
|
||||
var _b = inferFromMatchingTypes(source.flags & 1048576 /* Union */ ? source.types : [source], target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
// Next, infer between closely matching source and target constituents and remove
|
||||
// the matching types. Types closely match when they are instantiations of the same
|
||||
// object type or instantiations of the same type alias.
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
|
||||
return;
|
||||
if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
|
||||
return;
|
||||
target = getUnionType(targets);
|
||||
if (sources.length === 0) {
|
||||
// All source constituents have been matched and there is nothing further to infer from.
|
||||
// However, simply making no inferences is undesirable because it could ultimately mean
|
||||
// inferring a type parameter constraint. Instead, make a lower priority inference from
|
||||
// the full source to whatever remains in the target. For example, when inferring from
|
||||
// string to 'string | T', make a lower priority inference of string for T.
|
||||
var savePriority = priority;
|
||||
priority |= 1 /* NakedTypeVariable */;
|
||||
inferFromTypes(source, target);
|
||||
priority = savePriority;
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
}
|
||||
else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
|
||||
else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t) || (isGenericMappedType(t) && !!getInferenceInfoForType(getHomomorphicTypeVariable(t) || neverType)); })) {
|
||||
// We reduce intersection types only when they contain naked type parameters. For example, when
|
||||
// inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and
|
||||
// infer { extra: any } for T. But when inferring to 'string[] & Iterable<T>' we want to keep the
|
||||
// string[] on the source side and infer string for T.
|
||||
if (source.flags & 2097152 /* Intersection */) {
|
||||
// Likewise, we consider a homomorphic mapped type constrainted to the target type parameter as similar to a "naked type variable"
|
||||
// in such scenarios.
|
||||
if (!(source.flags & 1048576 /* Union */)) {
|
||||
// Infer between identically matching source and target constituents and remove the matching types.
|
||||
var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
var _d = inferFromMatchingTypes(source.flags & 2097152 /* Intersection */ ? source.types : [source], target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getIntersectionType(sources);
|
||||
target = getIntersectionType(targets);
|
||||
}
|
||||
else if (!(source.flags & 1048576 /* Union */)) {
|
||||
if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
|
||||
target = getActualTypeVariable(target);
|
||||
@@ -46405,22 +46490,11 @@ var ts;
|
||||
visited.set(key, inferencePriority);
|
||||
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
|
||||
}
|
||||
function inferFromMatchingType(source, targets, matches) {
|
||||
var matched = false;
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
if (matches(source, t)) {
|
||||
inferFromTypes(source, t);
|
||||
matched = true;
|
||||
}
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
function inferFromMatchingTypes(sources, targets, matches) {
|
||||
var matchedSources;
|
||||
var matchedTargets;
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
|
||||
var s = sources_1[_a];
|
||||
if (matches(s, t)) {
|
||||
@@ -46478,8 +46552,8 @@ var ts;
|
||||
// track whether inferences were made from that particular type to some target with
|
||||
// equal priority (i.e. of equal quality) to what we would infer for a naked type
|
||||
// parameter.
|
||||
for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
|
||||
var t = targets_3[_i];
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
nakedTypeVariable = t;
|
||||
typeVariableCount++;
|
||||
@@ -46512,8 +46586,8 @@ var ts;
|
||||
// We infer from types that are not naked type variables first so that inferences we
|
||||
// make from nested naked type variables and given slightly higher priority by virtue
|
||||
// of being first in the candidates array.
|
||||
for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
|
||||
var t = targets_4[_a];
|
||||
for (var _a = 0, targets_3 = targets; _a < targets_3.length; _a++) {
|
||||
var t = targets_3[_a];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
typeVariableCount++;
|
||||
}
|
||||
@@ -46529,8 +46603,8 @@ var ts;
|
||||
if (targetFlags & 2097152 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) {
|
||||
var savePriority = priority;
|
||||
priority |= 1 /* NakedTypeVariable */;
|
||||
for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
|
||||
var t = targets_5[_b];
|
||||
for (var _b = 0, targets_4 = targets; _b < targets_4.length; _b++) {
|
||||
var t = targets_4[_b];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
inferFromTypes(source, t);
|
||||
}
|
||||
@@ -51738,7 +51812,7 @@ var ts;
|
||||
if (ts.isJsxOpeningLikeElement(node)) {
|
||||
if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "jsx should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -51753,7 +51827,7 @@ var ts;
|
||||
var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;
|
||||
if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage_1, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "this parameter should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1;
|
||||
@@ -51771,7 +51845,7 @@ var ts;
|
||||
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51781,7 +51855,7 @@ var ts;
|
||||
if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, /*containingMessageChain*/ undefined, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(errorNode, spreadType, restType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
@@ -67594,11 +67668,9 @@ var ts;
|
||||
function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {
|
||||
context.startLexicalEnvironment();
|
||||
statements = visitNodes(statements, visitor, ts.isStatement, start);
|
||||
if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {
|
||||
statements = ts.setTextRange(ts.createNodeArray(__spreadArrays([ts.createExpressionStatement(ts.createLiteral("use strict"))], statements)), statements);
|
||||
}
|
||||
var declarations = context.endLexicalEnvironment();
|
||||
return ts.setTextRange(ts.createNodeArray(ts.concatenate(declarations, statements)), statements);
|
||||
if (ensureUseStrict)
|
||||
statements = ts.ensureUseStrict(statements); // tslint:disable-line no-unnecessary-qualifier
|
||||
return ts.mergeLexicalEnvironment(statements, context.endLexicalEnvironment());
|
||||
}
|
||||
ts.visitLexicalEnvironment = visitLexicalEnvironment;
|
||||
/**
|
||||
@@ -86098,6 +86170,8 @@ var ts;
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
if (configFile.options.emitDeclarationOnly)
|
||||
return undefined;
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
||||
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir), isJsonFile ?
|
||||
".json" /* Json */ :
|
||||
@@ -86129,7 +86203,7 @@ var ts;
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
if (js && configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
@@ -86158,6 +86232,11 @@ var ts;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
return getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
}
|
||||
}
|
||||
var buildInfoPath = getOutputPathForBuildInfo(configFile.options);
|
||||
if (buildInfoPath)
|
||||
@@ -93866,11 +93945,16 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var emitOutput = ts.getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken);
|
||||
if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) {
|
||||
latestSignature = computeHash(emitOutput.outputFiles[0].text);
|
||||
var emitOutput_1 = ts.getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken);
|
||||
var firstDts_1 = emitOutput_1.outputFiles &&
|
||||
programOfThisState.getCompilerOptions().declarationMap ?
|
||||
emitOutput_1.outputFiles.length > 1 ? emitOutput_1.outputFiles[1] : undefined :
|
||||
emitOutput_1.outputFiles.length > 0 ? emitOutput_1.outputFiles[0] : undefined;
|
||||
if (firstDts_1) {
|
||||
ts.Debug.assert(ts.fileExtensionIs(firstDts_1.name, ".d.ts" /* Dts */), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
||||
latestSignature = computeHash(firstDts_1.text);
|
||||
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
||||
updateExportedModules(sourceFile, emitOutput.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -94245,7 +94329,6 @@ var ts;
|
||||
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
||||
return affectedFile;
|
||||
}
|
||||
seenAffectedFiles.set(affectedFile.path, true);
|
||||
affectedFilesIndex++;
|
||||
}
|
||||
// Remove the changed file from the change set
|
||||
@@ -94435,7 +94518,7 @@ var ts;
|
||||
* This is called after completing operation on the next affected file.
|
||||
* The operations here are postponed to ensure that cancellation during the iteration is handled correctly
|
||||
*/
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, isEmitResult) {
|
||||
if (isBuildInfoEmit) {
|
||||
state.emittedBuildInfo = true;
|
||||
}
|
||||
@@ -94445,6 +94528,9 @@ var ts;
|
||||
}
|
||||
else {
|
||||
state.seenAffectedFiles.set(affected.path, true);
|
||||
if (isEmitResult) {
|
||||
(state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
|
||||
}
|
||||
if (isPendingEmit) {
|
||||
state.affectedFilesPendingEmitIndex++;
|
||||
}
|
||||
@@ -94460,6 +94546,13 @@ var ts;
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
/**
|
||||
* Returns the result with affected file
|
||||
*/
|
||||
function toAffectedFileEmitResult(state, result, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, /*isEmitResult*/ true);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
/**
|
||||
* Gets the semantic diagnostics either from cache if present, or otherwise from program and caches it
|
||||
* Note that it is assumed that the when asked about semantic diagnostics, the file has been taken out of affected files/changed file set
|
||||
@@ -94689,7 +94782,7 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
var affected_1 = ts.Debug.assertDefined(state.program);
|
||||
return toAffectedFileResult(state,
|
||||
return toAffectedFileEmitResult(state,
|
||||
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
||||
// Otherwise just affected file
|
||||
affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1,
|
||||
@@ -94708,7 +94801,7 @@ var ts;
|
||||
affected = program;
|
||||
}
|
||||
}
|
||||
return toAffectedFileResult(state,
|
||||
return toAffectedFileEmitResult(state,
|
||||
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
||||
// Otherwise just affected file
|
||||
ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
|
||||
@@ -94848,7 +94941,7 @@ var ts;
|
||||
compilerOptions: convertFromReusableCompilerOptions(program.options, toAbsolutePath),
|
||||
referencedMap: getMapOfReferencedSet(program.referencedMap, toPath),
|
||||
exportedModulesMap: getMapOfReferencedSet(program.exportedModulesMap, toPath),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return ts.isString(value) ? value : value[0]; }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toPath(ts.isString(value) ? value : value[0]); }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
hasReusableDiagnostic: true
|
||||
};
|
||||
return {
|
||||
@@ -112193,29 +112286,14 @@ var ts;
|
||||
options[key] = defaultOptions[key];
|
||||
}
|
||||
}
|
||||
options.isolatedModules = true;
|
||||
for (var _i = 0, transpileOptionValueCompilerOptions_1 = ts.transpileOptionValueCompilerOptions; _i < transpileOptionValueCompilerOptions_1.length; _i++) {
|
||||
var option = transpileOptionValueCompilerOptions_1[_i];
|
||||
options[option.name] = option.transpileOptionValue;
|
||||
}
|
||||
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
|
||||
options.suppressOutputPathCheck = true;
|
||||
// Filename can be non-ts file.
|
||||
options.allowNonTsExtensions = true;
|
||||
// We are not returning a sourceFile for lib file when asked by the program,
|
||||
// so pass --noLib to avoid reporting a file not found error.
|
||||
options.noLib = true;
|
||||
// Clear out other settings that would not be used in transpiling this module
|
||||
options.lib = undefined;
|
||||
options.types = undefined;
|
||||
options.noEmit = undefined;
|
||||
options.noEmitOnError = undefined;
|
||||
options.paths = undefined;
|
||||
options.rootDirs = undefined;
|
||||
options.declaration = undefined;
|
||||
options.composite = undefined;
|
||||
options.declarationDir = undefined;
|
||||
options.out = undefined;
|
||||
options.outFile = undefined;
|
||||
// We are not doing a full typecheck, we are not resolving the whole context,
|
||||
// so pass --noResolve to avoid reporting missing file errors.
|
||||
options.noResolve = true;
|
||||
// if jsx is specified then treat file as .tsx
|
||||
var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts");
|
||||
var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217
|
||||
|
||||
+177
-99
@@ -82,7 +82,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.6";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
ts.version = ts.versionMajorMinor + ".3";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -2422,9 +2422,10 @@ var ts;
|
||||
catch (e) {
|
||||
etwModule = undefined;
|
||||
}
|
||||
/** Performance logger that will generate ETW events if possible */
|
||||
ts.perfLogger = etwModule ? etwModule : nullLogger;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
|
||||
/** Performance logger that will generate ETW events if possible - check for `logEvent` member, as `etwModule` will be `{}` when browserified */
|
||||
ts.perfLogger = etwModule && etwModule.logEvent ? etwModule : nullLogger;
|
||||
var args = typeof process === "undefined" ? [] : process.argv;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(args));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
@@ -24401,6 +24402,7 @@ var ts;
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_incremental_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "locale",
|
||||
@@ -24512,7 +24514,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowJs",
|
||||
@@ -24549,6 +24552,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "declarationMap",
|
||||
@@ -24557,6 +24561,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "emitDeclarationOnly",
|
||||
@@ -24564,6 +24569,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "sourceMap",
|
||||
@@ -24582,6 +24588,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "outDir",
|
||||
@@ -24609,6 +24616,7 @@ var ts;
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_project_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "tsBuildInfoFile",
|
||||
@@ -24618,6 +24626,7 @@ var ts;
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "removeComments",
|
||||
@@ -24634,6 +24643,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "importHelpers",
|
||||
@@ -24653,7 +24663,8 @@ var ts;
|
||||
name: "isolatedModules",
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule,
|
||||
transpileOptionValue: true
|
||||
},
|
||||
// Strict Type Checks
|
||||
{
|
||||
@@ -24787,7 +24798,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
// this option can only be specified in tsconfig.json
|
||||
@@ -24802,7 +24814,8 @@ var ts;
|
||||
},
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "typeRoots",
|
||||
@@ -24826,7 +24839,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowSyntheticDefaultImports",
|
||||
@@ -24923,6 +24937,7 @@ var ts;
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "reactNamespace",
|
||||
@@ -24972,14 +24987,20 @@ var ts;
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts,
|
||||
// We are not returning a sourceFile for lib file when asked by the program,
|
||||
// so pass --noLib to avoid reporting a file not found error.
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "noResolve",
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files,
|
||||
// We are not doing a full typecheck, we are not resolving the whole context,
|
||||
// so pass --noResolve to avoid reporting missing file errors.
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "stripInternal",
|
||||
@@ -25015,6 +25036,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "preserveConstEnums",
|
||||
@@ -25030,7 +25052,8 @@ var ts;
|
||||
isFilePath: true,
|
||||
paramType: ts.Diagnostics.DIRECTORY,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "skipLibCheck",
|
||||
@@ -25117,6 +25140,10 @@ var ts;
|
||||
return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
|
||||
});
|
||||
/* @internal */
|
||||
ts.transpileOptionValueCompilerOptions = ts.optionDeclarations.filter(function (option) {
|
||||
return ts.hasProperty(option, "transpileOptionValue");
|
||||
});
|
||||
/* @internal */
|
||||
ts.buildOpts = __spreadArrays(ts.commonOptionsWithBuild, [
|
||||
{
|
||||
name: "verbose",
|
||||
@@ -29783,7 +29810,23 @@ var ts;
|
||||
if (isTopLevel) {
|
||||
bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
|
||||
var oldContainer = container;
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 2 /* ModuleExports */:
|
||||
container = file;
|
||||
break;
|
||||
case 4 /* ThisProperty */:
|
||||
container = declName.parent.expression;
|
||||
break;
|
||||
case 3 /* PrototypeProperty */:
|
||||
container = declName.parent.expression.name;
|
||||
break;
|
||||
case 5 /* Property */:
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
break;
|
||||
case 0 /* None */:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
container = oldContainer;
|
||||
}
|
||||
@@ -41006,6 +41049,15 @@ var ts;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function extractIrreducible(types, flag) {
|
||||
if (ts.every(types, function (t) { return !!(t.flags & 1048576 /* Union */) && ts.some(t.types, function (tt) { return !!(tt.flags & flag); }); })) {
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = filterType(types[i], function (t) { return !(t.flags & flag); });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// If the given list of types contains more than one union of primitive types, replace the
|
||||
// first with a union containing an intersection of those primitive types, then remove the
|
||||
// other unions and return true. Otherwise, do nothing and return false.
|
||||
@@ -41124,6 +41176,12 @@ var ts;
|
||||
// reduced we'll never reduce again, so this occurs at most once.
|
||||
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 32768 /* Undefined */)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), undefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 65536 /* Null */)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else {
|
||||
// We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of
|
||||
// the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain.
|
||||
@@ -43644,7 +43702,7 @@ var ts;
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */)) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */), isIntersectionConstituent) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */));
|
||||
}
|
||||
else {
|
||||
@@ -43682,7 +43740,7 @@ var ts;
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false);
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false, /*isIntersectionConstituent*/ true);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 /* StructuredOrInstantiable */ || target.flags & 66846720 /* StructuredOrInstantiable */)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@@ -43951,14 +44009,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 /* Union */ && containsType(sourceTypes, target)) {
|
||||
return -1 /* True */;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, /*headMessage*/ undefined, isIntersectionConstituent);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@@ -45258,6 +45316,9 @@ var ts;
|
||||
// though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely
|
||||
// expanding. Effectively, we will generate a false positive when two types are structurally equal to at least 5
|
||||
// levels, but unequal at some level beyond that.
|
||||
// In addition, this will also detect when an indexed access has been chained off of 5 or more times (which is essentially
|
||||
// the dual of the structural comparison), and likewise mark the type as deeply nested, potentially adding false positives
|
||||
// for finite but deeply expanding indexed accesses (eg, for `Q[P1][P2][P3][P4][P5]`).
|
||||
function isDeeplyNestedType(type, stack, depth) {
|
||||
// We track all object types that have an associated symbol (representing the origin of the type)
|
||||
if (depth >= 5 && type.flags & 524288 /* Object */) {
|
||||
@@ -45274,8 +45335,30 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (depth >= 5 && type.flags & 8388608 /* IndexedAccess */) {
|
||||
var root = getRootObjectTypeFromIndexedAccessChain(type);
|
||||
var count = 0;
|
||||
for (var i = 0; i < depth; i++) {
|
||||
var t = stack[i];
|
||||
if (getRootObjectTypeFromIndexedAccessChain(t) === root) {
|
||||
count++;
|
||||
if (count >= 5)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Gets the leftmost object type in a chain of indexed accesses, eg, in A[P][Q], returns A
|
||||
*/
|
||||
function getRootObjectTypeFromIndexedAccessChain(type) {
|
||||
var t = type;
|
||||
while (t.flags & 8388608 /* IndexedAccess */) {
|
||||
t = t.objectType;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
function isPropertyIdenticalTo(sourceProp, targetProp) {
|
||||
return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
|
||||
}
|
||||
@@ -46219,45 +46302,47 @@ var ts;
|
||||
return;
|
||||
}
|
||||
if (target.flags & 1048576 /* Union */) {
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
// First, infer between identically matching source and target constituents and remove the
|
||||
// matching types.
|
||||
var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
// Next, infer between closely matching source and target constituents and remove
|
||||
// the matching types. Types closely match when they are instantiations of the same
|
||||
// object type or instantiations of the same type alias.
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
target = getUnionType(targets);
|
||||
// First, infer between identically matching source and target constituents and remove the
|
||||
// matching types.
|
||||
var _b = inferFromMatchingTypes(source.flags & 1048576 /* Union */ ? source.types : [source], target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
// Next, infer between closely matching source and target constituents and remove
|
||||
// the matching types. Types closely match when they are instantiations of the same
|
||||
// object type or instantiations of the same type alias.
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
|
||||
return;
|
||||
if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
|
||||
return;
|
||||
target = getUnionType(targets);
|
||||
if (sources.length === 0) {
|
||||
// All source constituents have been matched and there is nothing further to infer from.
|
||||
// However, simply making no inferences is undesirable because it could ultimately mean
|
||||
// inferring a type parameter constraint. Instead, make a lower priority inference from
|
||||
// the full source to whatever remains in the target. For example, when inferring from
|
||||
// string to 'string | T', make a lower priority inference of string for T.
|
||||
var savePriority = priority;
|
||||
priority |= 1 /* NakedTypeVariable */;
|
||||
inferFromTypes(source, target);
|
||||
priority = savePriority;
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
}
|
||||
else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
|
||||
else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t) || (isGenericMappedType(t) && !!getInferenceInfoForType(getHomomorphicTypeVariable(t) || neverType)); })) {
|
||||
// We reduce intersection types only when they contain naked type parameters. For example, when
|
||||
// inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and
|
||||
// infer { extra: any } for T. But when inferring to 'string[] & Iterable<T>' we want to keep the
|
||||
// string[] on the source side and infer string for T.
|
||||
if (source.flags & 2097152 /* Intersection */) {
|
||||
// Likewise, we consider a homomorphic mapped type constrainted to the target type parameter as similar to a "naked type variable"
|
||||
// in such scenarios.
|
||||
if (!(source.flags & 1048576 /* Union */)) {
|
||||
// Infer between identically matching source and target constituents and remove the matching types.
|
||||
var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
var _d = inferFromMatchingTypes(source.flags & 2097152 /* Intersection */ ? source.types : [source], target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getIntersectionType(sources);
|
||||
target = getIntersectionType(targets);
|
||||
}
|
||||
else if (!(source.flags & 1048576 /* Union */)) {
|
||||
if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
|
||||
target = getActualTypeVariable(target);
|
||||
@@ -46405,22 +46490,11 @@ var ts;
|
||||
visited.set(key, inferencePriority);
|
||||
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
|
||||
}
|
||||
function inferFromMatchingType(source, targets, matches) {
|
||||
var matched = false;
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
if (matches(source, t)) {
|
||||
inferFromTypes(source, t);
|
||||
matched = true;
|
||||
}
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
function inferFromMatchingTypes(sources, targets, matches) {
|
||||
var matchedSources;
|
||||
var matchedTargets;
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
|
||||
var s = sources_1[_a];
|
||||
if (matches(s, t)) {
|
||||
@@ -46478,8 +46552,8 @@ var ts;
|
||||
// track whether inferences were made from that particular type to some target with
|
||||
// equal priority (i.e. of equal quality) to what we would infer for a naked type
|
||||
// parameter.
|
||||
for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
|
||||
var t = targets_3[_i];
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
nakedTypeVariable = t;
|
||||
typeVariableCount++;
|
||||
@@ -46512,8 +46586,8 @@ var ts;
|
||||
// We infer from types that are not naked type variables first so that inferences we
|
||||
// make from nested naked type variables and given slightly higher priority by virtue
|
||||
// of being first in the candidates array.
|
||||
for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
|
||||
var t = targets_4[_a];
|
||||
for (var _a = 0, targets_3 = targets; _a < targets_3.length; _a++) {
|
||||
var t = targets_3[_a];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
typeVariableCount++;
|
||||
}
|
||||
@@ -46529,8 +46603,8 @@ var ts;
|
||||
if (targetFlags & 2097152 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) {
|
||||
var savePriority = priority;
|
||||
priority |= 1 /* NakedTypeVariable */;
|
||||
for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
|
||||
var t = targets_5[_b];
|
||||
for (var _b = 0, targets_4 = targets; _b < targets_4.length; _b++) {
|
||||
var t = targets_4[_b];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
inferFromTypes(source, t);
|
||||
}
|
||||
@@ -51738,7 +51812,7 @@ var ts;
|
||||
if (ts.isJsxOpeningLikeElement(node)) {
|
||||
if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "jsx should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -51753,7 +51827,7 @@ var ts;
|
||||
var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;
|
||||
if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage_1, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "this parameter should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1;
|
||||
@@ -51771,7 +51845,7 @@ var ts;
|
||||
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51781,7 +51855,7 @@ var ts;
|
||||
if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, /*containingMessageChain*/ undefined, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(errorNode, spreadType, restType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
@@ -67594,11 +67668,9 @@ var ts;
|
||||
function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {
|
||||
context.startLexicalEnvironment();
|
||||
statements = visitNodes(statements, visitor, ts.isStatement, start);
|
||||
if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {
|
||||
statements = ts.setTextRange(ts.createNodeArray(__spreadArrays([ts.createExpressionStatement(ts.createLiteral("use strict"))], statements)), statements);
|
||||
}
|
||||
var declarations = context.endLexicalEnvironment();
|
||||
return ts.setTextRange(ts.createNodeArray(ts.concatenate(declarations, statements)), statements);
|
||||
if (ensureUseStrict)
|
||||
statements = ts.ensureUseStrict(statements); // tslint:disable-line no-unnecessary-qualifier
|
||||
return ts.mergeLexicalEnvironment(statements, context.endLexicalEnvironment());
|
||||
}
|
||||
ts.visitLexicalEnvironment = visitLexicalEnvironment;
|
||||
/**
|
||||
@@ -86098,6 +86170,8 @@ var ts;
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
if (configFile.options.emitDeclarationOnly)
|
||||
return undefined;
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
||||
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir), isJsonFile ?
|
||||
".json" /* Json */ :
|
||||
@@ -86129,7 +86203,7 @@ var ts;
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
if (js && configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
@@ -86158,6 +86232,11 @@ var ts;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
return getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
}
|
||||
}
|
||||
var buildInfoPath = getOutputPathForBuildInfo(configFile.options);
|
||||
if (buildInfoPath)
|
||||
@@ -93866,11 +93945,16 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var emitOutput = ts.getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken);
|
||||
if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) {
|
||||
latestSignature = computeHash(emitOutput.outputFiles[0].text);
|
||||
var emitOutput_1 = ts.getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken);
|
||||
var firstDts_1 = emitOutput_1.outputFiles &&
|
||||
programOfThisState.getCompilerOptions().declarationMap ?
|
||||
emitOutput_1.outputFiles.length > 1 ? emitOutput_1.outputFiles[1] : undefined :
|
||||
emitOutput_1.outputFiles.length > 0 ? emitOutput_1.outputFiles[0] : undefined;
|
||||
if (firstDts_1) {
|
||||
ts.Debug.assert(ts.fileExtensionIs(firstDts_1.name, ".d.ts" /* Dts */), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
||||
latestSignature = computeHash(firstDts_1.text);
|
||||
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
||||
updateExportedModules(sourceFile, emitOutput.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -94245,7 +94329,6 @@ var ts;
|
||||
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
||||
return affectedFile;
|
||||
}
|
||||
seenAffectedFiles.set(affectedFile.path, true);
|
||||
affectedFilesIndex++;
|
||||
}
|
||||
// Remove the changed file from the change set
|
||||
@@ -94435,7 +94518,7 @@ var ts;
|
||||
* This is called after completing operation on the next affected file.
|
||||
* The operations here are postponed to ensure that cancellation during the iteration is handled correctly
|
||||
*/
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, isEmitResult) {
|
||||
if (isBuildInfoEmit) {
|
||||
state.emittedBuildInfo = true;
|
||||
}
|
||||
@@ -94445,6 +94528,9 @@ var ts;
|
||||
}
|
||||
else {
|
||||
state.seenAffectedFiles.set(affected.path, true);
|
||||
if (isEmitResult) {
|
||||
(state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
|
||||
}
|
||||
if (isPendingEmit) {
|
||||
state.affectedFilesPendingEmitIndex++;
|
||||
}
|
||||
@@ -94460,6 +94546,13 @@ var ts;
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
/**
|
||||
* Returns the result with affected file
|
||||
*/
|
||||
function toAffectedFileEmitResult(state, result, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, /*isEmitResult*/ true);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
/**
|
||||
* Gets the semantic diagnostics either from cache if present, or otherwise from program and caches it
|
||||
* Note that it is assumed that the when asked about semantic diagnostics, the file has been taken out of affected files/changed file set
|
||||
@@ -94689,7 +94782,7 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
var affected_1 = ts.Debug.assertDefined(state.program);
|
||||
return toAffectedFileResult(state,
|
||||
return toAffectedFileEmitResult(state,
|
||||
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
||||
// Otherwise just affected file
|
||||
affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1,
|
||||
@@ -94708,7 +94801,7 @@ var ts;
|
||||
affected = program;
|
||||
}
|
||||
}
|
||||
return toAffectedFileResult(state,
|
||||
return toAffectedFileEmitResult(state,
|
||||
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
||||
// Otherwise just affected file
|
||||
ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
|
||||
@@ -94848,7 +94941,7 @@ var ts;
|
||||
compilerOptions: convertFromReusableCompilerOptions(program.options, toAbsolutePath),
|
||||
referencedMap: getMapOfReferencedSet(program.referencedMap, toPath),
|
||||
exportedModulesMap: getMapOfReferencedSet(program.exportedModulesMap, toPath),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return ts.isString(value) ? value : value[0]; }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toPath(ts.isString(value) ? value : value[0]); }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
hasReusableDiagnostic: true
|
||||
};
|
||||
return {
|
||||
@@ -112193,29 +112286,14 @@ var ts;
|
||||
options[key] = defaultOptions[key];
|
||||
}
|
||||
}
|
||||
options.isolatedModules = true;
|
||||
for (var _i = 0, transpileOptionValueCompilerOptions_1 = ts.transpileOptionValueCompilerOptions; _i < transpileOptionValueCompilerOptions_1.length; _i++) {
|
||||
var option = transpileOptionValueCompilerOptions_1[_i];
|
||||
options[option.name] = option.transpileOptionValue;
|
||||
}
|
||||
// transpileModule does not write anything to disk so there is no need to verify that there are no conflicts between input and output paths.
|
||||
options.suppressOutputPathCheck = true;
|
||||
// Filename can be non-ts file.
|
||||
options.allowNonTsExtensions = true;
|
||||
// We are not returning a sourceFile for lib file when asked by the program,
|
||||
// so pass --noLib to avoid reporting a file not found error.
|
||||
options.noLib = true;
|
||||
// Clear out other settings that would not be used in transpiling this module
|
||||
options.lib = undefined;
|
||||
options.types = undefined;
|
||||
options.noEmit = undefined;
|
||||
options.noEmitOnError = undefined;
|
||||
options.paths = undefined;
|
||||
options.rootDirs = undefined;
|
||||
options.declaration = undefined;
|
||||
options.composite = undefined;
|
||||
options.declarationDir = undefined;
|
||||
options.out = undefined;
|
||||
options.outFile = undefined;
|
||||
// We are not doing a full typecheck, we are not resolving the whole context,
|
||||
// so pass --noResolve to avoid reporting missing file errors.
|
||||
options.noResolve = true;
|
||||
// if jsx is specified then treat file as .tsx
|
||||
var inputFileName = transpileOptions.fileName || (transpileOptions.compilerOptions && transpileOptions.compilerOptions.jsx ? "module.tsx" : "module.ts");
|
||||
var sourceFile = ts.createSourceFile(inputFileName, input, options.target); // TODO: GH#18217
|
||||
|
||||
+173
-80
@@ -83,7 +83,7 @@ var ts;
|
||||
// If changing the text in this section, be sure to test `configureNightly` too.
|
||||
ts.versionMajorMinor = "3.6";
|
||||
/** The version of the TypeScript compiler release */
|
||||
ts.version = ts.versionMajorMinor + ".2";
|
||||
ts.version = ts.versionMajorMinor + ".3";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
/* @internal */
|
||||
@@ -2423,9 +2423,10 @@ var ts;
|
||||
catch (e) {
|
||||
etwModule = undefined;
|
||||
}
|
||||
/** Performance logger that will generate ETW events if possible */
|
||||
ts.perfLogger = etwModule ? etwModule : nullLogger;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(process.argv));
|
||||
/** Performance logger that will generate ETW events if possible - check for `logEvent` member, as `etwModule` will be `{}` when browserified */
|
||||
ts.perfLogger = etwModule && etwModule.logEvent ? etwModule : nullLogger;
|
||||
var args = typeof process === "undefined" ? [] : process.argv;
|
||||
ts.perfLogger.logInfoEvent("Starting TypeScript v" + ts.versionMajorMinor + " with command line: " + JSON.stringify(args));
|
||||
})(ts || (ts = {}));
|
||||
/* @internal */
|
||||
var ts;
|
||||
@@ -24402,6 +24403,7 @@ var ts;
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_incremental_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "locale",
|
||||
@@ -24513,7 +24515,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation
|
||||
description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowJs",
|
||||
@@ -24550,6 +24553,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "declarationMap",
|
||||
@@ -24558,6 +24562,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "emitDeclarationOnly",
|
||||
@@ -24565,6 +24570,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "sourceMap",
|
||||
@@ -24583,6 +24589,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "outDir",
|
||||
@@ -24610,6 +24617,7 @@ var ts;
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Enable_project_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "tsBuildInfoFile",
|
||||
@@ -24619,6 +24627,7 @@ var ts;
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "removeComments",
|
||||
@@ -24635,6 +24644,7 @@ var ts;
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "importHelpers",
|
||||
@@ -24654,7 +24664,8 @@ var ts;
|
||||
name: "isolatedModules",
|
||||
type: "boolean",
|
||||
category: ts.Diagnostics.Basic_Options,
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule
|
||||
description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule,
|
||||
transpileOptionValue: true
|
||||
},
|
||||
// Strict Type Checks
|
||||
{
|
||||
@@ -24788,7 +24799,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
isTSConfigOnly: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl
|
||||
description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
// this option can only be specified in tsconfig.json
|
||||
@@ -24803,7 +24815,8 @@ var ts;
|
||||
},
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime
|
||||
description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "typeRoots",
|
||||
@@ -24827,7 +24840,8 @@ var ts;
|
||||
affectsModuleResolution: true,
|
||||
showInSimplifiedHelpView: true,
|
||||
category: ts.Diagnostics.Module_Resolution_Options,
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation
|
||||
description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "allowSyntheticDefaultImports",
|
||||
@@ -24924,6 +24938,7 @@ var ts;
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
paramType: ts.Diagnostics.FILE,
|
||||
description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "reactNamespace",
|
||||
@@ -24973,14 +24988,20 @@ var ts;
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts
|
||||
description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts,
|
||||
// We are not returning a sourceFile for lib file when asked by the program,
|
||||
// so pass --noLib to avoid reporting a file not found error.
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "noResolve",
|
||||
type: "boolean",
|
||||
affectsModuleResolution: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files
|
||||
description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files,
|
||||
// We are not doing a full typecheck, we are not resolving the whole context,
|
||||
// so pass --noResolve to avoid reporting missing file errors.
|
||||
transpileOptionValue: true
|
||||
},
|
||||
{
|
||||
name: "stripInternal",
|
||||
@@ -25016,6 +25037,7 @@ var ts;
|
||||
affectsEmit: true,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "preserveConstEnums",
|
||||
@@ -25031,7 +25053,8 @@ var ts;
|
||||
isFilePath: true,
|
||||
paramType: ts.Diagnostics.DIRECTORY,
|
||||
category: ts.Diagnostics.Advanced_Options,
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files
|
||||
description: ts.Diagnostics.Output_directory_for_generated_declaration_files,
|
||||
transpileOptionValue: undefined
|
||||
},
|
||||
{
|
||||
name: "skipLibCheck",
|
||||
@@ -25118,6 +25141,10 @@ var ts;
|
||||
return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
|
||||
});
|
||||
/* @internal */
|
||||
ts.transpileOptionValueCompilerOptions = ts.optionDeclarations.filter(function (option) {
|
||||
return ts.hasProperty(option, "transpileOptionValue");
|
||||
});
|
||||
/* @internal */
|
||||
ts.buildOpts = __spreadArrays(ts.commonOptionsWithBuild, [
|
||||
{
|
||||
name: "verbose",
|
||||
@@ -29784,7 +29811,23 @@ var ts;
|
||||
if (isTopLevel) {
|
||||
bindPotentiallyMissingNamespaces(file.symbol, declName.parent, isTopLevel, !!ts.findAncestor(declName, function (d) { return ts.isPropertyAccessExpression(d) && d.name.escapedText === "prototype"; }));
|
||||
var oldContainer = container;
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
switch (ts.getAssignmentDeclarationPropertyAccessKind(declName.parent)) {
|
||||
case 1 /* ExportsProperty */:
|
||||
case 2 /* ModuleExports */:
|
||||
container = file;
|
||||
break;
|
||||
case 4 /* ThisProperty */:
|
||||
container = declName.parent.expression;
|
||||
break;
|
||||
case 3 /* PrototypeProperty */:
|
||||
container = declName.parent.expression.name;
|
||||
break;
|
||||
case 5 /* Property */:
|
||||
container = ts.isPropertyAccessExpression(declName.parent.expression) ? declName.parent.expression.name : declName.parent.expression;
|
||||
break;
|
||||
case 0 /* None */:
|
||||
return ts.Debug.fail("Shouldn't have detected typedef or enum on non-assignment declaration");
|
||||
}
|
||||
declareModuleMember(typeAlias, 524288 /* TypeAlias */, 788968 /* TypeAliasExcludes */);
|
||||
container = oldContainer;
|
||||
}
|
||||
@@ -41007,6 +41050,15 @@ var ts;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function extractIrreducible(types, flag) {
|
||||
if (ts.every(types, function (t) { return !!(t.flags & 1048576 /* Union */) && ts.some(t.types, function (tt) { return !!(tt.flags & flag); }); })) {
|
||||
for (var i = 0; i < types.length; i++) {
|
||||
types[i] = filterType(types[i], function (t) { return !(t.flags & flag); });
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// If the given list of types contains more than one union of primitive types, replace the
|
||||
// first with a union containing an intersection of those primitive types, then remove the
|
||||
// other unions and return true. Otherwise, do nothing and return false.
|
||||
@@ -41125,6 +41177,12 @@ var ts;
|
||||
// reduced we'll never reduce again, so this occurs at most once.
|
||||
result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 32768 /* Undefined */)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), undefinedType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else if (extractIrreducible(typeSet, 65536 /* Null */)) {
|
||||
result = getUnionType([getIntersectionType(typeSet), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
||||
}
|
||||
else {
|
||||
// We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of
|
||||
// the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain.
|
||||
@@ -43645,7 +43703,7 @@ var ts;
|
||||
// and we need to handle "each" relations before "some" relations for the same kind of type.
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
result = relation === comparableRelation ?
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */)) :
|
||||
someTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */), isIntersectionConstituent) :
|
||||
eachTypeRelatedToType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */));
|
||||
}
|
||||
else {
|
||||
@@ -43683,7 +43741,7 @@ var ts;
|
||||
//
|
||||
// - For a primitive type or type parameter (such as 'number = A & B') there is no point in
|
||||
// breaking the intersection apart.
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false);
|
||||
result = someTypeRelatedToType(source, target, /*reportErrors*/ false, /*isIntersectionConstituent*/ true);
|
||||
}
|
||||
if (!result && (source.flags & 66846720 /* StructuredOrInstantiable */ || target.flags & 66846720 /* StructuredOrInstantiable */)) {
|
||||
if (result = recursiveTypeRelatedTo(source, target, reportErrors, isIntersectionConstituent)) {
|
||||
@@ -43952,14 +44010,14 @@ var ts;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function someTypeRelatedToType(source, target, reportErrors) {
|
||||
function someTypeRelatedToType(source, target, reportErrors, isIntersectionConstituent) {
|
||||
var sourceTypes = source.types;
|
||||
if (source.flags & 1048576 /* Union */ && containsType(sourceTypes, target)) {
|
||||
return -1 /* True */;
|
||||
}
|
||||
var len = sourceTypes.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1);
|
||||
var related = isRelatedTo(sourceTypes[i], target, reportErrors && i === len - 1, /*headMessage*/ undefined, isIntersectionConstituent);
|
||||
if (related) {
|
||||
return related;
|
||||
}
|
||||
@@ -45259,6 +45317,9 @@ var ts;
|
||||
// though highly unlikely, for this test to be true in a situation where a chain of instantiations is not infinitely
|
||||
// expanding. Effectively, we will generate a false positive when two types are structurally equal to at least 5
|
||||
// levels, but unequal at some level beyond that.
|
||||
// In addition, this will also detect when an indexed access has been chained off of 5 or more times (which is essentially
|
||||
// the dual of the structural comparison), and likewise mark the type as deeply nested, potentially adding false positives
|
||||
// for finite but deeply expanding indexed accesses (eg, for `Q[P1][P2][P3][P4][P5]`).
|
||||
function isDeeplyNestedType(type, stack, depth) {
|
||||
// We track all object types that have an associated symbol (representing the origin of the type)
|
||||
if (depth >= 5 && type.flags & 524288 /* Object */) {
|
||||
@@ -45275,8 +45336,30 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (depth >= 5 && type.flags & 8388608 /* IndexedAccess */) {
|
||||
var root = getRootObjectTypeFromIndexedAccessChain(type);
|
||||
var count = 0;
|
||||
for (var i = 0; i < depth; i++) {
|
||||
var t = stack[i];
|
||||
if (getRootObjectTypeFromIndexedAccessChain(t) === root) {
|
||||
count++;
|
||||
if (count >= 5)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* Gets the leftmost object type in a chain of indexed accesses, eg, in A[P][Q], returns A
|
||||
*/
|
||||
function getRootObjectTypeFromIndexedAccessChain(type) {
|
||||
var t = type;
|
||||
while (t.flags & 8388608 /* IndexedAccess */) {
|
||||
t = t.objectType;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
function isPropertyIdenticalTo(sourceProp, targetProp) {
|
||||
return compareProperties(sourceProp, targetProp, compareTypesIdentical) !== 0 /* False */;
|
||||
}
|
||||
@@ -46220,45 +46303,47 @@ var ts;
|
||||
return;
|
||||
}
|
||||
if (target.flags & 1048576 /* Union */) {
|
||||
if (source.flags & 1048576 /* Union */) {
|
||||
// First, infer between identically matching source and target constituents and remove the
|
||||
// matching types.
|
||||
var _b = inferFromMatchingTypes(source.types, target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
// Next, infer between closely matching source and target constituents and remove
|
||||
// the matching types. Types closely match when they are instantiations of the same
|
||||
// object type or instantiations of the same type alias.
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
target = getUnionType(targets);
|
||||
// First, infer between identically matching source and target constituents and remove the
|
||||
// matching types.
|
||||
var _b = inferFromMatchingTypes(source.flags & 1048576 /* Union */ ? source.types : [source], target.types, isTypeOrBaseIdenticalTo), tempSources = _b[0], tempTargets = _b[1];
|
||||
// Next, infer between closely matching source and target constituents and remove
|
||||
// the matching types. Types closely match when they are instantiations of the same
|
||||
// object type or instantiations of the same type alias.
|
||||
var _c = inferFromMatchingTypes(tempSources, tempTargets, isTypeCloselyMatchedBy), sources = _c[0], targets = _c[1];
|
||||
if (targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
if (inferFromMatchingType(source, target.types, isTypeOrBaseIdenticalTo))
|
||||
return;
|
||||
if (inferFromMatchingType(source, target.types, isTypeCloselyMatchedBy))
|
||||
return;
|
||||
target = getUnionType(targets);
|
||||
if (sources.length === 0) {
|
||||
// All source constituents have been matched and there is nothing further to infer from.
|
||||
// However, simply making no inferences is undesirable because it could ultimately mean
|
||||
// inferring a type parameter constraint. Instead, make a lower priority inference from
|
||||
// the full source to whatever remains in the target. For example, when inferring from
|
||||
// string to 'string | T', make a lower priority inference of string for T.
|
||||
var savePriority = priority;
|
||||
priority |= 1 /* NakedTypeVariable */;
|
||||
inferFromTypes(source, target);
|
||||
priority = savePriority;
|
||||
return;
|
||||
}
|
||||
source = getUnionType(sources);
|
||||
}
|
||||
else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t); })) {
|
||||
else if (target.flags & 2097152 /* Intersection */ && ts.some(target.types, function (t) { return !!getInferenceInfoForType(t) || (isGenericMappedType(t) && !!getInferenceInfoForType(getHomomorphicTypeVariable(t) || neverType)); })) {
|
||||
// We reduce intersection types only when they contain naked type parameters. For example, when
|
||||
// inferring from 'string[] & { extra: any }' to 'string[] & T' we want to remove string[] and
|
||||
// infer { extra: any } for T. But when inferring to 'string[] & Iterable<T>' we want to keep the
|
||||
// string[] on the source side and infer string for T.
|
||||
if (source.flags & 2097152 /* Intersection */) {
|
||||
// Likewise, we consider a homomorphic mapped type constrainted to the target type parameter as similar to a "naked type variable"
|
||||
// in such scenarios.
|
||||
if (!(source.flags & 1048576 /* Union */)) {
|
||||
// Infer between identically matching source and target constituents and remove the matching types.
|
||||
var _d = inferFromMatchingTypes(source.types, target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
var _d = inferFromMatchingTypes(source.flags & 2097152 /* Intersection */ ? source.types : [source], target.types, isTypeIdenticalTo), sources = _d[0], targets = _d[1];
|
||||
if (sources.length === 0 || targets.length === 0) {
|
||||
return;
|
||||
}
|
||||
source = getIntersectionType(sources);
|
||||
target = getIntersectionType(targets);
|
||||
}
|
||||
else if (!(source.flags & 1048576 /* Union */)) {
|
||||
if (inferFromMatchingType(source, target.types, isTypeIdenticalTo))
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
|
||||
target = getActualTypeVariable(target);
|
||||
@@ -46406,22 +46491,11 @@ var ts;
|
||||
visited.set(key, inferencePriority);
|
||||
inferencePriority = Math.min(inferencePriority, saveInferencePriority);
|
||||
}
|
||||
function inferFromMatchingType(source, targets, matches) {
|
||||
var matched = false;
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
if (matches(source, t)) {
|
||||
inferFromTypes(source, t);
|
||||
matched = true;
|
||||
}
|
||||
}
|
||||
return matched;
|
||||
}
|
||||
function inferFromMatchingTypes(sources, targets, matches) {
|
||||
var matchedSources;
|
||||
var matchedTargets;
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
for (var _i = 0, targets_1 = targets; _i < targets_1.length; _i++) {
|
||||
var t = targets_1[_i];
|
||||
for (var _a = 0, sources_1 = sources; _a < sources_1.length; _a++) {
|
||||
var s = sources_1[_a];
|
||||
if (matches(s, t)) {
|
||||
@@ -46479,8 +46553,8 @@ var ts;
|
||||
// track whether inferences were made from that particular type to some target with
|
||||
// equal priority (i.e. of equal quality) to what we would infer for a naked type
|
||||
// parameter.
|
||||
for (var _i = 0, targets_3 = targets; _i < targets_3.length; _i++) {
|
||||
var t = targets_3[_i];
|
||||
for (var _i = 0, targets_2 = targets; _i < targets_2.length; _i++) {
|
||||
var t = targets_2[_i];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
nakedTypeVariable = t;
|
||||
typeVariableCount++;
|
||||
@@ -46513,8 +46587,8 @@ var ts;
|
||||
// We infer from types that are not naked type variables first so that inferences we
|
||||
// make from nested naked type variables and given slightly higher priority by virtue
|
||||
// of being first in the candidates array.
|
||||
for (var _a = 0, targets_4 = targets; _a < targets_4.length; _a++) {
|
||||
var t = targets_4[_a];
|
||||
for (var _a = 0, targets_3 = targets; _a < targets_3.length; _a++) {
|
||||
var t = targets_3[_a];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
typeVariableCount++;
|
||||
}
|
||||
@@ -46530,8 +46604,8 @@ var ts;
|
||||
if (targetFlags & 2097152 /* Intersection */ ? typeVariableCount === 1 : typeVariableCount > 0) {
|
||||
var savePriority = priority;
|
||||
priority |= 1 /* NakedTypeVariable */;
|
||||
for (var _b = 0, targets_5 = targets; _b < targets_5.length; _b++) {
|
||||
var t = targets_5[_b];
|
||||
for (var _b = 0, targets_4 = targets; _b < targets_4.length; _b++) {
|
||||
var t = targets_4[_b];
|
||||
if (getInferenceInfoForType(t)) {
|
||||
inferFromTypes(source, t);
|
||||
}
|
||||
@@ -51739,7 +51813,7 @@ var ts;
|
||||
if (ts.isJsxOpeningLikeElement(node)) {
|
||||
if (!checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "jsx should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
@@ -51754,7 +51828,7 @@ var ts;
|
||||
var headMessage_1 = ts.Diagnostics.The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1;
|
||||
if (!checkTypeRelatedTo(thisArgumentType, thisType, relation, errorNode, headMessage_1, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "this parameter should have errors when reporting errors");
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
var headMessage = ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1;
|
||||
@@ -51772,7 +51846,7 @@ var ts;
|
||||
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage, containingMessageChain, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(arg, checkArgType, paramType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51782,7 +51856,7 @@ var ts;
|
||||
if (!checkTypeRelatedTo(spreadType, restType, relation, errorNode, headMessage, /*containingMessageChain*/ undefined, errorOutputContainer)) {
|
||||
ts.Debug.assert(!reportErrors || !!errorOutputContainer.errors, "rest parameter should have errors when reporting errors");
|
||||
maybeAddMissingAwaitInfo(errorNode, spreadType, restType);
|
||||
return errorOutputContainer.errors || [];
|
||||
return errorOutputContainer.errors || ts.emptyArray;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
@@ -67595,11 +67669,9 @@ var ts;
|
||||
function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict) {
|
||||
context.startLexicalEnvironment();
|
||||
statements = visitNodes(statements, visitor, ts.isStatement, start);
|
||||
if (ensureUseStrict && !ts.startsWithUseStrict(statements)) {
|
||||
statements = ts.setTextRange(ts.createNodeArray(__spreadArrays([ts.createExpressionStatement(ts.createLiteral("use strict"))], statements)), statements);
|
||||
}
|
||||
var declarations = context.endLexicalEnvironment();
|
||||
return ts.setTextRange(ts.createNodeArray(ts.concatenate(declarations, statements)), statements);
|
||||
if (ensureUseStrict)
|
||||
statements = ts.ensureUseStrict(statements); // tslint:disable-line no-unnecessary-qualifier
|
||||
return ts.mergeLexicalEnvironment(statements, context.endLexicalEnvironment());
|
||||
}
|
||||
ts.visitLexicalEnvironment = visitLexicalEnvironment;
|
||||
/**
|
||||
@@ -86099,6 +86171,8 @@ var ts;
|
||||
}
|
||||
ts.getOutputDeclarationFileName = getOutputDeclarationFileName;
|
||||
function getOutputJSFileName(inputFileName, configFile, ignoreCase) {
|
||||
if (configFile.options.emitDeclarationOnly)
|
||||
return undefined;
|
||||
var isJsonFile = ts.fileExtensionIs(inputFileName, ".json" /* Json */);
|
||||
var outputFileName = ts.changeExtension(getOutputPathWithoutChangingExt(inputFileName, configFile, ignoreCase, configFile.options.outDir), isJsonFile ?
|
||||
".json" /* Json */ :
|
||||
@@ -86130,7 +86204,7 @@ var ts;
|
||||
addOutput(js);
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (configFile.options.sourceMap) {
|
||||
if (js && configFile.options.sourceMap) {
|
||||
addOutput(js + ".map");
|
||||
}
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
@@ -86159,6 +86233,11 @@ var ts;
|
||||
var jsFilePath = getOutputJSFileName(inputFileName, configFile, ignoreCase);
|
||||
if (jsFilePath)
|
||||
return jsFilePath;
|
||||
if (ts.fileExtensionIs(inputFileName, ".json" /* Json */))
|
||||
continue;
|
||||
if (ts.getEmitDeclarations(configFile.options) && ts.hasTSFileExtension(inputFileName)) {
|
||||
return getOutputDeclarationFileName(inputFileName, configFile, ignoreCase);
|
||||
}
|
||||
}
|
||||
var buildInfoPath = getOutputPathForBuildInfo(configFile.options);
|
||||
if (buildInfoPath)
|
||||
@@ -93867,11 +93946,16 @@ var ts;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var emitOutput = ts.getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken);
|
||||
if (emitOutput.outputFiles && emitOutput.outputFiles.length > 0) {
|
||||
latestSignature = computeHash(emitOutput.outputFiles[0].text);
|
||||
var emitOutput_1 = ts.getFileEmitOutput(programOfThisState, sourceFile, /*emitOnlyDtsFiles*/ true, cancellationToken);
|
||||
var firstDts_1 = emitOutput_1.outputFiles &&
|
||||
programOfThisState.getCompilerOptions().declarationMap ?
|
||||
emitOutput_1.outputFiles.length > 1 ? emitOutput_1.outputFiles[1] : undefined :
|
||||
emitOutput_1.outputFiles.length > 0 ? emitOutput_1.outputFiles[0] : undefined;
|
||||
if (firstDts_1) {
|
||||
ts.Debug.assert(ts.fileExtensionIs(firstDts_1.name, ".d.ts" /* Dts */), "File extension for signature expected to be dts", function () { return "Found: " + ts.getAnyExtensionFromPath(firstDts_1.name) + " for " + firstDts_1.name + ":: All output files: " + JSON.stringify(emitOutput_1.outputFiles.map(function (f) { return f.name; })); });
|
||||
latestSignature = computeHash(firstDts_1.text);
|
||||
if (exportedModulesMapCache && latestSignature !== prevSignature) {
|
||||
updateExportedModules(sourceFile, emitOutput.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
updateExportedModules(sourceFile, emitOutput_1.exportedModulesFromDeclarationEmit, exportedModulesMapCache);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -94246,7 +94330,6 @@ var ts;
|
||||
handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
|
||||
return affectedFile;
|
||||
}
|
||||
seenAffectedFiles.set(affectedFile.path, true);
|
||||
affectedFilesIndex++;
|
||||
}
|
||||
// Remove the changed file from the change set
|
||||
@@ -94436,7 +94519,7 @@ var ts;
|
||||
* This is called after completing operation on the next affected file.
|
||||
* The operations here are postponed to ensure that cancellation during the iteration is handled correctly
|
||||
*/
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, isEmitResult) {
|
||||
if (isBuildInfoEmit) {
|
||||
state.emittedBuildInfo = true;
|
||||
}
|
||||
@@ -94446,6 +94529,9 @@ var ts;
|
||||
}
|
||||
else {
|
||||
state.seenAffectedFiles.set(affected.path, true);
|
||||
if (isEmitResult) {
|
||||
(state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
|
||||
}
|
||||
if (isPendingEmit) {
|
||||
state.affectedFilesPendingEmitIndex++;
|
||||
}
|
||||
@@ -94461,6 +94547,13 @@ var ts;
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
/**
|
||||
* Returns the result with affected file
|
||||
*/
|
||||
function toAffectedFileEmitResult(state, result, affected, isPendingEmit, isBuildInfoEmit) {
|
||||
doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit, /*isEmitResult*/ true);
|
||||
return { result: result, affected: affected };
|
||||
}
|
||||
/**
|
||||
* Gets the semantic diagnostics either from cache if present, or otherwise from program and caches it
|
||||
* Note that it is assumed that the when asked about semantic diagnostics, the file has been taken out of affected files/changed file set
|
||||
@@ -94690,7 +94783,7 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
var affected_1 = ts.Debug.assertDefined(state.program);
|
||||
return toAffectedFileResult(state,
|
||||
return toAffectedFileEmitResult(state,
|
||||
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
||||
// Otherwise just affected file
|
||||
affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1,
|
||||
@@ -94709,7 +94802,7 @@ var ts;
|
||||
affected = program;
|
||||
}
|
||||
}
|
||||
return toAffectedFileResult(state,
|
||||
return toAffectedFileEmitResult(state,
|
||||
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
|
||||
// Otherwise just affected file
|
||||
ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
|
||||
@@ -94849,7 +94942,7 @@ var ts;
|
||||
compilerOptions: convertFromReusableCompilerOptions(program.options, toAbsolutePath),
|
||||
referencedMap: getMapOfReferencedSet(program.referencedMap, toPath),
|
||||
exportedModulesMap: getMapOfReferencedSet(program.exportedModulesMap, toPath),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return ts.isString(value) ? value : value[0]; }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
semanticDiagnosticsPerFile: program.semanticDiagnosticsPerFile && ts.arrayToMap(program.semanticDiagnosticsPerFile, function (value) { return toPath(ts.isString(value) ? value : value[0]); }, function (value) { return ts.isString(value) ? ts.emptyArray : value[1]; }),
|
||||
hasReusableDiagnostic: true
|
||||
};
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user