Update LKG

This commit is contained in:
Sheetal Nandi
2019-03-08 15:20:37 -08:00
parent 68e28da141
commit b2cda168fd
9 changed files with 4206 additions and 1113 deletions
@@ -2061,6 +2061,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Convert_to_named_parameters_95075" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Convert to named parameters]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Corrupted_locale_file_0_6051" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Corrupted locale file {0}.]]></Val>
@@ -4521,6 +4527,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Project '{0}' is out of date because output for it was generated with version '{1}' that differs with current version '{2}']]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Project '{0}' is out of date because output of its dependency '{1}' has changed]]></Val>
@@ -6285,6 +6297,12 @@
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type parameter '{0}' of exported mapped object type is using private name '{1}'.]]></Val>
</Str>
<Disp Icon="Str" />
</Item>
<Item ItemId=";Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083" ItemType="0" PsrId="306" Leaf="true">
<Str Cat="Text">
<Val><![CDATA[Type parameter '{0}' of exported type alias has or is using private name '{1}'.]]></Val>
+25
View File
@@ -49,6 +49,7 @@ declare namespace ts.server.protocol {
OpenExternalProject = "openExternalProject",
OpenExternalProjects = "openExternalProjects",
CloseExternalProject = "closeExternalProject",
UpdateOpen = "updateOpen",
GetOutliningSpans = "getOutliningSpans",
TodoComments = "todoComments",
Indentation = "indentation",
@@ -1117,6 +1118,30 @@ declare namespace ts.server.protocol {
*/
interface CloseExternalProjectResponse extends Response {
}
/**
* Request to synchronize list of open files with the client
*/
interface UpdateOpenRequest extends Request {
command: CommandTypes.UpdateOpen;
arguments: UpdateOpenRequestArgs;
}
/**
* Arguments to UpdateOpenRequest
*/
interface UpdateOpenRequestArgs {
/**
* List of newly open files
*/
openFiles?: OpenRequestArgs[];
/**
* List of open files files that were changes
*/
changedFiles?: FileCodeEdits[];
/**
* List of files that were closed
*/
closedFiles?: string[];
}
/**
* Request to set compiler options for inferred projects.
* External projects are opened / closed explicitly.
+268 -109
View File
@@ -902,6 +902,21 @@ var ts;
} };
}
ts.arrayIterator = arrayIterator;
function arrayReverseIterator(array) {
var i = array.length;
return {
next: function () {
if (i === 0) {
return { value: undefined, done: true };
}
else {
i--;
return { value: array[i], done: false };
}
}
};
}
ts.arrayReverseIterator = arrayReverseIterator;
function stableSort(array, comparer) {
var indices = array.map(function (_, i) { return i; });
stableSortIndices(array, indices, comparer);
@@ -2457,6 +2472,7 @@ var ts;
: FileWatcherEventKind.Changed;
}
ts.getFileWatcherEventKind = getFileWatcherEventKind;
ts.ignoredPaths = ["/node_modules/.", "/.git"];
function createRecursiveDirectoryWatcher(host) {
var cache = ts.createMap();
var callbackCache = ts.createMultiMap();
@@ -2472,6 +2488,8 @@ var ts;
else {
directoryWatcher = {
watcher: host.watchDirectory(dirName, function (fileName) {
if (isIgnoredPath(fileName))
return;
callbackCache.forEach(function (callbacks, rootDirName) {
if (rootDirName === dirPath || (ts.startsWith(dirPath, rootDirName) && dirPath[rootDirName.length] === ts.directorySeparator)) {
callbacks.forEach(function (callback) { return callback(fileName); });
@@ -2513,7 +2531,7 @@ var ts;
var newChildWatches;
ts.enumerateInsertsAndDeletes(host.directoryExists(parentDir) ? ts.mapDefined(host.getAccessibleSortedChildDirectories(parentDir), function (child) {
var childFullName = ts.getNormalizedAbsolutePath(child, parentDir);
return filePathComparer(childFullName, ts.normalizePath(host.realpath(childFullName))) === 0 ? childFullName : undefined;
return !isIgnoredPath(childFullName) && filePathComparer(childFullName, ts.normalizePath(host.realpath(childFullName))) === 0 ? childFullName : undefined;
}) : ts.emptyArray, existingChildWatches, function (child, childWatcher) { return filePathComparer(child, childWatcher.dirName); }, createAndAddChildDirectoryWatcher, ts.closeFileWatcher, addChildDirectoryWatcher);
return newChildWatches || ts.emptyArray;
function createAndAddChildDirectoryWatcher(childName) {
@@ -2524,6 +2542,16 @@ var ts;
(newChildWatches || (newChildWatches = [])).push(childWatcher);
}
}
function isIgnoredPath(path) {
return ts.some(ts.ignoredPaths, function (searchPath) { return isInPath(path, searchPath); });
}
function isInPath(path, searchPath) {
if (ts.stringContains(path, searchPath))
return true;
if (host.useCaseSensitiveFileNames)
return false;
return ts.stringContains(toCanonicalFilePath(path), searchPath);
}
}
ts.createRecursiveDirectoryWatcher = createRecursiveDirectoryWatcher;
function getNodeMajorVersion() {
@@ -3804,6 +3832,7 @@ var ts;
Public_method_0_of_exported_class_has_or_is_using_private_name_1: diag(4100, ts.DiagnosticCategory.Error, "Public_method_0_of_exported_class_has_or_is_using_private_name_1_4100", "Public method '{0}' of exported class has or is using private name '{1}'."),
Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4101, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),
Method_0_of_exported_interface_has_or_is_using_private_name_1: diag(4102, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."),
Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1: diag(4103, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103", "Type parameter '{0}' of exported mapped object type is using private name '{1}'."),
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -4080,6 +4109,7 @@ var ts;
Enable_incremental_compilation: diag(6378, ts.DiagnosticCategory.Message, "Enable_incremental_compilation_6378", "Enable incremental compilation"),
Composite_projects_may_not_disable_incremental_compilation: diag(6379, ts.DiagnosticCategory.Error, "Composite_projects_may_not_disable_incremental_compilation_6379", "Composite projects may not disable incremental compilation."),
Specify_file_to_store_incremental_compilation_information: diag(6380, ts.DiagnosticCategory.Message, "Specify_file_to_store_incremental_compilation_information_6380", "Specify file to store incremental compilation information"),
Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2: diag(6381, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381", "Project '{0}' is out of date because output for it was generated with version '{1}' that differs with current version '{2}'"),
The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"),
The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."),
The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."),
@@ -4296,6 +4326,7 @@ var ts;
Add_missing_new_operator_to_all_calls: diag(95072, ts.DiagnosticCategory.Message, "Add_missing_new_operator_to_all_calls_95072", "Add missing 'new' operator to all calls"),
Add_names_to_all_parameters_without_names: diag(95073, ts.DiagnosticCategory.Message, "Add_names_to_all_parameters_without_names_95073", "Add names to all parameters without names"),
Enable_the_experimentalDecorators_option_in_your_configuration_file: diag(95074, ts.DiagnosticCategory.Message, "Enable_the_experimentalDecorators_option_in_your_configuration_file_95074", "Enable the 'experimentalDecorators' option in your configuration file"),
Convert_to_named_parameters: diag(95075, ts.DiagnosticCategory.Message, "Convert_to_named_parameters_95075", "Convert to named parameters"),
};
})(ts || (ts = {}));
var ts;
@@ -25569,10 +25600,10 @@ var ts;
isContextSensitive: isContextSensitive,
getFullyQualifiedName: getFullyQualifiedName,
getResolvedSignature: function (node, candidatesOutArray, agumentCount) {
return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, false);
return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 0);
},
getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, agumentCount) {
return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, true);
return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 16);
},
getConstantValue: function (nodeIn) {
var node = ts.getParseTreeNode(nodeIn, canHaveConstantValue);
@@ -25693,10 +25724,10 @@ var ts;
},
getLocalTypeParametersOfClassOrInterfaceOrTypeAlias: getLocalTypeParametersOfClassOrInterfaceOrTypeAlias,
};
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, isForSignatureHelp) {
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
apparentArgumentCount = argumentCount;
var res = node ? getResolvedSignature(node, candidatesOutArray, isForSignatureHelp) : undefined;
var res = node ? getResolvedSignature(node, candidatesOutArray, checkMode) : undefined;
apparentArgumentCount = undefined;
return res;
}
@@ -28534,7 +28565,7 @@ var ts;
var savedContextFlags = context.flags;
context.flags &= ~512;
var shouldUseGeneratedName = context.flags & 4 &&
type.symbol.declarations[0] &&
type.symbol.declarations && type.symbol.declarations[0] &&
ts.isTypeParameterDeclaration(type.symbol.declarations[0]) &&
typeParameterShadowsNameInScope(type, context);
var name = shouldUseGeneratedName
@@ -32092,8 +32123,21 @@ var ts;
}
return undefined;
}
function getSignatureInstantiation(signature, typeArguments, isJavascript) {
return getSignatureInstantiationWithoutFillingInTypeArguments(signature, fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript));
function getSignatureInstantiation(signature, typeArguments, isJavascript, inferredTypeParameters) {
var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript));
if (inferredTypeParameters) {
var returnSignature = getSingleCallSignature(getReturnTypeOfSignature(instantiatedSignature));
if (returnSignature) {
var newReturnSignature = cloneSignature(returnSignature);
newReturnSignature.typeParameters = inferredTypeParameters;
newReturnSignature.target = returnSignature.target;
newReturnSignature.mapper = returnSignature.mapper;
var newInstantiatedSignature = cloneSignature(instantiatedSignature);
newInstantiatedSignature.resolvedReturnType = getOrCreateTypeFromSignature(newReturnSignature);
return newInstantiatedSignature;
}
}
return instantiatedSignature;
}
function getSignatureInstantiationWithoutFillingInTypeArguments(signature, typeArguments) {
var instantiations = signature.instantiations || (signature.instantiations = ts.createMap());
@@ -32410,7 +32454,7 @@ var ts;
}
function getTypeReferenceTypeWorker(node, symbol, typeArguments) {
if (symbol.flags & (32 | 64)) {
if (symbol.valueDeclaration && ts.isBinaryExpression(symbol.valueDeclaration.parent)) {
if (symbol.valueDeclaration && symbol.valueDeclaration.parent && ts.isBinaryExpression(symbol.valueDeclaration.parent)) {
var jsdocType = getJSDocTypeReference(node, symbol, typeArguments);
if (jsdocType) {
return jsdocType;
@@ -34765,7 +34809,7 @@ var ts;
if (isTupleLikeType(source)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation);
}
var tupleizedType = checkArrayLiteral(node, 3, true);
var tupleizedType = checkArrayLiteral(node, 1, true);
if (isTupleLikeType(tupleizedType)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), tupleizedType, target, relation);
}
@@ -41446,22 +41490,30 @@ var ts;
}
function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper, compareTypes) {
var context = createInferenceContext(signature.typeParameters, signature, 0, compareTypes);
var sourceSignature = contextualMapper ? instantiateSignature(contextualSignature, contextualMapper) : contextualSignature;
var restType = getEffectiveRestType(contextualSignature);
var mapper = contextualMapper && restType && restType.flags & 262144 ? cloneTypeMapper(contextualMapper) : contextualMapper;
var sourceSignature = mapper ? instantiateSignature(contextualSignature, mapper) : contextualSignature;
forEachMatchingParameterType(sourceSignature, signature, function (source, target) {
inferTypes(context.inferences, source, target);
});
if (!contextualMapper) {
inferTypes(context.inferences, getReturnTypeOfSignature(contextualSignature), getReturnTypeOfSignature(signature), 8);
var signaturePredicate = getTypePredicateOfSignature(signature);
var contextualPredicate = getTypePredicateOfSignature(sourceSignature);
if (signaturePredicate && contextualPredicate && signaturePredicate.kind === contextualPredicate.kind &&
(signaturePredicate.kind === 0 || signaturePredicate.parameterIndex === contextualPredicate.parameterIndex)) {
inferTypes(context.inferences, contextualPredicate.type, signaturePredicate.type, 8);
}
}
return getSignatureInstantiation(signature, getInferredTypes(context), ts.isInJSFile(contextualSignature.declaration));
}
function inferJsxTypeArguments(node, signature, excludeArgument, context) {
function inferJsxTypeArguments(node, signature, checkMode, context) {
var paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
var checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, excludeArgument && excludeArgument[0] !== undefined ? identityMapper : context);
var checkAttrType = checkExpressionWithContextualType(node.attributes, paramType, context, checkMode);
inferTypes(context.inferences, checkAttrType, paramType);
return getInferredTypes(context);
}
function inferTypeArguments(node, signature, args, excludeArgument, context) {
function inferTypeArguments(node, signature, args, checkMode, context) {
for (var _i = 0, _a = context.inferences; _i < _a.length; _i++) {
var inference = _a[_i];
if (!inference.isFixed) {
@@ -41469,7 +41521,7 @@ var ts;
}
}
if (ts.isJsxOpeningLikeElement(node)) {
return inferJsxTypeArguments(node, signature, excludeArgument, context);
return inferJsxTypeArguments(node, signature, checkMode, context);
}
if (node.kind !== 152) {
var contextualType = getContextualType(node);
@@ -41496,8 +41548,7 @@ var ts;
var arg = args[i];
if (arg.kind !== 210) {
var paramType = getTypeAtPosition(signature, i);
var mapper = excludeArgument && excludeArgument[i] !== undefined ? identityMapper : context;
var argType = checkExpressionWithContextualType(arg, paramType, mapper);
var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
inferTypes(context.inferences, argType, paramType);
}
}
@@ -41519,7 +41570,7 @@ var ts;
if (isSpreadArgument(arg)) {
return arg.kind === 215 ?
createArrayType(arg.type) :
getArrayifiedType(checkExpressionWithContextualType(arg.expression, restType, context));
getArrayifiedType(checkExpressionWithContextualType(arg.expression, restType, context, 0));
}
}
var contextualType = getIndexTypeOfType(restType, 1) || anyType;
@@ -41527,7 +41578,7 @@ var ts;
var types = [];
var spreadIndex = -1;
for (var i = index; i < argCount; i++) {
var argType = checkExpressionWithContextualType(args[i], contextualType, context);
var argType = checkExpressionWithContextualType(args[i], contextualType, context, 0);
if (spreadIndex < 0 && isSpreadArgument(args[i])) {
spreadIndex = i - index;
}
@@ -41572,14 +41623,14 @@ var ts;
}
return 2;
}
function checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, excludeArgument, reportErrors) {
function checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors) {
var paramType = getEffectiveFirstArgumentForJsxSignature(signature, node);
var attributesType = checkExpressionWithContextualType(node.attributes, paramType, excludeArgument && excludeArgument[0] ? identityMapper : undefined);
var attributesType = checkExpressionWithContextualType(node.attributes, paramType, undefined, checkMode);
return checkTypeRelatedToAndOptionallyElaborate(attributesType, paramType, relation, reportErrors ? node.tagName : undefined, node.attributes);
}
function checkApplicableSignature(node, args, signature, relation, excludeArgument, reportErrors) {
function checkApplicableSignature(node, args, signature, relation, checkMode, reportErrors) {
if (ts.isJsxOpeningLikeElement(node)) {
return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, excludeArgument, reportErrors);
return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors);
}
var thisType = getThisTypeOfSignature(signature);
if (thisType && thisType !== voidType && node.kind !== 192) {
@@ -41598,8 +41649,8 @@ var ts;
var arg = args[i];
if (arg.kind !== 210) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined);
var checkArgType = excludeArgument ? getRegularTypeOfObjectLiteral(argType) : argType;
var argType = checkExpressionWithContextualType(arg, paramType, undefined, checkMode);
var checkArgType = checkMode & 4 ? getRegularTypeOfObjectLiteral(argType) : argType;
if (!checkTypeRelatedToAndOptionallyElaborate(checkArgType, paramType, relation, reportErrors ? arg : undefined, arg, headMessage)) {
return false;
}
@@ -41779,7 +41830,7 @@ var ts;
}
return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
}
function resolveCall(node, signatures, candidatesOutArray, isForSignatureHelp, fallbackError) {
function resolveCall(node, signatures, candidatesOutArray, checkMode, fallbackError) {
var isTaggedTemplate = node.kind === 193;
var isDecorator = node.kind === 152;
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
@@ -41801,12 +41852,12 @@ var ts;
}
var args = getEffectiveCallArguments(node);
var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters;
var excludeArgument = !isDecorator && !isSingleNonGenericCandidate ? getExcludeArgument(args) : undefined;
var argCheckMode = !isDecorator && !isSingleNonGenericCandidate && ts.some(args, isContextSensitive) ? 4 : 0;
var candidateForArgumentError;
var candidateForArgumentArityError;
var candidateForTypeArgumentError;
var result;
var signatureHelpTrailingComma = isForSignatureHelp && node.kind === 191 && node.arguments.hasTrailingComma;
var signatureHelpTrailingComma = !!(checkMode & 16) && node.kind === 191 && node.arguments.hasTrailingComma;
if (candidates.length > 1) {
result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma);
}
@@ -41818,7 +41869,7 @@ var ts;
}
if (reportErrors) {
if (candidateForArgumentError) {
checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, undefined, true);
checkApplicableSignature(node, args, candidateForArgumentError, assignableRelation, 0, true);
}
else if (candidateForArgumentArityError) {
diagnostics.add(getArgumentArityError(node, [candidateForArgumentArityError], args));
@@ -41850,7 +41901,7 @@ var ts;
if (typeArguments || !hasCorrectArity(node, args, candidate, signatureHelpTrailingComma)) {
return undefined;
}
if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) {
if (!checkApplicableSignature(node, args, candidate, relation, 0, false)) {
candidateForArgumentError = candidate;
return undefined;
}
@@ -41874,9 +41925,10 @@ var ts;
}
else {
inferenceContext = createInferenceContext(candidate.typeParameters, candidate, ts.isInJSFile(node) ? 2 : 0);
typeArgumentTypes = inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext);
typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode | 8, inferenceContext);
argCheckMode |= inferenceContext.flags & 8 ? 8 : 0;
}
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration));
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma)) {
candidateForArgumentArityError = checkCandidate;
continue;
@@ -41885,23 +41937,23 @@ var ts;
else {
checkCandidate = candidate;
}
if (!checkApplicableSignature(node, args, checkCandidate, relation, excludeArgument, false)) {
if (!checkApplicableSignature(node, args, checkCandidate, relation, argCheckMode, false)) {
if (!candidateForArgumentError || getEffectiveRestType(candidateForArgumentError) || !getEffectiveRestType(checkCandidate)) {
candidateForArgumentError = checkCandidate;
}
continue;
}
if (excludeArgument) {
excludeArgument = undefined;
if (argCheckMode) {
argCheckMode = 0;
if (inferenceContext) {
var typeArgumentTypes = inferTypeArguments(node, candidate, args, excludeArgument, inferenceContext);
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration));
var typeArgumentTypes = inferTypeArguments(node, candidate, args, argCheckMode, inferenceContext);
checkCandidate = getSignatureInstantiation(candidate, typeArgumentTypes, ts.isInJSFile(candidate.declaration), inferenceContext && inferenceContext.inferredTypeParameters);
if (getNonArrayRestType(candidate) && !hasCorrectArity(node, args, checkCandidate, signatureHelpTrailingComma)) {
candidateForArgumentArityError = checkCandidate;
continue;
}
}
if (!checkApplicableSignature(node, args, checkCandidate, relation, excludeArgument, false)) {
if (!checkApplicableSignature(node, args, checkCandidate, relation, argCheckMode, false)) {
if (!candidateForArgumentError || getEffectiveRestType(candidateForArgumentError) || !getEffectiveRestType(checkCandidate)) {
candidateForArgumentError = checkCandidate;
}
@@ -41914,18 +41966,6 @@ var ts;
return undefined;
}
}
function getExcludeArgument(args) {
var excludeArgument;
for (var i = 0; i < args.length; i++) {
if (isContextSensitive(args[i])) {
if (!excludeArgument) {
excludeArgument = new Array(args.length);
}
excludeArgument[i] = true;
}
}
return excludeArgument;
}
function getCandidateForOverloadFailure(node, candidates, args, hasCandidatesOutArray) {
ts.Debug.assert(candidates.length > 0);
return hasCandidatesOutArray || candidates.length === 1 || candidates.some(function (c) { return !!c.typeParameters; })
@@ -41997,7 +42037,7 @@ var ts;
}
function inferSignatureInstantiationForOverloadFailure(node, typeParameters, candidate, args) {
var inferenceContext = createInferenceContext(typeParameters, candidate, ts.isInJSFile(node) ? 2 : 0);
var typeArgumentTypes = inferTypeArguments(node, candidate, args, getExcludeArgument(args), inferenceContext);
var typeArgumentTypes = inferTypeArguments(node, candidate, args, 4 | 8, inferenceContext);
return createSignatureInstantiation(candidate, typeArgumentTypes);
}
function getLongestCandidateIndex(candidates, argsCount) {
@@ -42016,7 +42056,7 @@ var ts;
}
return maxParamsIndex;
}
function resolveCallExpression(node, candidatesOutArray, isForSignatureHelp) {
function resolveCallExpression(node, candidatesOutArray, checkMode) {
if (node.expression.kind === 98) {
var superType = checkSuperExpression(node.expression);
if (isTypeAny(superType)) {
@@ -42030,7 +42070,7 @@ var ts;
var baseTypeNode = ts.getEffectiveBaseTypeNode(ts.getContainingClass(node));
if (baseTypeNode) {
var baseConstructors = getInstantiatedConstructorsForTypeArguments(superType, baseTypeNode.typeArguments, baseTypeNode);
return resolveCall(node, baseConstructors, candidatesOutArray, isForSignatureHelp);
return resolveCall(node, baseConstructors, candidatesOutArray, checkMode);
}
}
return resolveUntypedCall(node);
@@ -42067,17 +42107,24 @@ var ts;
}
return resolveErrorCall(node);
}
if (checkMode & 8 && !node.typeArguments && callSignatures.some(isGenericFunctionReturningFunction)) {
skippedGenericFunction(node, checkMode);
return resolvingSignature;
}
if (callSignatures.some(function (sig) { return ts.isInJSFile(sig.declaration) && !!ts.getJSDocClassTag(sig.declaration); })) {
error(node, ts.Diagnostics.Value_of_type_0_is_not_callable_Did_you_mean_to_include_new, typeToString(funcType));
return resolveErrorCall(node);
}
return resolveCall(node, callSignatures, candidatesOutArray, isForSignatureHelp);
return resolveCall(node, callSignatures, candidatesOutArray, checkMode);
}
function isGenericFunctionReturningFunction(signature) {
return !!(signature.typeParameters && isFunctionType(getReturnTypeOfSignature(signature)));
}
function isUntypedFunctionCall(funcType, apparentFuncType, numCallSignatures, numConstructSignatures) {
return isTypeAny(funcType) || isTypeAny(apparentFuncType) && !!(funcType.flags & 262144) ||
!numCallSignatures && !numConstructSignatures && !(apparentFuncType.flags & (1048576 | 131072)) && isTypeAssignableTo(funcType, globalFunctionType);
}
function resolveNewExpression(node, candidatesOutArray, isForSignatureHelp) {
function resolveNewExpression(node, candidatesOutArray, checkMode) {
if (node.arguments && languageVersion < 1) {
var spreadIndex = getSpreadArgumentIndex(node.arguments);
if (spreadIndex >= 0) {
@@ -42108,11 +42155,11 @@ var ts;
error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class);
return resolveErrorCall(node);
}
return resolveCall(node, constructSignatures, candidatesOutArray, isForSignatureHelp);
return resolveCall(node, constructSignatures, candidatesOutArray, checkMode);
}
var callSignatures = getSignaturesOfType(expressionType, 0);
if (callSignatures.length) {
var signature = resolveCall(node, callSignatures, candidatesOutArray, isForSignatureHelp);
var signature = resolveCall(node, callSignatures, candidatesOutArray, checkMode);
if (!noImplicitAny) {
if (signature.declaration && !isJSConstructor(signature.declaration) && getReturnTypeOfSignature(signature) !== voidType) {
error(node, ts.Diagnostics.Only_a_void_function_can_be_called_with_the_new_keyword);
@@ -42204,7 +42251,7 @@ var ts;
addRelatedInfo(diagnostic, ts.createDiagnosticForNode(importNode, ts.Diagnostics.Type_originates_at_this_import_A_namespace_style_import_cannot_be_called_or_constructed_and_will_cause_a_failure_at_runtime_Consider_using_a_default_import_or_import_require_here_instead));
}
}
function resolveTaggedTemplateExpression(node, candidatesOutArray, isForSignatureHelp) {
function resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode) {
var tagType = checkExpression(node.tag);
var apparentType = getApparentType(tagType);
if (apparentType === errorType) {
@@ -42219,7 +42266,7 @@ var ts;
invocationError(node, apparentType, 0);
return resolveErrorCall(node);
}
return resolveCall(node, callSignatures, candidatesOutArray, isForSignatureHelp);
return resolveCall(node, callSignatures, candidatesOutArray, checkMode);
}
function getDiagnosticHeadMessageForDecoratorResolution(node) {
switch (node.parent.kind) {
@@ -42238,7 +42285,7 @@ var ts;
return ts.Debug.fail();
}
}
function resolveDecorator(node, candidatesOutArray, isForSignatureHelp) {
function resolveDecorator(node, candidatesOutArray, checkMode) {
var funcType = checkExpression(node.expression);
var apparentType = getApparentType(funcType);
if (apparentType === errorType) {
@@ -42263,7 +42310,7 @@ var ts;
invocationErrorRecovery(apparentType, 0, diag);
return resolveErrorCall(node);
}
return resolveCall(node, callSignatures, candidatesOutArray, isForSignatureHelp, headMessage);
return resolveCall(node, callSignatures, candidatesOutArray, checkMode, headMessage);
}
function createSignatureForJSXIntrinsic(node, result) {
var namespace = getJsxNamespaceAt(node);
@@ -42275,11 +42322,11 @@ var ts;
parameterSymbol.type = result;
return createSignature(declaration, undefined, undefined, [parameterSymbol], typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType, undefined, 1, false, false);
}
function resolveJsxOpeningLikeElement(node, candidatesOutArray, isForSignatureHelp) {
function resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode) {
if (isJsxIntrinsicIdentifier(node.tagName)) {
var result = getIntrinsicAttributesTypeFromJsxOpeningLikeElement(node);
var fakeSignature = createSignatureForJSXIntrinsic(node, result);
checkTypeAssignableToAndOptionallyElaborate(checkExpressionWithContextualType(node.attributes, getEffectiveFirstArgumentForJsxSignature(fakeSignature, node), undefined), result, node.tagName, node.attributes);
checkTypeAssignableToAndOptionallyElaborate(checkExpressionWithContextualType(node.attributes, getEffectiveFirstArgumentForJsxSignature(fakeSignature, node), undefined, 0), result, node.tagName, node.attributes);
return fakeSignature;
}
var exprTypes = checkExpression(node.tagName);
@@ -42295,7 +42342,7 @@ var ts;
error(node.tagName, ts.Diagnostics.JSX_element_type_0_does_not_have_any_construct_or_call_signatures, ts.getTextOfNode(node.tagName));
return resolveErrorCall(node);
}
return resolveCall(node, signatures, candidatesOutArray, isForSignatureHelp);
return resolveCall(node, signatures, candidatesOutArray, checkMode);
}
function isPotentiallyUncalledDecorator(decorator, signatures) {
return signatures.length && ts.every(signatures, function (signature) {
@@ -42304,32 +42351,33 @@ var ts;
signature.parameters.length < getDecoratorArgumentCount(decorator, signature);
});
}
function resolveSignature(node, candidatesOutArray, isForSignatureHelp) {
function resolveSignature(node, candidatesOutArray, checkMode) {
switch (node.kind) {
case 191:
return resolveCallExpression(node, candidatesOutArray, isForSignatureHelp);
return resolveCallExpression(node, candidatesOutArray, checkMode);
case 192:
return resolveNewExpression(node, candidatesOutArray, isForSignatureHelp);
return resolveNewExpression(node, candidatesOutArray, checkMode);
case 193:
return resolveTaggedTemplateExpression(node, candidatesOutArray, isForSignatureHelp);
return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode);
case 152:
return resolveDecorator(node, candidatesOutArray, isForSignatureHelp);
return resolveDecorator(node, candidatesOutArray, checkMode);
case 262:
case 261:
return resolveJsxOpeningLikeElement(node, candidatesOutArray, isForSignatureHelp);
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
}
throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
}
function getResolvedSignature(node, candidatesOutArray, isForSignatureHelp) {
if (isForSignatureHelp === void 0) { isForSignatureHelp = false; }
function getResolvedSignature(node, candidatesOutArray, checkMode) {
var links = getNodeLinks(node);
var cached = links.resolvedSignature;
if (cached && cached !== resolvingSignature && !candidatesOutArray) {
return cached;
}
links.resolvedSignature = resolvingSignature;
var result = resolveSignature(node, candidatesOutArray, isForSignatureHelp);
links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;
var result = resolveSignature(node, candidatesOutArray, checkMode || 0);
if (result !== resolvingSignature) {
links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached;
}
return result;
}
function isJSConstructor(node) {
@@ -42394,10 +42442,13 @@ var ts;
}
return links.inferredClassType;
}
function checkCallExpression(node) {
function checkCallExpression(node, checkMode) {
if (!checkGrammarTypeArguments(node, node.typeArguments))
checkGrammarArguments(node.arguments);
var signature = getResolvedSignature(node);
var signature = getResolvedSignature(node, undefined, checkMode);
if (signature === resolvingSignature) {
return silentNeverType;
}
if (node.expression.kind === 98) {
return voidType;
}
@@ -42826,7 +42877,7 @@ var ts;
var functionFlags = ts.getFunctionFlags(func);
var type;
if (func.body.kind !== 218) {
type = checkExpressionCached(func.body, checkMode);
type = checkExpressionCached(func.body, checkMode && checkMode & ~8);
if (functionFlags & 2) {
type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
}
@@ -42971,7 +43022,7 @@ var ts;
ts.forEachReturnStatement(func.body, function (returnStatement) {
var expr = returnStatement.expression;
if (expr) {
var type = checkExpressionCached(expr, checkMode);
var type = checkExpressionCached(expr, checkMode && checkMode & ~8);
if (functionFlags & 2) {
type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
}
@@ -43040,7 +43091,7 @@ var ts;
function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
ts.Debug.assert(node.kind !== 156 || ts.isObjectLiteralMethod(node));
checkNodeDeferred(node);
if (checkMode === 1 && isContextSensitive(node)) {
if (checkMode && checkMode & 4 && isContextSensitive(node)) {
if (!ts.getEffectiveReturnTypeNode(node) && hasContextSensitiveReturnExpression(node)) {
var links_1 = getNodeLinks(node);
if (links_1.contextFreeType) {
@@ -43071,7 +43122,7 @@ var ts;
var signature = getSignaturesOfType(type, 0)[0];
if (isContextSensitive(node)) {
var contextualMapper = getContextualMapper(node);
if (checkMode === 2) {
if (checkMode && checkMode & 2) {
inferFromAnnotatedParameters(signature, contextualSignature, contextualMapper);
}
var instantiatedContextualSignature = contextualMapper === identityMapper ?
@@ -43895,15 +43946,13 @@ var ts;
}
return node;
}
function checkExpressionWithContextualType(node, contextualType, contextualMapper) {
function checkExpressionWithContextualType(node, contextualType, contextualMapper, checkMode) {
var context = getContextNode(node);
var saveContextualType = context.contextualType;
var saveContextualMapper = context.contextualMapper;
context.contextualType = contextualType;
context.contextualMapper = contextualMapper;
var checkMode = contextualMapper === identityMapper ? 1 :
contextualMapper ? 2 : 3;
var type = checkExpression(node, checkMode);
var type = checkExpression(node, checkMode | 1 | (contextualMapper ? 2 : 0));
var result = maybeTypeOfKind(type, 2944) && isLiteralOfContextualType(type, instantiateContextualType(contextualType, node)) ?
getRegularTypeOfLiteralType(type) : type;
context.contextualType = saveContextualType;
@@ -43913,7 +43962,7 @@ var ts;
function checkExpressionCached(node, checkMode) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
if (checkMode) {
if (checkMode && checkMode !== 0) {
return checkExpression(node, checkMode);
}
var saveFlowLoopStart = flowLoopStart;
@@ -43995,20 +44044,105 @@ var ts;
return instantiateTypeWithSingleGenericCallSignature(node, uninstantiatedType, checkMode);
}
function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) {
if (checkMode === 2) {
if (checkMode && checkMode & (2 | 8)) {
var signature = getSingleCallSignature(type);
if (signature && signature.typeParameters) {
if (checkMode & 8) {
skippedGenericFunction(node, checkMode);
return anyFunctionType;
}
var contextualType = getApparentTypeOfContextualType(node);
if (contextualType) {
var contextualSignature = getSingleCallSignature(getNonNullableType(contextualType));
if (contextualSignature && !contextualSignature.typeParameters) {
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, getContextualMapper(node)));
var context = getContextualMapper(node);
var returnSignature = context.signature && getSingleCallSignature(getReturnTypeOfSignature(context.signature));
if (returnSignature && !returnSignature.typeParameters && !ts.every(context.inferences, hasInferenceCandidates)) {
var uniqueTypeParameters = getUniqueTypeParameters(context, signature.typeParameters);
var strippedType = getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(signature, uniqueTypeParameters));
var inferences = ts.map(context.typeParameters, createInferenceInfo);
inferTypes(inferences, strippedType, contextualType);
if (ts.some(inferences, hasInferenceCandidates) && !hasOverlappingInferences(context.inferences, inferences)) {
mergeInferences(context.inferences, inferences);
context.inferredTypeParameters = ts.concatenate(context.inferredTypeParameters, uniqueTypeParameters);
return strippedType;
}
}
return getOrCreateTypeFromSignature(instantiateSignatureInContextOf(signature, contextualSignature, context));
}
}
}
}
return type;
}
function skippedGenericFunction(node, checkMode) {
if (checkMode & 2) {
var context = getContextualMapper(node);
context.flags |= 8;
}
}
function hasInferenceCandidates(info) {
return !!(info.candidates || info.contraCandidates);
}
function hasOverlappingInferences(a, b) {
for (var i = 0; i < a.length; i++) {
if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) {
return true;
}
}
return false;
}
function mergeInferences(target, source) {
for (var i = 0; i < target.length; i++) {
if (!hasInferenceCandidates(target[i]) && hasInferenceCandidates(source[i])) {
target[i] = source[i];
}
}
}
function getUniqueTypeParameters(context, typeParameters) {
var result = [];
var oldTypeParameters;
var newTypeParameters;
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
var tp = typeParameters_2[_i];
var name = tp.symbol.escapedName;
if (hasTypeParameterByName(context.inferredTypeParameters, name) || hasTypeParameterByName(result, name)) {
var newName = getUniqueTypeParameterName(ts.concatenate(context.inferredTypeParameters, result), name);
var symbol = createSymbol(262144, newName);
var newTypeParameter = createTypeParameter(symbol);
newTypeParameter.target = tp;
oldTypeParameters = ts.append(oldTypeParameters, tp);
newTypeParameters = ts.append(newTypeParameters, newTypeParameter);
result.push(newTypeParameter);
}
else {
result.push(tp);
}
}
if (newTypeParameters) {
var mapper = createTypeMapper(oldTypeParameters, newTypeParameters);
for (var _a = 0, newTypeParameters_1 = newTypeParameters; _a < newTypeParameters_1.length; _a++) {
var tp = newTypeParameters_1[_a];
tp.mapper = mapper;
}
}
return result;
}
function hasTypeParameterByName(typeParameters, name) {
return ts.some(typeParameters, function (tp) { return tp.symbol.escapedName === name; });
}
function getUniqueTypeParameterName(typeParameters, baseName) {
var len = baseName.length;
while (len > 1 && baseName.charCodeAt(len - 1) >= 48 && baseName.charCodeAt(len - 1) <= 57)
len--;
var s = baseName.slice(0, len);
for (var index = 1; true; index++) {
var augmentedName = (s + index);
if (!hasTypeParameterByName(typeParameters, augmentedName)) {
return augmentedName;
}
}
}
function getTypeOfExpression(node, cache) {
var expr = ts.skipParentheses(node);
if (expr.kind === 191 && expr.expression.kind !== 98 && !ts.isRequireCall(expr, true) && !isSymbolOrSymbolForCall(expr)) {
@@ -44030,7 +44164,7 @@ var ts;
}
var saveContextualType = node.contextualType;
node.contextualType = anyType;
var type = links.contextFreeType = checkExpression(node, 1);
var type = links.contextFreeType = checkExpression(node, 4);
node.contextualType = saveContextualType;
return type;
}
@@ -44110,7 +44244,7 @@ var ts;
return checkImportCallExpression(node);
}
case 192:
return checkCallExpression(node);
return checkCallExpression(node, checkMode);
case 193:
return checkTaggedTemplateExpression(node);
case 195:
@@ -45575,8 +45709,8 @@ var ts;
return;
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
var seenParentsWithEveryUnused = new ts.NodeSet();
for (var _i = 0, typeParameters_2 = typeParameters; _i < typeParameters_2.length; _i++) {
var typeParameter = typeParameters_2[_i];
for (var _i = 0, typeParameters_3 = typeParameters; _i < typeParameters_3.length; _i++) {
var typeParameter = typeParameters_3[_i];
if (!isTypeParameterUnused(typeParameter))
continue;
var name = ts.idText(typeParameter.name);
@@ -52917,10 +53051,10 @@ var ts;
return result !== undefined ? result : "/* Input file " + path + " was missing */\r\n";
};
var buildInfo_1;
var getBuildInfo_1 = function (getText) {
var getAndCacheBuildInfo_1 = function (getText) {
if (buildInfo_1 === undefined) {
var result = getText();
buildInfo_1 = result !== undefined ? JSON.parse(result) : false;
buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false;
}
return buildInfo_1 || undefined;
};
@@ -52934,7 +53068,7 @@ var ts;
javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
declarationText: { get: function () { return definedTextGetter_1(ts.Debug.assertDefined(javascriptMapTextOrDeclarationPath)); } },
declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
buildInfo: { get: function () { return getBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
});
}
else {
@@ -65687,6 +65821,9 @@ var ts;
case 241:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
case 181:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1;
break;
case 166:
case 161:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
@@ -67256,7 +67393,7 @@ var ts;
emitSkipped = true;
return;
}
ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program }), false);
ts.writeFile(host, emitterDiagnostics, buildInfoPath, getBuildInfoText({ bundle: bundle, program: program, version: ts.version }), false);
}
function emitJsFileOrBundle(sourceFileOrBundle, jsFilePath, sourceMapFilePath) {
if (!sourceFileOrBundle || emitOnlyDtsFiles || !jsFilePath) {
@@ -67446,6 +67583,10 @@ var ts;
return JSON.stringify(buildInfo, undefined, 2);
}
ts.getBuildInfoText = getBuildInfoText;
function getBuildInfo(buildInfoText) {
return JSON.parse(buildInfoText);
}
ts.getBuildInfo = getBuildInfo;
ts.notImplementedResolver = {
hasGlobalName: ts.notImplemented,
getReferencedExportContainer: ts.notImplemented,
@@ -67524,7 +67665,7 @@ var ts;
var declarationMapText = declarationMapPath && host.readFile(declarationMapPath);
if ((declarationMapPath && !declarationMapText) || config.options.inlineSourceMap)
return declarationMapPath || "inline sourcemap decoding";
var buildInfo = JSON.parse(buildInfoText);
var buildInfo = getBuildInfo(buildInfoText);
if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationText && !buildInfo.bundle.dts))
return buildInfoPath;
var ownPrependInput = ts.createInputFiles(jsFileText, declarationText, sourceMapFilePath, sourceMapText, declarationMapPath, declarationMapText, jsFilePath, declarationFilePath, buildInfoPath, buildInfo, true);
@@ -67554,7 +67695,7 @@ var ts;
return;
break;
case buildInfoPath:
var newBuildInfo = JSON.parse(text);
var newBuildInfo = getBuildInfo(text);
newBuildInfo.program = buildInfo.program;
var _a = buildInfo.bundle, js = _a.js, dts = _a.dts, sourceFiles = _a.sourceFiles;
newBuildInfo.bundle.js.sources = js.sources;
@@ -67573,7 +67714,7 @@ var ts;
return;
break;
default:
ts.Debug.assertNever(name);
ts.Debug.fail("Unexpected path: " + name);
}
outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark });
},
@@ -74604,7 +74745,7 @@ var ts;
var computeHash = host.createHash || ts.generateDjb2Hash;
var state = createBuilderProgramState(newProgram, getCanonicalFileName, oldState);
var backupState;
newProgram.getProgramBuildInfo = function () { return result.getProgramBuildInfo(); };
newProgram.getProgramBuildInfo = function () { return getProgramBuildInfo(state); };
newProgram = undefined;
oldProgram = undefined;
oldState = undefined;
@@ -74625,7 +74766,6 @@ var ts;
releaseCache(state);
backupState = undefined;
};
result.getProgramBuildInfo = function () { return getProgramBuildInfo(state); };
if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
result.getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
}
@@ -74781,7 +74921,6 @@ var ts;
getCurrentDirectory: ts.notImplemented,
emitNextAffectedFile: ts.notImplemented,
getSemanticDiagnosticsOfNextAffectedFile: ts.notImplemented,
getProgramBuildInfo: ts.notImplemented
};
}
ts.createBuildProgramUsingProgramBuildInfo = createBuildProgramUsingProgramBuildInfo;
@@ -74805,7 +74944,6 @@ var ts;
emit: function (sourceFile, writeFile, cancellationToken, emitOnlyDts, customTransformers) { return getProgram().emit(sourceFile, writeFile, cancellationToken, emitOnlyDts, customTransformers); },
getAllDependencies: ts.notImplemented,
getCurrentDirectory: function () { return getProgram().getCurrentDirectory(); },
getProgramBuildInfo: function () { return undefined; }
};
function getProgram() {
return ts.Debug.assertDefined(state.program);
@@ -74830,10 +74968,10 @@ var ts;
})(ts || (ts = {}));
var ts;
(function (ts) {
function isPathInNodeModulesStartingWithDot(path) {
return ts.stringContains(path, "/node_modules/.");
function isPathIgnored(path) {
return ts.some(ts.ignoredPaths, function (searchPath) { return ts.stringContains(path, searchPath); });
}
ts.isPathInNodeModulesStartingWithDot = isPathInNodeModulesStartingWithDot;
ts.isPathIgnored = isPathIgnored;
ts.maxNumberOfFilesToIterateForInvalidation = 256;
function createResolutionCache(resolutionHost, rootDirForResolution, logChangesWhenResolvingModule) {
var filesWithChangedSetOfUnresolvedImports;
@@ -75293,7 +75431,7 @@ var ts;
isChangedFailedLookupLocation = function (location) { return isInDirectoryPath(fileOrDirectoryPath, resolutionHost.toPath(location)); };
}
else {
if (isPathInNodeModulesStartingWithDot(fileOrDirectoryPath))
if (isPathIgnored(fileOrDirectoryPath))
return false;
var dirOfFileOrDirectory = ts.getDirectoryPath(fileOrDirectoryPath);
if (isNodeModulesAtTypesDirectory(fileOrDirectoryPath) || isNodeModulesDirectory(fileOrDirectoryPath) ||
@@ -76337,7 +76475,7 @@ var ts;
cachedDirectoryStructureHost.addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath);
}
nextSourceFileVersion(fileOrDirectoryPath);
if (ts.isPathInNodeModulesStartingWithDot(fileOrDirectoryPath))
if (ts.isPathIgnored(fileOrDirectoryPath))
return;
if (fileOrDirectoryPath !== directory && ts.hasExtension(fileOrDirectoryPath) && !ts.isSupportedSourceFileName(fileOrDirectory, compilerOptions)) {
writeLog("Project: " + configFileName + " Detected file add/remove of non supported extension: " + fileOrDirectory);
@@ -76380,7 +76518,8 @@ var ts;
UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 7] = "UpstreamOutOfDate";
UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 8] = "UpstreamBlocked";
UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 9] = "ComputingUpstream";
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 10] = "ContainerOnly";
UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 10] = "TsVersionOutputOfDate";
UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 11] = "ContainerOnly";
})(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {}));
function createFileMap(toPath) {
var lookup = ts.createMap();
@@ -76549,6 +76688,7 @@ var ts;
}
return result;
};
var buildInfoChecked = createFileMap(toPath);
var builderPrograms = createFileMap(toPath);
var diagnostics = createFileMap(toPath);
var projectPendingBuild = createFileMap(toPath);
@@ -76584,6 +76724,7 @@ var ts;
projectStatus.clear();
missingRoots.clear();
globalDependencyGraph = undefined;
buildInfoChecked.clear();
diagnostics.clear();
projectPendingBuild.clear();
projectErrorsReported.clear();
@@ -76839,6 +76980,20 @@ var ts;
newerInputFileName: newestInputFileName
};
}
if (!buildInfoChecked.hasKey(project.options.configFilePath)) {
buildInfoChecked.setValue(project.options.configFilePath, true);
var buildInfoPath = ts.getOutputPathForBuildInfo(project.options);
if (buildInfoPath) {
var value = readFileWithCache(buildInfoPath);
var buildInfo = value && ts.getBuildInfo(value);
if (buildInfo && buildInfo.version !== ts.version) {
return {
type: UpToDateStatusType.TsVersionOutputOfDate,
version: buildInfo.version
};
}
}
}
if (usesPrepend && pseudoUpToDate) {
return {
type: UpToDateStatusType.OutOfDateWithPrepend,
@@ -77151,7 +77306,9 @@ var ts;
var content = readFileWithCache(buildInfoPath);
if (!content)
return undefined;
var buildInfo = JSON.parse(content);
var buildInfo = ts.getBuildInfo(content);
if (buildInfo.version !== ts.version)
return undefined;
return buildInfo.program && ts.createBuildProgramUsingProgramBuildInfo(buildInfo.program);
}
function updateBundle(proj) {
@@ -77415,6 +77572,8 @@ var ts;
return formatMessage(ts.Diagnostics.Project_0_can_t_be_built_because_its_dependency_1_has_errors, relName(configFileName), relName(status.upstreamProjectName));
case UpToDateStatusType.Unbuildable:
return formatMessage(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, relName(configFileName), status.reason);
case UpToDateStatusType.TsVersionOutputOfDate:
return formatMessage(ts.Diagnostics.Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_current_version_2, relName(configFileName), status.version, ts.version);
case UpToDateStatusType.ContainerOnly:
case UpToDateStatusType.ComputingUpstream:
break;
+940 -242
View File
File diff suppressed because it is too large Load Diff
+29
View File
@@ -5769,6 +5769,7 @@ declare namespace ts.server.protocol {
OpenExternalProject = "openExternalProject",
OpenExternalProjects = "openExternalProjects",
CloseExternalProject = "closeExternalProject",
UpdateOpen = "updateOpen",
GetOutliningSpans = "getOutliningSpans",
TodoComments = "todoComments",
Indentation = "indentation",
@@ -6837,6 +6838,30 @@ declare namespace ts.server.protocol {
*/
interface CloseExternalProjectResponse extends Response {
}
/**
* Request to synchronize list of open files with the client
*/
interface UpdateOpenRequest extends Request {
command: CommandTypes.UpdateOpen;
arguments: UpdateOpenRequestArgs;
}
/**
* Arguments to UpdateOpenRequest
*/
interface UpdateOpenRequestArgs {
/**
* List of newly open files
*/
openFiles?: OpenRequestArgs[];
/**
* List of open files files that were changes
*/
changedFiles?: FileCodeEdits[];
/**
* List of files that were closed
*/
closedFiles?: string[];
}
/**
* Request to set compiler options for inferred projects.
* External projects are opened / closed explicitly.
@@ -8676,6 +8701,7 @@ declare namespace ts.server {
*/
private onConfigFileChangeForOpenScriptInfo;
private removeProject;
private assignOrphanScriptInfosToInferredProject;
/**
* Remove this file from the set of open, non-configured files.
* @param info The file that has been closed or newly configured
@@ -8794,6 +8820,9 @@ declare namespace ts.server {
*/
openClientFile(fileName: string, fileContent?: string, scriptKind?: ScriptKind, projectRootPath?: string): OpenConfiguredProjectResult;
private findExternalProjectContainingOpenScriptInfo;
private getOrCreateOpenScriptInfo;
private assignProjectToOpenedScriptInfo;
private cleanupAfterOpeningFile;
openClientFileWithNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, projectRootPath?: NormalizedPath): OpenConfiguredProjectResult;
private removeOrphanConfiguredProjects;
private removeOrphanScriptInfos;
+940 -242
View File
File diff suppressed because it is too large Load Diff
+835 -197
View File
File diff suppressed because it is too large Load Diff
+835 -197
View File
File diff suppressed because it is too large Load Diff
+316 -126
View File
File diff suppressed because it is too large Load Diff