mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 20:51:43 -06:00
Update LKG
This commit is contained in:
parent
e9814f8a2f
commit
a6decf98bf
9
lib/lib.es2016.array.include.d.ts
vendored
9
lib/lib.es2016.array.include.d.ts
vendored
@ -27,6 +27,15 @@ interface Array<T> {
|
||||
includes(searchElement: T, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface ReadonlyArray<T> {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
* @param searchElement The element to search for.
|
||||
* @param fromIndex The position in this array at which to begin searching for searchElement.
|
||||
*/
|
||||
includes(searchElement: T, fromIndex?: number): boolean;
|
||||
}
|
||||
|
||||
interface Int8Array {
|
||||
/**
|
||||
* Determines whether an array includes a certain element, returning true or false as appropriate.
|
||||
|
||||
31
lib/protocol.d.ts
vendored
31
lib/protocol.d.ts
vendored
@ -711,6 +711,10 @@ declare namespace ts.server.protocol {
|
||||
* List of removed files
|
||||
*/
|
||||
removed: string[];
|
||||
/**
|
||||
* List of updated files
|
||||
*/
|
||||
updated: string[];
|
||||
}
|
||||
/**
|
||||
* Information found in a configure request.
|
||||
@ -729,6 +733,10 @@ declare namespace ts.server.protocol {
|
||||
* The format options to use during formatting and other code editing features.
|
||||
*/
|
||||
formatOptions?: FormatCodeSettings;
|
||||
/**
|
||||
* The host's additional supported file extensions
|
||||
*/
|
||||
extraFileExtensions?: FileExtensionInfo[];
|
||||
}
|
||||
/**
|
||||
* Configure request; value of command field is "configure". Specifies
|
||||
@ -957,6 +965,10 @@ declare namespace ts.server.protocol {
|
||||
* Documentation associated with symbol.
|
||||
*/
|
||||
documentation: string;
|
||||
/**
|
||||
* JSDoc tags associated with symbol.
|
||||
*/
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
/**
|
||||
* Quickinfo response message.
|
||||
@ -1158,6 +1170,10 @@ declare namespace ts.server.protocol {
|
||||
* Documentation strings for the symbol.
|
||||
*/
|
||||
documentation: SymbolDisplayPart[];
|
||||
/**
|
||||
* JSDoc tags for the symbol.
|
||||
*/
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
interface CompletionsResponse extends Response {
|
||||
body?: CompletionEntry[];
|
||||
@ -1214,6 +1230,10 @@ declare namespace ts.server.protocol {
|
||||
* The signature's documentation
|
||||
*/
|
||||
documentation: SymbolDisplayPart[];
|
||||
/**
|
||||
* The signature's JSDoc tags
|
||||
*/
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
/**
|
||||
* Signature help items found in the response of a signature help request.
|
||||
@ -1846,6 +1866,17 @@ declare namespace ts.server.protocol {
|
||||
[option: string]: string[] | boolean | undefined;
|
||||
}
|
||||
|
||||
interface FileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
|
||||
interface JSDocTagInfo {
|
||||
name: string;
|
||||
text?: string;
|
||||
}
|
||||
|
||||
interface MapLike<T> {
|
||||
[index: string]: T;
|
||||
}
|
||||
|
||||
438
lib/tsc.js
438
lib/tsc.js
@ -132,7 +132,7 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.version = "2.1.4";
|
||||
ts.version = "2.1.5";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
var createObject = Object.create;
|
||||
@ -813,15 +813,6 @@ var ts;
|
||||
return result;
|
||||
}
|
||||
ts.reduceProperties = reduceProperties;
|
||||
function reduceOwnProperties(map, callback, initial) {
|
||||
var result = initial;
|
||||
for (var key in map)
|
||||
if (hasOwnProperty.call(map, key)) {
|
||||
result = callback(result, map[key], String(key));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
ts.reduceOwnProperties = reduceOwnProperties;
|
||||
function equalOwnProperties(left, right, equalityComparer) {
|
||||
if (left === right)
|
||||
return true;
|
||||
@ -1668,8 +1659,19 @@ var ts;
|
||||
ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"];
|
||||
ts.supportedJavascriptExtensions = [".js", ".jsx"];
|
||||
var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions);
|
||||
function getSupportedExtensions(options) {
|
||||
return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions;
|
||||
function getSupportedExtensions(options, extraFileExtensions) {
|
||||
var needAllExtensions = options && options.allowJs;
|
||||
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
||||
return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions;
|
||||
}
|
||||
var extensions = (needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).slice(0);
|
||||
for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) {
|
||||
var extInfo = extraFileExtensions_1[_i];
|
||||
if (needAllExtensions || extInfo.scriptKind === 3) {
|
||||
extensions.push(extInfo.extension);
|
||||
}
|
||||
}
|
||||
return extensions;
|
||||
}
|
||||
ts.getSupportedExtensions = getSupportedExtensions;
|
||||
function hasJavaScriptFileExtension(fileName) {
|
||||
@ -1680,11 +1682,11 @@ var ts;
|
||||
return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); });
|
||||
}
|
||||
ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension;
|
||||
function isSupportedSourceFileName(fileName, compilerOptions) {
|
||||
function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) {
|
||||
if (!fileName) {
|
||||
return false;
|
||||
}
|
||||
for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) {
|
||||
var extension = _a[_i];
|
||||
if (fileExtensionIs(fileName, extension)) {
|
||||
return true;
|
||||
@ -3202,6 +3204,7 @@ var ts;
|
||||
JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." },
|
||||
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
|
||||
Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." },
|
||||
super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." },
|
||||
Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" },
|
||||
A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." },
|
||||
The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." },
|
||||
@ -4801,6 +4804,7 @@ var ts;
|
||||
writeSpace: writeText,
|
||||
writeStringLiteral: writeText,
|
||||
writeParameter: writeText,
|
||||
writeProperty: writeText,
|
||||
writeSymbol: writeText,
|
||||
writeLine: function () { return str_1 += " "; },
|
||||
increaseIndent: ts.noop,
|
||||
@ -5435,6 +5439,18 @@ var ts;
|
||||
}
|
||||
}
|
||||
ts.forEachYieldExpression = forEachYieldExpression;
|
||||
function getRestParameterElementType(node) {
|
||||
if (node && node.kind === 162) {
|
||||
return node.elementType;
|
||||
}
|
||||
else if (node && node.kind === 157) {
|
||||
return ts.singleOrUndefined(node.typeArguments);
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
ts.getRestParameterElementType = getRestParameterElementType;
|
||||
function isVariableLike(node) {
|
||||
if (node) {
|
||||
switch (node.kind) {
|
||||
@ -6051,6 +6067,7 @@ var ts;
|
||||
cache = ts.concatenate(cache, node.jsDoc);
|
||||
}
|
||||
}
|
||||
ts.getJSDocs = getJSDocs;
|
||||
function getJSDocParameterTags(param) {
|
||||
if (!isParameter(param)) {
|
||||
return undefined;
|
||||
@ -7406,39 +7423,6 @@ var ts;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
ts.stringify = typeof JSON !== "undefined" && JSON.stringify
|
||||
? JSON.stringify
|
||||
: stringifyFallback;
|
||||
function stringifyFallback(value) {
|
||||
return value === undefined ? undefined : stringifyValue(value);
|
||||
}
|
||||
function stringifyValue(value) {
|
||||
return typeof value === "string" ? "\"" + escapeString(value) + "\""
|
||||
: typeof value === "number" ? isFinite(value) ? String(value) : "null"
|
||||
: typeof value === "boolean" ? value ? "true" : "false"
|
||||
: typeof value === "object" && value ? ts.isArray(value) ? cycleCheck(stringifyArray, value) : cycleCheck(stringifyObject, value)
|
||||
: "null";
|
||||
}
|
||||
function cycleCheck(cb, value) {
|
||||
ts.Debug.assert(!value.hasOwnProperty("__cycle"), "Converting circular structure to JSON");
|
||||
value.__cycle = true;
|
||||
var result = cb(value);
|
||||
delete value.__cycle;
|
||||
return result;
|
||||
}
|
||||
function stringifyArray(value) {
|
||||
return "[" + ts.reduceLeft(value, stringifyElement, "") + "]";
|
||||
}
|
||||
function stringifyElement(memo, value) {
|
||||
return (memo ? memo + "," : memo) + stringifyValue(value);
|
||||
}
|
||||
function stringifyObject(value) {
|
||||
return "{" + ts.reduceOwnProperties(value, stringifyProperty, "") + "}";
|
||||
}
|
||||
function stringifyProperty(memo, value, key) {
|
||||
return value === undefined || typeof value === "function" || key === "__cycle" ? memo
|
||||
: (memo ? memo + "," : memo) + ("\"" + escapeString(key) + "\":" + stringifyValue(value));
|
||||
}
|
||||
var base64Digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
|
||||
function convertToBase64(input) {
|
||||
var result = "";
|
||||
@ -15688,7 +15672,7 @@ var ts;
|
||||
break;
|
||||
case 38:
|
||||
var asterisk = scanner.getTokenText();
|
||||
if (state === 1) {
|
||||
if (state === 1 || state === 2) {
|
||||
state = 2;
|
||||
pushComment(asterisk);
|
||||
}
|
||||
@ -15703,7 +15687,10 @@ var ts;
|
||||
break;
|
||||
case 5:
|
||||
var whitespace = scanner.getTokenText();
|
||||
if (state === 2 || margin !== undefined && indent + whitespace.length > margin) {
|
||||
if (state === 2) {
|
||||
comments.push(whitespace);
|
||||
}
|
||||
else if (margin !== undefined && indent + whitespace.length > margin) {
|
||||
comments.push(whitespace.slice(margin - indent - 1));
|
||||
}
|
||||
indent += whitespace.length;
|
||||
@ -15711,6 +15698,7 @@ var ts;
|
||||
case 1:
|
||||
break;
|
||||
default:
|
||||
state = 2;
|
||||
pushComment(scanner.getTokenText());
|
||||
break;
|
||||
}
|
||||
@ -15800,7 +15788,7 @@ var ts;
|
||||
}
|
||||
function parseTagComments(indent) {
|
||||
var comments = [];
|
||||
var state = 1;
|
||||
var state = 0;
|
||||
var margin;
|
||||
function pushComment(text) {
|
||||
if (!margin) {
|
||||
@ -20565,9 +20553,8 @@ var ts;
|
||||
}
|
||||
if (!isRelative && resolvedModule && !ts.extensionIsTypeScript(resolvedModule.extension)) {
|
||||
if (isForAugmentation) {
|
||||
ts.Debug.assert(!!moduleNotFoundError);
|
||||
var diag = ts.Diagnostics.Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented;
|
||||
error(errorNode, diag, moduleName, resolvedModule.resolvedFileName);
|
||||
error(errorNode, diag, moduleReference, resolvedModule.resolvedFileName);
|
||||
}
|
||||
else if (compilerOptions.noImplicitAny && moduleNotFoundError) {
|
||||
error(errorNode, ts.Diagnostics.Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type, moduleReference, resolvedModule.resolvedFileName);
|
||||
@ -20796,6 +20783,16 @@ var ts;
|
||||
}
|
||||
function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing) {
|
||||
function getAccessibleSymbolChainFromSymbolTable(symbols) {
|
||||
return getAccessibleSymbolChainFromSymbolTableWorker(symbols, []);
|
||||
}
|
||||
function getAccessibleSymbolChainFromSymbolTableWorker(symbols, visitedSymbolTables) {
|
||||
if (ts.contains(visitedSymbolTables, symbols)) {
|
||||
return undefined;
|
||||
}
|
||||
visitedSymbolTables.push(symbols);
|
||||
var result = trySymbolTable(symbols);
|
||||
visitedSymbolTables.pop();
|
||||
return result;
|
||||
function canQualifySymbol(symbolFromSymbolTable, meaning) {
|
||||
if (!needsQualification(symbolFromSymbolTable, enclosingDeclaration, meaning)) {
|
||||
return true;
|
||||
@ -20809,26 +20806,28 @@ var ts;
|
||||
canQualifySymbol(symbolFromSymbolTable, meaning);
|
||||
}
|
||||
}
|
||||
if (isAccessible(symbols[symbol.name])) {
|
||||
return [symbol];
|
||||
}
|
||||
return ts.forEachProperty(symbols, function (symbolFromSymbolTable) {
|
||||
if (symbolFromSymbolTable.flags & 8388608
|
||||
&& symbolFromSymbolTable.name !== "export="
|
||||
&& !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) {
|
||||
if (!useOnlyExternalAliasing ||
|
||||
ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) {
|
||||
var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
|
||||
if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) {
|
||||
return [symbolFromSymbolTable];
|
||||
}
|
||||
var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTable(resolvedImportedSymbol.exports) : undefined;
|
||||
if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
|
||||
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
|
||||
function trySymbolTable(symbols) {
|
||||
if (isAccessible(symbols[symbol.name])) {
|
||||
return [symbol];
|
||||
}
|
||||
return ts.forEachProperty(symbols, function (symbolFromSymbolTable) {
|
||||
if (symbolFromSymbolTable.flags & 8388608
|
||||
&& symbolFromSymbolTable.name !== "export="
|
||||
&& !ts.getDeclarationOfKind(symbolFromSymbolTable, 243)) {
|
||||
if (!useOnlyExternalAliasing ||
|
||||
ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) {
|
||||
var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
|
||||
if (isAccessible(symbolFromSymbolTable, resolveAlias(symbolFromSymbolTable))) {
|
||||
return [symbolFromSymbolTable];
|
||||
}
|
||||
var accessibleSymbolsFromExports = resolvedImportedSymbol.exports ? getAccessibleSymbolChainFromSymbolTableWorker(resolvedImportedSymbol.exports, visitedSymbolTables) : undefined;
|
||||
if (accessibleSymbolsFromExports && canQualifySymbol(symbolFromSymbolTable, getQualifiedLeftMeaning(meaning))) {
|
||||
return [symbolFromSymbolTable].concat(accessibleSymbolsFromExports);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
if (symbol) {
|
||||
if (!(isPropertyOrMethodDeclarationSymbol(symbol))) {
|
||||
@ -21550,7 +21549,7 @@ var ts;
|
||||
}
|
||||
ts.Debug.assert(bindingElement.kind === 174);
|
||||
if (bindingElement.propertyName) {
|
||||
writer.writeSymbol(ts.getTextOfNode(bindingElement.propertyName), bindingElement.symbol);
|
||||
writer.writeProperty(ts.getTextOfNode(bindingElement.propertyName));
|
||||
writePunctuation(writer, 55);
|
||||
writeSpace(writer);
|
||||
}
|
||||
@ -22165,16 +22164,7 @@ var ts;
|
||||
type = getWidenedTypeForVariableLikeDeclaration(declaration, true);
|
||||
}
|
||||
if (!popTypeResolution()) {
|
||||
if (symbol.valueDeclaration.type) {
|
||||
type = unknownType;
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
||||
}
|
||||
else {
|
||||
type = anyType;
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
|
||||
}
|
||||
}
|
||||
type = reportCircularityError(symbol);
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
@ -22286,10 +22276,27 @@ var ts;
|
||||
function getTypeOfInstantiatedSymbol(symbol) {
|
||||
var links = getSymbolLinks(symbol);
|
||||
if (!links.type) {
|
||||
links.type = instantiateType(getTypeOfSymbol(links.target), links.mapper);
|
||||
if (!pushTypeResolution(symbol, 0)) {
|
||||
return unknownType;
|
||||
}
|
||||
var type = instantiateType(getTypeOfSymbol(links.target), links.mapper);
|
||||
if (!popTypeResolution()) {
|
||||
type = reportCircularityError(symbol);
|
||||
}
|
||||
links.type = type;
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
function reportCircularityError(symbol) {
|
||||
if (symbol.valueDeclaration.type) {
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
|
||||
return unknownType;
|
||||
}
|
||||
if (compilerOptions.noImplicitAny) {
|
||||
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
|
||||
}
|
||||
return anyType;
|
||||
}
|
||||
function getTypeOfSymbol(symbol) {
|
||||
if (symbol.flags & 16777216) {
|
||||
return getTypeOfInstantiatedSymbol(symbol);
|
||||
@ -23060,8 +23067,8 @@ var ts;
|
||||
setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined);
|
||||
var typeParameter = getTypeParameterFromMappedType(type);
|
||||
var constraintType = getConstraintTypeFromMappedType(type);
|
||||
var homomorphicType = getHomomorphicTypeFromMappedType(type);
|
||||
var templateType = getTemplateTypeFromMappedType(type);
|
||||
var modifiersType = getModifiersTypeFromMappedType(type);
|
||||
var templateReadonly = !!type.declaration.readonlyToken;
|
||||
var templateOptional = !!type.declaration.questionToken;
|
||||
var keyType = constraintType.flags & 540672 ? getApparentType(constraintType) : constraintType;
|
||||
@ -23072,11 +23079,11 @@ var ts;
|
||||
var propType = instantiateType(templateType, templateMapper);
|
||||
if (t.flags & 32) {
|
||||
var propName = t.text;
|
||||
var homomorphicProp = homomorphicType && getPropertyOfType(homomorphicType, propName);
|
||||
var isOptional = templateOptional || !!(homomorphicProp && homomorphicProp.flags & 536870912);
|
||||
var modifiersProp = getPropertyOfType(modifiersType, propName);
|
||||
var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 536870912);
|
||||
var prop = createSymbol(4 | 67108864 | (isOptional ? 536870912 : 0), propName);
|
||||
prop.type = propType;
|
||||
prop.isReadonly = templateReadonly || homomorphicProp && isReadonlySymbol(homomorphicProp);
|
||||
prop.isReadonly = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp);
|
||||
members[propName] = prop;
|
||||
}
|
||||
else if (t.flags & 2) {
|
||||
@ -23099,9 +23106,20 @@ var ts;
|
||||
instantiateType(addOptionality(getTypeFromTypeNode(type.declaration.type), !!type.declaration.questionToken), type.mapper || identityMapper) :
|
||||
unknownType);
|
||||
}
|
||||
function getHomomorphicTypeFromMappedType(type) {
|
||||
var constraint = getConstraintDeclaration(getTypeParameterFromMappedType(type));
|
||||
return constraint.kind === 168 ? instantiateType(getTypeFromTypeNode(constraint.type), type.mapper || identityMapper) : undefined;
|
||||
function getModifiersTypeFromMappedType(type) {
|
||||
if (!type.modifiersType) {
|
||||
var constraintDeclaration = type.declaration.typeParameter.constraint;
|
||||
if (constraintDeclaration.kind === 168) {
|
||||
type.modifiersType = instantiateType(getTypeFromTypeNode(constraintDeclaration.type), type.mapper || identityMapper);
|
||||
}
|
||||
else {
|
||||
var declaredType = getTypeFromMappedTypeNode(type.declaration);
|
||||
var constraint = getConstraintTypeFromMappedType(declaredType);
|
||||
var extendedConstraint = constraint.flags & 16384 ? getConstraintOfTypeParameter(constraint) : constraint;
|
||||
type.modifiersType = extendedConstraint.flags & 262144 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType;
|
||||
}
|
||||
}
|
||||
return type.modifiersType;
|
||||
}
|
||||
function getErasedTemplateTypeFromMappedType(type) {
|
||||
return instantiateType(getTemplateTypeFromMappedType(type), createUnaryTypeMapper(getTypeParameterFromMappedType(type), anyType));
|
||||
@ -23183,23 +23201,18 @@ var ts;
|
||||
getPropertiesOfUnionOrIntersectionType(type) :
|
||||
getPropertiesOfObjectType(type);
|
||||
}
|
||||
function getApparentTypeOfTypeParameter(type) {
|
||||
function getApparentTypeOfTypeVariable(type) {
|
||||
if (!type.resolvedApparentType) {
|
||||
var constraintType = getConstraintOfTypeParameter(type);
|
||||
var constraintType = getConstraintOfTypeVariable(type);
|
||||
while (constraintType && constraintType.flags & 16384) {
|
||||
constraintType = getConstraintOfTypeParameter(constraintType);
|
||||
constraintType = getConstraintOfTypeVariable(constraintType);
|
||||
}
|
||||
type.resolvedApparentType = getTypeWithThisArgument(constraintType || emptyObjectType, type);
|
||||
}
|
||||
return type.resolvedApparentType;
|
||||
}
|
||||
function getApparentTypeOfIndexedAccess(type) {
|
||||
return getIndexTypeOfType(getApparentType(type.objectType), 0) || type;
|
||||
}
|
||||
function getApparentType(type) {
|
||||
var t = type.flags & 16384 ? getApparentTypeOfTypeParameter(type) :
|
||||
type.flags & 524288 ? getApparentTypeOfIndexedAccess(type) :
|
||||
type;
|
||||
var t = type.flags & 540672 ? getApparentTypeOfTypeVariable(type) : type;
|
||||
return t.flags & 262178 ? globalStringType :
|
||||
t.flags & 340 ? globalNumberType :
|
||||
t.flags & 136 ? globalBooleanType :
|
||||
@ -23694,6 +23707,11 @@ var ts;
|
||||
}
|
||||
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
|
||||
}
|
||||
function getConstraintOfTypeVariable(type) {
|
||||
return type.flags & 16384 ? getConstraintOfTypeParameter(type) :
|
||||
type.flags & 524288 ? type.constraint :
|
||||
undefined;
|
||||
}
|
||||
function getParentSymbolOfTypeParameter(typeParameter) {
|
||||
return getSymbolOfNode(ts.getDeclarationOfKind(typeParameter.symbol, 143).parent);
|
||||
}
|
||||
@ -24237,6 +24255,17 @@ var ts;
|
||||
var type = createType(524288);
|
||||
type.objectType = objectType;
|
||||
type.indexType = indexType;
|
||||
if (type.objectType.flags & 229376) {
|
||||
type.constraint = getIndexTypeOfType(type.objectType, 0);
|
||||
}
|
||||
else if (type.objectType.flags & 540672) {
|
||||
var apparentType = getApparentTypeOfTypeVariable(type.objectType);
|
||||
if (apparentType !== emptyObjectType) {
|
||||
type.constraint = isTypeOfKind(type.indexType, 262178) ?
|
||||
getIndexedAccessType(apparentType, type.indexType) :
|
||||
getIndexTypeOfType(apparentType, 0);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
}
|
||||
function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) {
|
||||
@ -24312,7 +24341,9 @@ var ts;
|
||||
return instantiateType(getTemplateTypeFromMappedType(type), templateMapper);
|
||||
}
|
||||
function getIndexedAccessType(objectType, indexType, accessNode) {
|
||||
if (maybeTypeOfKind(indexType, 540672 | 262144) || isGenericMappedType(objectType)) {
|
||||
if (maybeTypeOfKind(indexType, 540672 | 262144) ||
|
||||
maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 178) ||
|
||||
isGenericMappedType(objectType)) {
|
||||
if (objectType.flags & 1) {
|
||||
return objectType;
|
||||
}
|
||||
@ -25234,6 +25265,23 @@ var ts;
|
||||
reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
|
||||
}
|
||||
}
|
||||
function isUnionOrIntersectionTypeWithoutNullableConstituents(type) {
|
||||
if (!(type.flags & 196608)) {
|
||||
return false;
|
||||
}
|
||||
var seenNonNullable = false;
|
||||
for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
|
||||
var t = _a[_i];
|
||||
if (t.flags & 6144) {
|
||||
continue;
|
||||
}
|
||||
if (seenNonNullable) {
|
||||
return true;
|
||||
}
|
||||
seenNonNullable = true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function isRelatedTo(source, target, reportErrors, headMessage) {
|
||||
var result;
|
||||
if (source.flags & 96 && source.flags & 1048576) {
|
||||
@ -25256,7 +25304,7 @@ var ts;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (target.flags & 196608) {
|
||||
if (isUnionOrIntersectionTypeWithoutNullableConstituents(target)) {
|
||||
source = getRegularTypeOfObjectLiteral(source);
|
||||
}
|
||||
}
|
||||
@ -25287,7 +25335,7 @@ var ts;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (target.flags & 16384) {
|
||||
else if (target.flags & 16384) {
|
||||
if (getObjectFlags(source) & 32 && getConstraintTypeFromMappedType(source) === getIndexType(target)) {
|
||||
if (!source.declaration.questionToken) {
|
||||
var templateType = getTemplateTypeFromMappedType(source);
|
||||
@ -25312,8 +25360,8 @@ var ts;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (target.type.flags & 16384) {
|
||||
var constraint = getConstraintOfTypeParameter(target.type);
|
||||
if (target.type.flags & 540672) {
|
||||
var constraint = getConstraintOfTypeVariable(target.type);
|
||||
if (constraint) {
|
||||
if (result = isRelatedTo(source, getIndexType(constraint), reportErrors)) {
|
||||
return result;
|
||||
@ -25327,12 +25375,19 @@ var ts;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
if (target.constraint) {
|
||||
if (result = isRelatedTo(source, target.constraint, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (source.flags & 16384) {
|
||||
if (getObjectFlags(target) & 32 && getConstraintTypeFromMappedType(target) === getIndexType(source)) {
|
||||
var indexedAccessType = getIndexedAccessType(source, getTypeParameterFromMappedType(target));
|
||||
var templateType = getTemplateTypeFromMappedType(target);
|
||||
if (result = isRelatedTo(indexedAccessType, templateType, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -25349,6 +25404,14 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (source.flags & 524288) {
|
||||
if (source.constraint) {
|
||||
if (result = isRelatedTo(source.constraint, target, reportErrors)) {
|
||||
errorInfo = saveErrorInfo;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) {
|
||||
if (result = typeArgumentsRelatedTo(source, target, reportErrors)) {
|
||||
@ -27876,18 +27939,21 @@ var ts;
|
||||
var baseConstructorType = getBaseConstructorTypeOfClass(classInstanceType);
|
||||
return baseConstructorType === nullWideningType;
|
||||
}
|
||||
function checkThisBeforeSuper(node, container, diagnosticMessage) {
|
||||
var containingClassDecl = container.parent;
|
||||
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl);
|
||||
if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) {
|
||||
var superCall = getSuperCallInConstructor(container);
|
||||
if (!superCall || superCall.end > node.pos) {
|
||||
error(node, diagnosticMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
function checkThisExpression(node) {
|
||||
var container = ts.getThisContainer(node, true);
|
||||
var needToCaptureLexicalThis = false;
|
||||
if (container.kind === 150) {
|
||||
var containingClassDecl = container.parent;
|
||||
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(containingClassDecl);
|
||||
if (baseTypeNode && !classDeclarationExtendsNull(containingClassDecl)) {
|
||||
var superCall = getSuperCallInConstructor(container);
|
||||
if (!superCall || superCall.end > node.pos) {
|
||||
error(node, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);
|
||||
}
|
||||
}
|
||||
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);
|
||||
}
|
||||
if (container.kind === 185) {
|
||||
container = ts.getThisContainer(container, false);
|
||||
@ -28001,6 +28067,9 @@ var ts;
|
||||
}
|
||||
return unknownType;
|
||||
}
|
||||
if (!isCallExpression && container.kind === 150) {
|
||||
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class);
|
||||
}
|
||||
if ((ts.getModifierFlags(container) & 32) || isCallExpression) {
|
||||
nodeCheckFlag = 512;
|
||||
}
|
||||
@ -28456,7 +28525,7 @@ var ts;
|
||||
return mapper && mapper.context;
|
||||
}
|
||||
function checkSpreadExpression(node, contextualMapper) {
|
||||
var arrayOrIterableType = checkExpressionCached(node.expression, contextualMapper);
|
||||
var arrayOrIterableType = checkExpression(node.expression, contextualMapper);
|
||||
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false);
|
||||
}
|
||||
function hasDefaultValue(node) {
|
||||
@ -28671,8 +28740,10 @@ var ts;
|
||||
if (propertiesArray.length > 0) {
|
||||
spread = getSpreadType(spread, createObjectLiteralType(), true);
|
||||
}
|
||||
spread.flags |= propagatedFlags;
|
||||
spread.symbol = node.symbol;
|
||||
if (spread.flags & 32768) {
|
||||
spread.flags |= propagatedFlags;
|
||||
spread.symbol = node.symbol;
|
||||
}
|
||||
return spread;
|
||||
}
|
||||
return createObjectLiteralType();
|
||||
@ -29955,12 +30026,13 @@ var ts;
|
||||
if (containingClass) {
|
||||
var containingType = getTypeOfNode(containingClass);
|
||||
var baseTypes = getBaseTypes(containingType);
|
||||
if (baseTypes.length) {
|
||||
while (baseTypes.length) {
|
||||
var baseType = baseTypes[0];
|
||||
if (modifiers & 16 &&
|
||||
baseType.symbol === declaration.parent.symbol) {
|
||||
return true;
|
||||
}
|
||||
baseTypes = getBaseTypes(baseType);
|
||||
}
|
||||
}
|
||||
if (modifiers & 8) {
|
||||
@ -31119,8 +31191,8 @@ var ts;
|
||||
}
|
||||
function isLiteralContextualType(contextualType) {
|
||||
if (contextualType) {
|
||||
if (contextualType.flags & 16384) {
|
||||
var apparentType = getApparentTypeOfTypeParameter(contextualType);
|
||||
if (contextualType.flags & 540672) {
|
||||
var apparentType = getApparentTypeOfTypeVariable(contextualType);
|
||||
if (apparentType.flags & (2 | 4 | 8 | 16)) {
|
||||
return true;
|
||||
}
|
||||
@ -31775,7 +31847,7 @@ var ts;
|
||||
checkSourceElement(node.type);
|
||||
var type = getTypeFromMappedTypeNode(node);
|
||||
var constraintType = getConstraintTypeFromMappedType(type);
|
||||
var keyType = constraintType.flags & 16384 ? getApparentTypeOfTypeParameter(constraintType) : constraintType;
|
||||
var keyType = constraintType.flags & 540672 ? getApparentTypeOfTypeVariable(constraintType) : constraintType;
|
||||
checkTypeAssignableTo(keyType, stringType, node.typeParameter.constraint);
|
||||
}
|
||||
function isPrivateWithinAmbient(node) {
|
||||
@ -32064,7 +32136,7 @@ var ts;
|
||||
if (thenSignatures.length === 0) {
|
||||
return undefined;
|
||||
}
|
||||
var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 131072);
|
||||
var onfulfilledParameterType = getTypeWithFacts(getUnionType(ts.map(thenSignatures, getTypeOfFirstParameterOfSignature)), 524288);
|
||||
if (isTypeAny(onfulfilledParameterType)) {
|
||||
return undefined;
|
||||
}
|
||||
@ -32200,6 +32272,9 @@ var ts;
|
||||
markAliasSymbolAsReferenced(rootSymbol);
|
||||
}
|
||||
}
|
||||
function getParameterTypeNodeForDecoratorCheck(node) {
|
||||
return node.dotDotDotToken ? ts.getRestParameterElementType(node.type) : node.type;
|
||||
}
|
||||
function checkDecorators(node) {
|
||||
if (!node.decorators) {
|
||||
return;
|
||||
@ -32223,7 +32298,7 @@ var ts;
|
||||
if (constructor) {
|
||||
for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {
|
||||
var parameter = _a[_i];
|
||||
markTypeNodeAsReferenced(parameter.type);
|
||||
markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -32232,11 +32307,13 @@ var ts;
|
||||
case 152:
|
||||
for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {
|
||||
var parameter = _c[_b];
|
||||
markTypeNodeAsReferenced(parameter.type);
|
||||
markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
|
||||
}
|
||||
markTypeNodeAsReferenced(node.type);
|
||||
break;
|
||||
case 147:
|
||||
markTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
|
||||
break;
|
||||
case 144:
|
||||
markTypeNodeAsReferenced(node.type);
|
||||
break;
|
||||
@ -32367,6 +32444,13 @@ var ts;
|
||||
}
|
||||
}
|
||||
}
|
||||
function isRemovedPropertyFromObjectSpread(node) {
|
||||
if (ts.isBindingElement(node) && ts.isObjectBindingPattern(node.parent)) {
|
||||
var lastElement = ts.lastOrUndefined(node.parent.elements);
|
||||
return lastElement !== node && !!lastElement.dotDotDotToken;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function errorUnusedLocal(node, name) {
|
||||
if (isIdentifierThatStartsWithUnderScore(node)) {
|
||||
var declaration = ts.getRootDeclaration(node.parent);
|
||||
@ -32376,7 +32460,9 @@ var ts;
|
||||
return;
|
||||
}
|
||||
}
|
||||
error(node, ts.Diagnostics._0_is_declared_but_never_used, name);
|
||||
if (!isRemovedPropertyFromObjectSpread(node.kind === 70 ? node.parent : node)) {
|
||||
error(node, ts.Diagnostics._0_is_declared_but_never_used, name);
|
||||
}
|
||||
}
|
||||
function parameterNameStartsWithUnderscore(parameterName) {
|
||||
return parameterName && isIdentifierThatStartsWithUnderScore(parameterName);
|
||||
@ -33295,7 +33381,7 @@ var ts;
|
||||
checkClassForDuplicateDeclarations(node);
|
||||
var baseTypeNode = ts.getClassExtendsHeritageClauseElement(node);
|
||||
if (baseTypeNode) {
|
||||
if (languageVersion < 2) {
|
||||
if (languageVersion < 2 && !ts.isInAmbientContext(node)) {
|
||||
checkExternalEmitHelpers(baseTypeNode.parent, 1);
|
||||
}
|
||||
var baseTypes = getBaseTypes(type);
|
||||
@ -37952,10 +38038,11 @@ var ts;
|
||||
return undefined;
|
||||
}
|
||||
var _a = ts.getAllAccessorDeclarations(node.members, accessor), firstAccessor = _a.firstAccessor, secondAccessor = _a.secondAccessor, setAccessor = _a.setAccessor;
|
||||
if (accessor !== firstAccessor) {
|
||||
var firstAccessorWithDecorators = firstAccessor.decorators ? firstAccessor : secondAccessor && secondAccessor.decorators ? secondAccessor : undefined;
|
||||
if (!firstAccessorWithDecorators || accessor !== firstAccessorWithDecorators) {
|
||||
return undefined;
|
||||
}
|
||||
var decorators = firstAccessor.decorators || (secondAccessor && secondAccessor.decorators);
|
||||
var decorators = firstAccessorWithDecorators.decorators;
|
||||
var parameters = getDecoratorsOfParameters(setAccessor);
|
||||
if (!decorators && !parameters) {
|
||||
return undefined;
|
||||
@ -37980,14 +38067,14 @@ var ts;
|
||||
}
|
||||
return { decorators: decorators };
|
||||
}
|
||||
function transformAllDecoratorsOfDeclaration(node, allDecorators) {
|
||||
function transformAllDecoratorsOfDeclaration(node, container, allDecorators) {
|
||||
if (!allDecorators) {
|
||||
return undefined;
|
||||
}
|
||||
var decoratorExpressions = [];
|
||||
ts.addRange(decoratorExpressions, ts.map(allDecorators.decorators, transformDecorator));
|
||||
ts.addRange(decoratorExpressions, ts.flatMap(allDecorators.parameters, transformDecoratorsOfParameter));
|
||||
addTypeMetadata(node, decoratorExpressions);
|
||||
addTypeMetadata(node, container, decoratorExpressions);
|
||||
return decoratorExpressions;
|
||||
}
|
||||
function addClassElementDecorationStatements(statements, node, isStatic) {
|
||||
@ -38012,7 +38099,7 @@ var ts;
|
||||
}
|
||||
function generateClassElementDecorationExpression(node, member) {
|
||||
var allDecorators = getAllDecoratorsOfClassElement(node, member);
|
||||
var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, allDecorators);
|
||||
var decoratorExpressions = transformAllDecoratorsOfDeclaration(member, node, allDecorators);
|
||||
if (!decoratorExpressions) {
|
||||
return undefined;
|
||||
}
|
||||
@ -38035,7 +38122,7 @@ var ts;
|
||||
}
|
||||
function generateConstructorDecorationExpression(node) {
|
||||
var allDecorators = getAllDecoratorsOfConstructor(node);
|
||||
var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, allDecorators);
|
||||
var decoratorExpressions = transformAllDecoratorsOfDeclaration(node, node, allDecorators);
|
||||
if (!decoratorExpressions) {
|
||||
return undefined;
|
||||
}
|
||||
@ -38063,35 +38150,35 @@ var ts;
|
||||
}
|
||||
return expressions;
|
||||
}
|
||||
function addTypeMetadata(node, decoratorExpressions) {
|
||||
function addTypeMetadata(node, container, decoratorExpressions) {
|
||||
if (USE_NEW_TYPE_METADATA_FORMAT) {
|
||||
addNewTypeMetadata(node, decoratorExpressions);
|
||||
addNewTypeMetadata(node, container, decoratorExpressions);
|
||||
}
|
||||
else {
|
||||
addOldTypeMetadata(node, decoratorExpressions);
|
||||
addOldTypeMetadata(node, container, decoratorExpressions);
|
||||
}
|
||||
}
|
||||
function addOldTypeMetadata(node, decoratorExpressions) {
|
||||
function addOldTypeMetadata(node, container, decoratorExpressions) {
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
if (shouldAddTypeMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper(context, "design:type", serializeTypeOfNode(node)));
|
||||
}
|
||||
if (shouldAddParamTypesMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node)));
|
||||
decoratorExpressions.push(createMetadataHelper(context, "design:paramtypes", serializeParameterTypesOfNode(node, container)));
|
||||
}
|
||||
if (shouldAddReturnTypeMetadata(node)) {
|
||||
decoratorExpressions.push(createMetadataHelper(context, "design:returntype", serializeReturnTypeOfNode(node)));
|
||||
}
|
||||
}
|
||||
}
|
||||
function addNewTypeMetadata(node, decoratorExpressions) {
|
||||
function addNewTypeMetadata(node, container, decoratorExpressions) {
|
||||
if (compilerOptions.emitDecoratorMetadata) {
|
||||
var properties = void 0;
|
||||
if (shouldAddTypeMetadata(node)) {
|
||||
(properties || (properties = [])).push(ts.createPropertyAssignment("type", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeTypeOfNode(node))));
|
||||
}
|
||||
if (shouldAddParamTypesMetadata(node)) {
|
||||
(properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node))));
|
||||
(properties || (properties = [])).push(ts.createPropertyAssignment("paramTypes", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeParameterTypesOfNode(node, container))));
|
||||
}
|
||||
if (shouldAddReturnTypeMetadata(node)) {
|
||||
(properties || (properties = [])).push(ts.createPropertyAssignment("returnType", ts.createArrowFunction(undefined, undefined, [], undefined, ts.createToken(35), serializeReturnTypeOfNode(node))));
|
||||
@ -38112,12 +38199,16 @@ var ts;
|
||||
return node.kind === 149;
|
||||
}
|
||||
function shouldAddParamTypesMetadata(node) {
|
||||
var kind = node.kind;
|
||||
return kind === 226
|
||||
|| kind === 197
|
||||
|| kind === 149
|
||||
|| kind === 151
|
||||
|| kind === 152;
|
||||
switch (node.kind) {
|
||||
case 226:
|
||||
case 197:
|
||||
return ts.getFirstConstructorWithBody(node) !== undefined;
|
||||
case 149:
|
||||
case 151:
|
||||
case 152:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function serializeTypeOfNode(node) {
|
||||
switch (node.kind) {
|
||||
@ -38135,18 +38226,7 @@ var ts;
|
||||
return ts.createVoidZero();
|
||||
}
|
||||
}
|
||||
function getRestParameterElementType(node) {
|
||||
if (node && node.kind === 162) {
|
||||
return node.elementType;
|
||||
}
|
||||
else if (node && node.kind === 157) {
|
||||
return ts.singleOrUndefined(node.typeArguments);
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
function serializeParameterTypesOfNode(node) {
|
||||
function serializeParameterTypesOfNode(node, container) {
|
||||
var valueDeclaration = ts.isClassLike(node)
|
||||
? ts.getFirstConstructorWithBody(node)
|
||||
: ts.isFunctionLike(node) && ts.nodeIsPresent(node.body)
|
||||
@ -38154,7 +38234,7 @@ var ts;
|
||||
: undefined;
|
||||
var expressions = [];
|
||||
if (valueDeclaration) {
|
||||
var parameters = valueDeclaration.parameters;
|
||||
var parameters = getParametersOfDecoratedDeclaration(valueDeclaration, container);
|
||||
var numParameters = parameters.length;
|
||||
for (var i = 0; i < numParameters; i++) {
|
||||
var parameter = parameters[i];
|
||||
@ -38162,7 +38242,7 @@ var ts;
|
||||
continue;
|
||||
}
|
||||
if (parameter.dotDotDotToken) {
|
||||
expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type)));
|
||||
expressions.push(serializeTypeNode(ts.getRestParameterElementType(parameter.type)));
|
||||
}
|
||||
else {
|
||||
expressions.push(serializeTypeOfNode(parameter));
|
||||
@ -38171,6 +38251,15 @@ var ts;
|
||||
}
|
||||
return ts.createArrayLiteral(expressions);
|
||||
}
|
||||
function getParametersOfDecoratedDeclaration(node, container) {
|
||||
if (container && node.kind === 151) {
|
||||
var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor;
|
||||
if (setAccessor) {
|
||||
return setAccessor.parameters;
|
||||
}
|
||||
}
|
||||
return node.parameters;
|
||||
}
|
||||
function serializeReturnTypeOfNode(node) {
|
||||
if (ts.isFunctionLike(node) && node.type) {
|
||||
return serializeTypeNode(node.type);
|
||||
@ -41068,12 +41157,17 @@ var ts;
|
||||
convertedLoopState.hoistedLocalVariables = outerConvertedLoopState.hoistedLocalVariables;
|
||||
}
|
||||
}
|
||||
startLexicalEnvironment();
|
||||
var loopBody = ts.visitNode(node.statement, visitor, ts.isStatement);
|
||||
var lexicalEnvironment = endLexicalEnvironment();
|
||||
var currentState = convertedLoopState;
|
||||
convertedLoopState = outerConvertedLoopState;
|
||||
if (loopOutParameters.length) {
|
||||
if (loopOutParameters.length || lexicalEnvironment) {
|
||||
var statements_4 = ts.isBlock(loopBody) ? loopBody.statements.slice() : [loopBody];
|
||||
copyOutParameters(loopOutParameters, 1, statements_4);
|
||||
if (loopOutParameters.length) {
|
||||
copyOutParameters(loopOutParameters, 1, statements_4);
|
||||
}
|
||||
ts.addRange(statements_4, lexicalEnvironment);
|
||||
loopBody = ts.createBlock(statements_4, undefined, true);
|
||||
}
|
||||
if (!ts.isBlock(loopBody)) {
|
||||
@ -43379,11 +43473,11 @@ var ts;
|
||||
], undefined, moduleBodyBlock);
|
||||
var moduleName = ts.tryGetModuleNameFromFile(node, host, compilerOptions);
|
||||
var dependencies = ts.createArrayLiteral(ts.map(dependencyGroups, function (dependencyGroup) { return dependencyGroup.name; }));
|
||||
var updated = ts.updateSourceFileNode(node, ts.createNodeArray([
|
||||
var updated = ts.setEmitFlags(ts.updateSourceFileNode(node, ts.createNodeArray([
|
||||
ts.createStatement(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("System"), "register"), undefined, moduleName
|
||||
? [moduleName, dependencies, moduleBodyFunction]
|
||||
: [dependencies, moduleBodyFunction]))
|
||||
], node.statements));
|
||||
], node.statements)), 1024);
|
||||
if (!(compilerOptions.outFile || compilerOptions.out)) {
|
||||
ts.moveEmitHelpers(updated, moduleBodyBlock, function (helper) { return !helper.scoped; });
|
||||
}
|
||||
@ -45205,7 +45299,7 @@ var ts;
|
||||
return;
|
||||
}
|
||||
encodeLastRecordedSourceMapSpan();
|
||||
return ts.stringify({
|
||||
return JSON.stringify({
|
||||
version: 3,
|
||||
file: sourceMapData.sourceMapFile,
|
||||
sourceRoot: sourceMapData.sourceMapSourceRoot,
|
||||
@ -45371,6 +45465,9 @@ var ts;
|
||||
}
|
||||
if (!skipTrailingComments) {
|
||||
emitLeadingComments(detachedRange.end, true);
|
||||
if (hasWrittenComment && !writer.isAtStartOfLine()) {
|
||||
writer.writeLine();
|
||||
}
|
||||
}
|
||||
if (extendedDiagnostics) {
|
||||
ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns");
|
||||
@ -45642,6 +45739,7 @@ var ts;
|
||||
writer.writeSpace = writer.write;
|
||||
writer.writeStringLiteral = writer.writeLiteral;
|
||||
writer.writeParameter = writer.write;
|
||||
writer.writeProperty = writer.write;
|
||||
writer.writeSymbol = writer.write;
|
||||
setWriter(writer);
|
||||
}
|
||||
@ -50917,14 +51015,7 @@ var ts;
|
||||
}
|
||||
ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType;
|
||||
function parseCustomTypeOption(opt, value, errors) {
|
||||
var key = trimString((value || "")).toLowerCase();
|
||||
var map = opt.type;
|
||||
if (key in map) {
|
||||
return map[key];
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnosticForInvalidCustomType(opt));
|
||||
}
|
||||
return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors);
|
||||
}
|
||||
ts.parseCustomTypeOption = parseCustomTypeOption;
|
||||
function parseListTypeOption(opt, value, errors) {
|
||||
@ -51164,9 +51255,10 @@ var ts;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) {
|
||||
function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
|
||||
if (existingOptions === void 0) { existingOptions = {}; }
|
||||
if (resolutionStack === void 0) { resolutionStack = []; }
|
||||
if (extraFileExtensions === void 0) { extraFileExtensions = []; }
|
||||
var errors = [];
|
||||
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
|
||||
var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName);
|
||||
@ -51289,7 +51381,7 @@ var ts;
|
||||
if (fileNames === undefined && includeSpecs === undefined) {
|
||||
includeSpecs = ["**/*"];
|
||||
}
|
||||
var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors);
|
||||
var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions);
|
||||
if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) {
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || [])));
|
||||
}
|
||||
@ -51393,7 +51485,7 @@ var ts;
|
||||
var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/;
|
||||
var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//;
|
||||
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
||||
function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) {
|
||||
function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) {
|
||||
basePath = ts.normalizePath(basePath);
|
||||
var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;
|
||||
var literalFileMap = ts.createMap();
|
||||
@ -51405,7 +51497,7 @@ var ts;
|
||||
exclude = validateSpecs(exclude, errors, true);
|
||||
}
|
||||
var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames);
|
||||
var supportedExtensions = ts.getSupportedExtensions(options);
|
||||
var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions);
|
||||
if (fileNames) {
|
||||
for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {
|
||||
var fileName = fileNames_1[_i];
|
||||
|
||||
1055
lib/tsserver.js
1055
lib/tsserver.js
File diff suppressed because it is too large
Load Diff
96
lib/tsserverlibrary.d.ts
vendored
96
lib/tsserverlibrary.d.ts
vendored
@ -330,10 +330,12 @@ declare namespace ts.server.protocol {
|
||||
isInferred: boolean;
|
||||
version: number;
|
||||
options: ts.CompilerOptions;
|
||||
languageServiceDisabled: boolean;
|
||||
}
|
||||
interface ProjectChanges {
|
||||
added: string[];
|
||||
removed: string[];
|
||||
updated: string[];
|
||||
}
|
||||
interface ProjectFiles {
|
||||
info?: ProjectVersionInfo;
|
||||
@ -351,6 +353,7 @@ declare namespace ts.server.protocol {
|
||||
hostInfo?: string;
|
||||
file?: string;
|
||||
formatOptions?: FormatCodeSettings;
|
||||
extraFileExtensions?: FileExtensionInfo[];
|
||||
}
|
||||
interface ConfigureRequest extends Request {
|
||||
command: CommandTypes.Configure;
|
||||
@ -448,6 +451,7 @@ declare namespace ts.server.protocol {
|
||||
end: Location;
|
||||
displayString: string;
|
||||
documentation: string;
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
interface QuickInfoResponse extends Response {
|
||||
body?: QuickInfoResponseBody;
|
||||
@ -520,6 +524,7 @@ declare namespace ts.server.protocol {
|
||||
kindModifiers: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
interface CompletionsResponse extends Response {
|
||||
body?: CompletionEntry[];
|
||||
@ -540,6 +545,7 @@ declare namespace ts.server.protocol {
|
||||
separatorDisplayParts: SymbolDisplayPart[];
|
||||
parameters: SignatureHelpParameter[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
interface SignatureHelpItems {
|
||||
items: SignatureHelpItem[];
|
||||
@ -2517,6 +2523,7 @@ declare namespace ts {
|
||||
writeSpace(text: string): void;
|
||||
writeStringLiteral(text: string): void;
|
||||
writeParameter(text: string): void;
|
||||
writeProperty(text: string): void;
|
||||
writeSymbol(text: string, symbol: Symbol): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
@ -2907,6 +2914,7 @@ declare namespace ts {
|
||||
typeParameter?: TypeParameter;
|
||||
constraintType?: Type;
|
||||
templateType?: Type;
|
||||
modifiersType?: Type;
|
||||
mapper?: TypeMapper;
|
||||
}
|
||||
interface EvolvingArrayType extends ObjectType {
|
||||
@ -2929,18 +2937,19 @@ declare namespace ts {
|
||||
iteratorElementType?: Type;
|
||||
}
|
||||
interface TypeVariable extends Type {
|
||||
resolvedApparentType: Type;
|
||||
resolvedIndexType: IndexType;
|
||||
}
|
||||
interface TypeParameter extends TypeVariable {
|
||||
constraint: Type;
|
||||
target?: TypeParameter;
|
||||
mapper?: TypeMapper;
|
||||
resolvedApparentType: Type;
|
||||
isThisType?: boolean;
|
||||
}
|
||||
interface IndexedAccessType extends TypeVariable {
|
||||
objectType: Type;
|
||||
indexType: Type;
|
||||
constraint?: Type;
|
||||
}
|
||||
interface IndexType extends Type {
|
||||
type: TypeVariable | UnionOrIntersectionType;
|
||||
@ -3002,6 +3011,11 @@ declare namespace ts {
|
||||
PrototypeProperty = 3,
|
||||
ThisProperty = 4,
|
||||
}
|
||||
interface FileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@ -3573,7 +3587,7 @@ declare namespace ts.performance {
|
||||
function disable(): void;
|
||||
}
|
||||
declare namespace ts {
|
||||
const version = "2.1.4";
|
||||
const version = "2.1.5";
|
||||
}
|
||||
declare namespace ts {
|
||||
const enum Ternary {
|
||||
@ -3645,7 +3659,6 @@ declare namespace ts {
|
||||
function assign<T1 extends MapLike<{}>, T2>(t: T1, arg1: T2): T1 & T2;
|
||||
function assign<T1 extends MapLike<{}>>(t: T1, ...args: any[]): any;
|
||||
function reduceProperties<T, U>(map: Map<T>, callback: (aggregate: U, value: T, key: string) => U, initial: U): U;
|
||||
function reduceOwnProperties<T, U>(map: MapLike<T>, callback: (aggregate: U, value: T, key: string) => U, initial: U): U;
|
||||
function equalOwnProperties<T>(left: MapLike<T>, right: MapLike<T>, equalityComparer?: (left: T, right: T) => boolean): boolean;
|
||||
function arrayToMap<T>(array: T[], makeKey: (value: T) => string): Map<T>;
|
||||
function arrayToMap<T, U>(array: T[], makeKey: (value: T) => string, makeValue: (value: T) => U): Map<U>;
|
||||
@ -3724,10 +3737,10 @@ declare namespace ts {
|
||||
const supportedTypeScriptExtensions: string[];
|
||||
const supportedTypescriptExtensionsForExtractExtension: string[];
|
||||
const supportedJavascriptExtensions: string[];
|
||||
function getSupportedExtensions(options?: CompilerOptions): string[];
|
||||
function getSupportedExtensions(options?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]): string[];
|
||||
function hasJavaScriptFileExtension(fileName: string): boolean;
|
||||
function hasTypeScriptFileExtension(fileName: string): boolean;
|
||||
function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions): boolean;
|
||||
function isSupportedSourceFileName(fileName: string, compilerOptions?: CompilerOptions, extraFileExtensions?: FileExtensionInfo[]): boolean;
|
||||
const enum ExtensionPriority {
|
||||
TypeScriptFiles = 0,
|
||||
DeclarationAndJavaScriptFiles = 2,
|
||||
@ -8572,6 +8585,12 @@ declare namespace ts {
|
||||
key: string;
|
||||
message: string;
|
||||
};
|
||||
super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: {
|
||||
code: number;
|
||||
category: DiagnosticCategory;
|
||||
key: string;
|
||||
message: string;
|
||||
};
|
||||
Circularity_detected_while_resolving_configuration_Colon_0: {
|
||||
code: number;
|
||||
category: DiagnosticCategory;
|
||||
@ -8762,7 +8781,7 @@ declare namespace ts {
|
||||
function generateTSConfig(options: CompilerOptions, fileNames: string[]): {
|
||||
compilerOptions: Map<CompilerOptionsValue>;
|
||||
};
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine;
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine;
|
||||
function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: CompilerOptions;
|
||||
@ -8974,6 +8993,7 @@ declare namespace ts {
|
||||
function isPartOfTypeNode(node: Node): boolean;
|
||||
function forEachReturnStatement<T>(body: Block, visitor: (stmt: ReturnStatement) => T): T;
|
||||
function forEachYieldExpression(body: Block, visitor: (expr: YieldExpression) => void): void;
|
||||
function getRestParameterElementType(node: TypeNode): TypeNode;
|
||||
function isVariableLike(node: Node): node is VariableLikeDeclaration;
|
||||
function isAccessor(node: Node): node is AccessorDeclaration;
|
||||
function isClassLike(node: Node): node is ClassLikeDeclaration;
|
||||
@ -9017,6 +9037,7 @@ declare namespace ts {
|
||||
function hasQuestionToken(node: Node): boolean;
|
||||
function isJSDocConstructSignature(node: Node): boolean;
|
||||
function getCommentsFromJSDoc(node: Node): string[];
|
||||
function getJSDocs(node: Node): (JSDoc | JSDocTag)[];
|
||||
function getJSDocParameterTags(param: Node): JSDocParameterTag[];
|
||||
function getJSDocType(node: Node): JSDocType;
|
||||
function getJSDocAugmentsTag(node: Node): JSDocAugmentsTag;
|
||||
@ -9159,7 +9180,6 @@ declare namespace ts {
|
||||
function isEmptyObjectLiteralOrArrayLiteral(expression: Node): boolean;
|
||||
function getLocalSymbolForExportDefault(symbol: Symbol): Symbol;
|
||||
function tryExtractTypeScriptExtension(fileName: string): string | undefined;
|
||||
const stringify: (value: any) => string;
|
||||
function convertToBase64(input: string): string;
|
||||
function getNewLineCharacter(options: CompilerOptions): string;
|
||||
function isSimpleExpression(node: Expression): boolean;
|
||||
@ -9792,6 +9812,7 @@ declare namespace ts {
|
||||
getName(): string;
|
||||
getDeclarations(): Declaration[];
|
||||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
getJsDocTags(): JSDocTagInfo[];
|
||||
}
|
||||
interface Type {
|
||||
getFlags(): TypeFlags;
|
||||
@ -9812,6 +9833,7 @@ declare namespace ts {
|
||||
getParameters(): Symbol[];
|
||||
getReturnType(): Type;
|
||||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
getJsDocTags(): JSDocTagInfo[];
|
||||
}
|
||||
interface SourceFile {
|
||||
version: string;
|
||||
@ -10096,12 +10118,17 @@ declare namespace ts {
|
||||
text: string;
|
||||
kind: string;
|
||||
}
|
||||
interface JSDocTagInfo {
|
||||
name: string;
|
||||
text?: string;
|
||||
}
|
||||
interface QuickInfo {
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
textSpan: TextSpan;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
interface RenameInfo {
|
||||
canRename: boolean;
|
||||
@ -10125,6 +10152,7 @@ declare namespace ts {
|
||||
separatorDisplayParts: SymbolDisplayPart[];
|
||||
parameters: SignatureHelpParameter[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
interface SignatureHelpItems {
|
||||
items: SignatureHelpItem[];
|
||||
@ -10152,6 +10180,7 @@ declare namespace ts {
|
||||
kindModifiers: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
interface OutliningSpan {
|
||||
textSpan: TextSpan;
|
||||
@ -10451,6 +10480,7 @@ declare namespace ts.GoToImplementation {
|
||||
}
|
||||
declare namespace ts.JsDoc {
|
||||
function getJsDocCommentsFromDeclarations(declarations: Declaration[]): SymbolDisplayPart[];
|
||||
function getJsDocTagsFromDeclarations(declarations: Declaration[]): JSDocTagInfo[];
|
||||
function getAllJsDocCompletionEntries(): CompletionEntry[];
|
||||
function getDocCommentTemplateAtPosition(newLine: string, sourceFile: SourceFile, position: number): TextInsertion;
|
||||
}
|
||||
@ -10515,6 +10545,7 @@ declare namespace ts.SymbolDisplay {
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
symbolKind: string;
|
||||
tags: JSDocTagInfo[];
|
||||
};
|
||||
}
|
||||
declare namespace ts {
|
||||
@ -10979,24 +11010,57 @@ declare namespace ts {
|
||||
function getDefaultLibFilePath(options: CompilerOptions): string;
|
||||
}
|
||||
declare namespace ts.server {
|
||||
class TextStorage {
|
||||
private readonly host;
|
||||
private readonly fileName;
|
||||
private svc;
|
||||
private svcVersion;
|
||||
private text;
|
||||
private lineMap;
|
||||
private textVersion;
|
||||
constructor(host: ServerHost, fileName: NormalizedPath);
|
||||
getVersion(): string;
|
||||
hasScriptVersionCache(): boolean;
|
||||
useScriptVersionCache(newText?: string): void;
|
||||
useText(newText?: string): void;
|
||||
edit(start: number, end: number, newText: string): void;
|
||||
reload(text: string): void;
|
||||
reloadFromFile(tempFileName?: string): void;
|
||||
getSnapshot(): IScriptSnapshot;
|
||||
getLineInfo(line: number): ILineInfo;
|
||||
lineToTextSpan(line: number): TextSpan;
|
||||
lineOffsetToPosition(line: number, offset: number): number;
|
||||
positionToLineOffset(position: number): ILineInfo;
|
||||
private getFileText(tempFileName?);
|
||||
private ensureNoScriptVersionCache();
|
||||
private switchToScriptVersionCache(newText?);
|
||||
private getOrLoadText();
|
||||
private getLineMap();
|
||||
private setText(newText);
|
||||
}
|
||||
class ScriptInfo {
|
||||
private readonly host;
|
||||
readonly fileName: NormalizedPath;
|
||||
readonly scriptKind: ScriptKind;
|
||||
isOpen: boolean;
|
||||
hasMixedContent: boolean;
|
||||
readonly containingProjects: Project[];
|
||||
private formatCodeSettings;
|
||||
readonly path: Path;
|
||||
private fileWatcher;
|
||||
private svc;
|
||||
constructor(host: ServerHost, fileName: NormalizedPath, content: string, scriptKind: ScriptKind, isOpen?: boolean, hasMixedContent?: boolean);
|
||||
private textStorage;
|
||||
private isOpen;
|
||||
constructor(host: ServerHost, fileName: NormalizedPath, scriptKind: ScriptKind, hasMixedContent?: boolean);
|
||||
isScriptOpen(): boolean;
|
||||
open(newText: string): void;
|
||||
close(): void;
|
||||
getSnapshot(): IScriptSnapshot;
|
||||
getFormatCodeSettings(): FormatCodeSettings;
|
||||
attachToProject(project: Project): boolean;
|
||||
isAttached(project: Project): boolean;
|
||||
detachFromProject(project: Project): void;
|
||||
detachAllProjects(): void;
|
||||
getDefaultProject(): Project;
|
||||
registerFileUpdate(): void;
|
||||
setFormatOptions(formatSettings: FormatCodeSettings): void;
|
||||
setWatcher(watcher: FileWatcher): void;
|
||||
stopWatcher(): void;
|
||||
@ -11004,7 +11068,6 @@ declare namespace ts.server {
|
||||
reload(script: string): void;
|
||||
saveTo(fileName: string): void;
|
||||
reloadFromFile(tempFileName?: NormalizedPath): void;
|
||||
snap(): LineIndexSnapshot;
|
||||
getLineInfo(line: number): ILineInfo;
|
||||
editContent(start: number, end: number, newText: string): void;
|
||||
markContainingProjectsAsDirty(): void;
|
||||
@ -11089,6 +11152,7 @@ declare namespace ts.server {
|
||||
getFilesAffectedBy(scriptInfo: ScriptInfo): string[];
|
||||
onProjectUpdateGraph(): void;
|
||||
emitFile(scriptInfo: ScriptInfo, writeFile: (path: string, data: string, writeByteOrderMark?: boolean) => void): boolean;
|
||||
clear(): void;
|
||||
}
|
||||
function createBuilder(project: Project): Builder;
|
||||
}
|
||||
@ -11112,7 +11176,6 @@ declare namespace ts.server {
|
||||
get(path: Path): ReadonlyArray<string>;
|
||||
set(path: Path, value: ReadonlyArray<string>): void;
|
||||
}
|
||||
function createNoSemanticFeaturesWrapper(realLanguageService: LanguageService): LanguageService;
|
||||
abstract class Project {
|
||||
private readonly projectName;
|
||||
readonly projectKind: ProjectKind;
|
||||
@ -11127,9 +11190,9 @@ declare namespace ts.server {
|
||||
private cachedUnresolvedImportsPerFile;
|
||||
private lastCachedUnresolvedImportsList;
|
||||
private readonly languageService;
|
||||
private readonly noSemanticFeaturesLanguageService;
|
||||
languageServiceEnabled: boolean;
|
||||
builder: Builder;
|
||||
private updatedFileNames;
|
||||
private lastReportedFileNames;
|
||||
private lastReportedVersion;
|
||||
private projectStructureVersion;
|
||||
@ -11168,6 +11231,7 @@ declare namespace ts.server {
|
||||
isRoot(info: ScriptInfo): boolean;
|
||||
addRoot(info: ScriptInfo): void;
|
||||
removeFile(info: ScriptInfo, detachFromProject?: boolean): void;
|
||||
registerFileUpdate(fileName: string): void;
|
||||
markAsDirty(): void;
|
||||
private extractUnresolvedImportsFromSourceFile(file, result);
|
||||
updateGraph(): boolean;
|
||||
@ -11267,9 +11331,10 @@ declare namespace ts.server {
|
||||
interface HostConfiguration {
|
||||
formatCodeOptions: FormatCodeSettings;
|
||||
hostInfo: string;
|
||||
extraFileExtensions?: FileExtensionInfo[];
|
||||
}
|
||||
interface OpenConfiguredProjectResult {
|
||||
configFileName?: string;
|
||||
configFileName?: NormalizedPath;
|
||||
configFileErrors?: Diagnostic[];
|
||||
}
|
||||
class ProjectService {
|
||||
@ -11353,7 +11418,8 @@ declare namespace ts.server {
|
||||
applyChangesInOpenFiles(openFiles: protocol.ExternalFile[], changedFiles: protocol.ChangedOpenFile[], closedFiles: string[]): void;
|
||||
private closeConfiguredProject(configFile);
|
||||
closeExternalProject(uncheckedFileName: string, suppressRefresh?: boolean): void;
|
||||
openExternalProject(proj: protocol.ExternalProject): void;
|
||||
openExternalProjects(projects: protocol.ExternalProject[]): void;
|
||||
openExternalProject(proj: protocol.ExternalProject, suppressRefreshOfInferredProjects?: boolean): void;
|
||||
}
|
||||
}
|
||||
declare namespace ts.server {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
20
lib/typescript.d.ts
vendored
20
lib/typescript.d.ts
vendored
@ -1623,6 +1623,7 @@ declare namespace ts {
|
||||
writeSpace(text: string): void;
|
||||
writeStringLiteral(text: string): void;
|
||||
writeParameter(text: string): void;
|
||||
writeProperty(text: string): void;
|
||||
writeSymbol(text: string, symbol: Symbol): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
@ -1853,6 +1854,7 @@ declare namespace ts {
|
||||
interface IndexedAccessType extends TypeVariable {
|
||||
objectType: Type;
|
||||
indexType: Type;
|
||||
constraint?: Type;
|
||||
}
|
||||
interface IndexType extends Type {
|
||||
type: TypeVariable | UnionOrIntersectionType;
|
||||
@ -1875,6 +1877,11 @@ declare namespace ts {
|
||||
isReadonly: boolean;
|
||||
declaration?: SignatureDeclaration;
|
||||
}
|
||||
interface FileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@ -2142,7 +2149,7 @@ declare namespace ts {
|
||||
}
|
||||
declare namespace ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version = "2.1.4";
|
||||
const version = "2.1.5";
|
||||
}
|
||||
declare namespace ts {
|
||||
type FileWatcherCallback = (fileName: string, removed?: boolean) => void;
|
||||
@ -2361,7 +2368,7 @@ declare namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine;
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine;
|
||||
function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: CompilerOptions;
|
||||
@ -2394,6 +2401,7 @@ declare namespace ts {
|
||||
getName(): string;
|
||||
getDeclarations(): Declaration[];
|
||||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
getJsDocTags(): JSDocTagInfo[];
|
||||
}
|
||||
interface Type {
|
||||
getFlags(): TypeFlags;
|
||||
@ -2414,6 +2422,7 @@ declare namespace ts {
|
||||
getParameters(): Symbol[];
|
||||
getReturnType(): Type;
|
||||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
getJsDocTags(): JSDocTagInfo[];
|
||||
}
|
||||
interface SourceFile {
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
@ -2735,12 +2744,17 @@ declare namespace ts {
|
||||
text: string;
|
||||
kind: string;
|
||||
}
|
||||
interface JSDocTagInfo {
|
||||
name: string;
|
||||
text?: string;
|
||||
}
|
||||
interface QuickInfo {
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
textSpan: TextSpan;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
interface RenameInfo {
|
||||
canRename: boolean;
|
||||
@ -2771,6 +2785,7 @@ declare namespace ts {
|
||||
separatorDisplayParts: SymbolDisplayPart[];
|
||||
parameters: SignatureHelpParameter[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
/**
|
||||
* Represents a set of signature help items, and the preferred item that should be selected.
|
||||
@ -2809,6 +2824,7 @@ declare namespace ts {
|
||||
kindModifiers: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
interface OutliningSpan {
|
||||
/** The span of the document to actually collapse. */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
20
lib/typescriptServices.d.ts
vendored
20
lib/typescriptServices.d.ts
vendored
@ -1623,6 +1623,7 @@ declare namespace ts {
|
||||
writeSpace(text: string): void;
|
||||
writeStringLiteral(text: string): void;
|
||||
writeParameter(text: string): void;
|
||||
writeProperty(text: string): void;
|
||||
writeSymbol(text: string, symbol: Symbol): void;
|
||||
writeLine(): void;
|
||||
increaseIndent(): void;
|
||||
@ -1853,6 +1854,7 @@ declare namespace ts {
|
||||
interface IndexedAccessType extends TypeVariable {
|
||||
objectType: Type;
|
||||
indexType: Type;
|
||||
constraint?: Type;
|
||||
}
|
||||
interface IndexType extends Type {
|
||||
type: TypeVariable | UnionOrIntersectionType;
|
||||
@ -1875,6 +1877,11 @@ declare namespace ts {
|
||||
isReadonly: boolean;
|
||||
declaration?: SignatureDeclaration;
|
||||
}
|
||||
interface FileExtensionInfo {
|
||||
extension: string;
|
||||
scriptKind: ScriptKind;
|
||||
isMixedContent: boolean;
|
||||
}
|
||||
interface DiagnosticMessage {
|
||||
key: string;
|
||||
category: DiagnosticCategory;
|
||||
@ -2142,7 +2149,7 @@ declare namespace ts {
|
||||
}
|
||||
declare namespace ts {
|
||||
/** The version of the TypeScript compiler release */
|
||||
const version = "2.1.4";
|
||||
const version = "2.1.5";
|
||||
}
|
||||
declare namespace ts {
|
||||
type FileWatcherCallback = (fileName: string, removed?: boolean) => void;
|
||||
@ -2361,7 +2368,7 @@ declare namespace ts {
|
||||
* @param basePath A root directory to resolve relative path entries in the config
|
||||
* file to. e.g. outDir
|
||||
*/
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[]): ParsedCommandLine;
|
||||
function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: FileExtensionInfo[]): ParsedCommandLine;
|
||||
function convertCompileOnSaveOptionFromJson(jsonOption: any, basePath: string, errors: Diagnostic[]): boolean;
|
||||
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
|
||||
options: CompilerOptions;
|
||||
@ -2394,6 +2401,7 @@ declare namespace ts {
|
||||
getName(): string;
|
||||
getDeclarations(): Declaration[];
|
||||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
getJsDocTags(): JSDocTagInfo[];
|
||||
}
|
||||
interface Type {
|
||||
getFlags(): TypeFlags;
|
||||
@ -2414,6 +2422,7 @@ declare namespace ts {
|
||||
getParameters(): Symbol[];
|
||||
getReturnType(): Type;
|
||||
getDocumentationComment(): SymbolDisplayPart[];
|
||||
getJsDocTags(): JSDocTagInfo[];
|
||||
}
|
||||
interface SourceFile {
|
||||
getLineAndCharacterOfPosition(pos: number): LineAndCharacter;
|
||||
@ -2735,12 +2744,17 @@ declare namespace ts {
|
||||
text: string;
|
||||
kind: string;
|
||||
}
|
||||
interface JSDocTagInfo {
|
||||
name: string;
|
||||
text?: string;
|
||||
}
|
||||
interface QuickInfo {
|
||||
kind: string;
|
||||
kindModifiers: string;
|
||||
textSpan: TextSpan;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
interface RenameInfo {
|
||||
canRename: boolean;
|
||||
@ -2771,6 +2785,7 @@ declare namespace ts {
|
||||
separatorDisplayParts: SymbolDisplayPart[];
|
||||
parameters: SignatureHelpParameter[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
/**
|
||||
* Represents a set of signature help items, and the preferred item that should be selected.
|
||||
@ -2809,6 +2824,7 @@ declare namespace ts {
|
||||
kindModifiers: string;
|
||||
displayParts: SymbolDisplayPart[];
|
||||
documentation: SymbolDisplayPart[];
|
||||
tags: JSDocTagInfo[];
|
||||
}
|
||||
interface OutliningSpan {
|
||||
/** The span of the document to actually collapse. */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -137,7 +137,7 @@ var ts;
|
||||
})(ts || (ts = {}));
|
||||
var ts;
|
||||
(function (ts) {
|
||||
ts.version = "2.1.4";
|
||||
ts.version = "2.1.5";
|
||||
})(ts || (ts = {}));
|
||||
(function (ts) {
|
||||
var createObject = Object.create;
|
||||
@ -818,15 +818,6 @@ var ts;
|
||||
return result;
|
||||
}
|
||||
ts.reduceProperties = reduceProperties;
|
||||
function reduceOwnProperties(map, callback, initial) {
|
||||
var result = initial;
|
||||
for (var key in map)
|
||||
if (hasOwnProperty.call(map, key)) {
|
||||
result = callback(result, map[key], String(key));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
ts.reduceOwnProperties = reduceOwnProperties;
|
||||
function equalOwnProperties(left, right, equalityComparer) {
|
||||
if (left === right)
|
||||
return true;
|
||||
@ -1673,8 +1664,19 @@ var ts;
|
||||
ts.supportedTypescriptExtensionsForExtractExtension = [".d.ts", ".ts", ".tsx"];
|
||||
ts.supportedJavascriptExtensions = [".js", ".jsx"];
|
||||
var allSupportedExtensions = ts.supportedTypeScriptExtensions.concat(ts.supportedJavascriptExtensions);
|
||||
function getSupportedExtensions(options) {
|
||||
return options && options.allowJs ? allSupportedExtensions : ts.supportedTypeScriptExtensions;
|
||||
function getSupportedExtensions(options, extraFileExtensions) {
|
||||
var needAllExtensions = options && options.allowJs;
|
||||
if (!extraFileExtensions || extraFileExtensions.length === 0) {
|
||||
return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions;
|
||||
}
|
||||
var extensions = (needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions).slice(0);
|
||||
for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) {
|
||||
var extInfo = extraFileExtensions_1[_i];
|
||||
if (needAllExtensions || extInfo.scriptKind === 3) {
|
||||
extensions.push(extInfo.extension);
|
||||
}
|
||||
}
|
||||
return extensions;
|
||||
}
|
||||
ts.getSupportedExtensions = getSupportedExtensions;
|
||||
function hasJavaScriptFileExtension(fileName) {
|
||||
@ -1685,11 +1687,11 @@ var ts;
|
||||
return forEach(ts.supportedTypeScriptExtensions, function (extension) { return fileExtensionIs(fileName, extension); });
|
||||
}
|
||||
ts.hasTypeScriptFileExtension = hasTypeScriptFileExtension;
|
||||
function isSupportedSourceFileName(fileName, compilerOptions) {
|
||||
function isSupportedSourceFileName(fileName, compilerOptions, extraFileExtensions) {
|
||||
if (!fileName) {
|
||||
return false;
|
||||
}
|
||||
for (var _i = 0, _a = getSupportedExtensions(compilerOptions); _i < _a.length; _i++) {
|
||||
for (var _i = 0, _a = getSupportedExtensions(compilerOptions, extraFileExtensions); _i < _a.length; _i++) {
|
||||
var extension = _a[_i];
|
||||
if (fileExtensionIs(fileName, extension)) {
|
||||
return true;
|
||||
@ -3207,6 +3209,7 @@ var ts;
|
||||
JSX_element_0_has_no_corresponding_closing_tag: { code: 17008, category: ts.DiagnosticCategory.Error, key: "JSX_element_0_has_no_corresponding_closing_tag_17008", message: "JSX element '{0}' has no corresponding closing tag." },
|
||||
super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: { code: 17009, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", message: "'super' must be called before accessing 'this' in the constructor of a derived class." },
|
||||
Unknown_type_acquisition_option_0: { code: 17010, category: ts.DiagnosticCategory.Error, key: "Unknown_type_acquisition_option_0_17010", message: "Unknown type acquisition option '{0}'." },
|
||||
super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: { code: 17011, category: ts.DiagnosticCategory.Error, key: "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", message: "'super' must be called before accessing a property of 'super' in the constructor of a derived class." },
|
||||
Circularity_detected_while_resolving_configuration_Colon_0: { code: 18000, category: ts.DiagnosticCategory.Error, key: "Circularity_detected_while_resolving_configuration_Colon_0_18000", message: "Circularity detected while resolving configuration: {0}" },
|
||||
A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: { code: 18001, category: ts.DiagnosticCategory.Error, key: "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", message: "A path in an 'extends' option must be relative or rooted, but '{0}' is not." },
|
||||
The_files_list_in_config_file_0_is_empty: { code: 18002, category: ts.DiagnosticCategory.Error, key: "The_files_list_in_config_file_0_is_empty_18002", message: "The 'files' list in config file '{0}' is empty." },
|
||||
@ -5291,14 +5294,7 @@ var ts;
|
||||
}
|
||||
ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType;
|
||||
function parseCustomTypeOption(opt, value, errors) {
|
||||
var key = trimString((value || "")).toLowerCase();
|
||||
var map = opt.type;
|
||||
if (key in map) {
|
||||
return map[key];
|
||||
}
|
||||
else {
|
||||
errors.push(createCompilerDiagnosticForInvalidCustomType(opt));
|
||||
}
|
||||
return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors);
|
||||
}
|
||||
ts.parseCustomTypeOption = parseCustomTypeOption;
|
||||
function parseListTypeOption(opt, value, errors) {
|
||||
@ -5538,9 +5534,10 @@ var ts;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack) {
|
||||
function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
|
||||
if (existingOptions === void 0) { existingOptions = {}; }
|
||||
if (resolutionStack === void 0) { resolutionStack = []; }
|
||||
if (extraFileExtensions === void 0) { extraFileExtensions = []; }
|
||||
var errors = [];
|
||||
var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames);
|
||||
var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName);
|
||||
@ -5663,7 +5660,7 @@ var ts;
|
||||
if (fileNames === undefined && includeSpecs === undefined) {
|
||||
includeSpecs = ["**/*"];
|
||||
}
|
||||
var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors);
|
||||
var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions);
|
||||
if (result.fileNames.length === 0 && !ts.hasProperty(json, "files") && resolutionStack.length === 0) {
|
||||
errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2, configFileName || "tsconfig.json", JSON.stringify(includeSpecs || []), JSON.stringify(excludeSpecs || [])));
|
||||
}
|
||||
@ -5767,7 +5764,7 @@ var ts;
|
||||
var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/;
|
||||
var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//;
|
||||
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
||||
function matchFileNames(fileNames, include, exclude, basePath, options, host, errors) {
|
||||
function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) {
|
||||
basePath = ts.normalizePath(basePath);
|
||||
var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper;
|
||||
var literalFileMap = ts.createMap();
|
||||
@ -5779,7 +5776,7 @@ var ts;
|
||||
exclude = validateSpecs(exclude, errors, true);
|
||||
}
|
||||
var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames);
|
||||
var supportedExtensions = ts.getSupportedExtensions(options);
|
||||
var supportedExtensions = ts.getSupportedExtensions(options, extraFileExtensions);
|
||||
if (fileNames) {
|
||||
for (var _i = 0, fileNames_1 = fileNames; _i < fileNames_1.length; _i++) {
|
||||
var fileName = fileNames_1[_i];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user