diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-10-14 18:40:54 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-10-14 18:40:54 +0200 |
commit | 9df98e65f842cf3acae09cbdd969966f42d64469 (patch) | |
tree | f071d3e09a342c208fb8e1cd3f5241d64fbfbaf3 /node_modules/typescript/lib/tsserverlibrary.js | |
parent | 008926b18470e7f394cd640302957b29728a9803 (diff) | |
download | wallet-core-9df98e65f842cf3acae09cbdd969966f42d64469.tar.xz |
update dependencies
Diffstat (limited to 'node_modules/typescript/lib/tsserverlibrary.js')
-rw-r--r-- | node_modules/typescript/lib/tsserverlibrary.js | 27966 |
1 files changed, 14986 insertions, 12980 deletions
diff --git a/node_modules/typescript/lib/tsserverlibrary.js b/node_modules/typescript/lib/tsserverlibrary.js index cd17f4faf..9401638a2 100644 --- a/node_modules/typescript/lib/tsserverlibrary.js +++ b/node_modules/typescript/lib/tsserverlibrary.js @@ -1,18 +1,19 @@ -/*! *****************************************************************************
-Copyright (c) Microsoft Corporation. All rights reserved.
-Licensed under the Apache License, Version 2.0 (the "License"); you may not use
-this file except in compliance with the License. You may obtain a copy of the
-License at http://www.apache.org/licenses/LICENSE-2.0
-
-THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
-WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
-MERCHANTABLITY OR NON-INFRINGEMENT.
-
-See the Apache Version 2.0 License for specific language governing permissions
-and limitations under the License.
-***************************************************************************** */
-
+/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +"use strict"; var __assign = (this && this.__assign) || Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; @@ -305,38 +306,29 @@ var ts; SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 267] = "JSDocTypeExpression"; SyntaxKind[SyntaxKind["JSDocAllType"] = 268] = "JSDocAllType"; SyntaxKind[SyntaxKind["JSDocUnknownType"] = 269] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocArrayType"] = 270] = "JSDocArrayType"; - SyntaxKind[SyntaxKind["JSDocUnionType"] = 271] = "JSDocUnionType"; - SyntaxKind[SyntaxKind["JSDocTupleType"] = 272] = "JSDocTupleType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 273] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 274] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocRecordType"] = 275] = "JSDocRecordType"; - SyntaxKind[SyntaxKind["JSDocRecordMember"] = 276] = "JSDocRecordMember"; - SyntaxKind[SyntaxKind["JSDocTypeReference"] = 277] = "JSDocTypeReference"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 278] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 279] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 280] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocConstructorType"] = 281] = "JSDocConstructorType"; - SyntaxKind[SyntaxKind["JSDocThisType"] = 282] = "JSDocThisType"; - SyntaxKind[SyntaxKind["JSDocComment"] = 283] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocTag"] = 284] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 285] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 286] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 287] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 288] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 289] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 290] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 291] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 292] = "JSDocPropertyTag"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 293] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocLiteralType"] = 294] = "JSDocLiteralType"; - SyntaxKind[SyntaxKind["SyntaxList"] = 295] = "SyntaxList"; - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 296] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 297] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 298] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 299] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 300] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["Count"] = 301] = "Count"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 270] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 271] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 272] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 273] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 274] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocComment"] = 275] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocTag"] = 276] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 277] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 278] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 279] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 280] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 281] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 282] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 283] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 284] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 285] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["SyntaxList"] = 286] = "SyntaxList"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 287] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 288] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 289] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 290] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 291] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["Count"] = 292] = "Count"; SyntaxKind[SyntaxKind["FirstAssignment"] = 58] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 70] = "LastAssignment"; SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 59] = "FirstCompoundAssignment"; @@ -363,9 +355,9 @@ var ts; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 70] = "LastBinaryOperator"; SyntaxKind[SyntaxKind["FirstNode"] = 143] = "FirstNode"; SyntaxKind[SyntaxKind["FirstJSDocNode"] = 267] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 294] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 284] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 294] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 285] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 276] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 285] = "LastJSDocTagNode"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -390,6 +382,7 @@ var ts; NodeFlags[NodeFlags["ThisNodeOrAnySubNodesHasError"] = 131072] = "ThisNodeOrAnySubNodesHasError"; NodeFlags[NodeFlags["HasAggregatedChildData"] = 262144] = "HasAggregatedChildData"; NodeFlags[NodeFlags["PossiblyContainsDynamicImport"] = 524288] = "PossiblyContainsDynamicImport"; + NodeFlags[NodeFlags["JSDoc"] = 1048576] = "JSDoc"; NodeFlags[NodeFlags["BlockScoped"] = 3] = "BlockScoped"; NodeFlags[NodeFlags["ReachabilityCheckFlags"] = 384] = "ReachabilityCheckFlags"; NodeFlags[NodeFlags["ReachabilityAndEmitFlags"] = 1408] = "ReachabilityAndEmitFlags"; @@ -519,6 +512,8 @@ var ts; TypeFormatFlags[TypeFormatFlags["SuppressAnyReturnType"] = 4096] = "SuppressAnyReturnType"; TypeFormatFlags[TypeFormatFlags["AddUndefined"] = 8192] = "AddUndefined"; TypeFormatFlags[TypeFormatFlags["WriteClassExpressionAsTypeLiteral"] = 16384] = "WriteClassExpressionAsTypeLiteral"; + TypeFormatFlags[TypeFormatFlags["InArrayType"] = 32768] = "InArrayType"; + TypeFormatFlags[TypeFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 65536] = "UseAliasDefinedOutsideCurrentScope"; })(TypeFormatFlags = ts.TypeFormatFlags || (ts.TypeFormatFlags = {})); var SymbolFormatFlags; (function (SymbolFormatFlags) { @@ -580,13 +575,11 @@ var ts; SymbolFlags[SymbolFlags["TypeParameter"] = 262144] = "TypeParameter"; SymbolFlags[SymbolFlags["TypeAlias"] = 524288] = "TypeAlias"; SymbolFlags[SymbolFlags["ExportValue"] = 1048576] = "ExportValue"; - SymbolFlags[SymbolFlags["ExportType"] = 2097152] = "ExportType"; - SymbolFlags[SymbolFlags["ExportNamespace"] = 4194304] = "ExportNamespace"; - SymbolFlags[SymbolFlags["Alias"] = 8388608] = "Alias"; - SymbolFlags[SymbolFlags["Prototype"] = 16777216] = "Prototype"; - SymbolFlags[SymbolFlags["ExportStar"] = 33554432] = "ExportStar"; - SymbolFlags[SymbolFlags["Optional"] = 67108864] = "Optional"; - SymbolFlags[SymbolFlags["Transient"] = 134217728] = "Transient"; + SymbolFlags[SymbolFlags["Alias"] = 2097152] = "Alias"; + SymbolFlags[SymbolFlags["Prototype"] = 4194304] = "Prototype"; + SymbolFlags[SymbolFlags["ExportStar"] = 8388608] = "ExportStar"; + SymbolFlags[SymbolFlags["Optional"] = 16777216] = "Optional"; + SymbolFlags[SymbolFlags["Transient"] = 33554432] = "Transient"; SymbolFlags[SymbolFlags["Enum"] = 384] = "Enum"; SymbolFlags[SymbolFlags["Variable"] = 3] = "Variable"; SymbolFlags[SymbolFlags["Value"] = 107455] = "Value"; @@ -611,14 +604,13 @@ var ts; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 74687] = "SetAccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 530920] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 793064] = "TypeAliasExcludes"; - SymbolFlags[SymbolFlags["AliasExcludes"] = 8388608] = "AliasExcludes"; - SymbolFlags[SymbolFlags["ModuleMember"] = 8914931] = "ModuleMember"; + SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; + SymbolFlags[SymbolFlags["ModuleMember"] = 2623475] = "ModuleMember"; SymbolFlags[SymbolFlags["ExportHasLocal"] = 944] = "ExportHasLocal"; SymbolFlags[SymbolFlags["HasExports"] = 1952] = "HasExports"; SymbolFlags[SymbolFlags["HasMembers"] = 6240] = "HasMembers"; SymbolFlags[SymbolFlags["BlockScoped"] = 418] = "BlockScoped"; SymbolFlags[SymbolFlags["PropertyOrAccessor"] = 98308] = "PropertyOrAccessor"; - SymbolFlags[SymbolFlags["Export"] = 7340032] = "Export"; SymbolFlags[SymbolFlags["ClassMember"] = 106500] = "ClassMember"; SymbolFlags[SymbolFlags["Classifiable"] = 788448] = "Classifiable"; })(SymbolFlags = ts.SymbolFlags || (ts.SymbolFlags = {})); @@ -641,6 +633,25 @@ var ts; CheckFlags[CheckFlags["ContainsStatic"] = 512] = "ContainsStatic"; CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic"; })(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {})); + var InternalSymbolName; + (function (InternalSymbolName) { + InternalSymbolName["Call"] = "__call"; + InternalSymbolName["Constructor"] = "__constructor"; + InternalSymbolName["New"] = "__new"; + InternalSymbolName["Index"] = "__index"; + InternalSymbolName["ExportStar"] = "__export"; + InternalSymbolName["Global"] = "__global"; + InternalSymbolName["Missing"] = "__missing"; + InternalSymbolName["Type"] = "__type"; + InternalSymbolName["Object"] = "__object"; + InternalSymbolName["JSXAttributes"] = "__jsxAttributes"; + InternalSymbolName["Class"] = "__class"; + InternalSymbolName["Function"] = "__function"; + InternalSymbolName["Computed"] = "__computed"; + InternalSymbolName["Resolving"] = "__resolving__"; + InternalSymbolName["ExportEquals"] = "export="; + InternalSymbolName["Default"] = "default"; + })(InternalSymbolName = ts.InternalSymbolName || (ts.InternalSymbolName = {})); var NodeCheckFlags; (function (NodeCheckFlags) { NodeCheckFlags[NodeCheckFlags["TypeChecked"] = 1] = "TypeChecked"; @@ -749,6 +760,12 @@ var ts; InferenceFlags[InferenceFlags["NoDefault"] = 2] = "NoDefault"; InferenceFlags[InferenceFlags["AnyDefault"] = 4] = "AnyDefault"; })(InferenceFlags = ts.InferenceFlags || (ts.InferenceFlags = {})); + var Ternary; + (function (Ternary) { + Ternary[Ternary["False"] = 0] = "False"; + Ternary[Ternary["Maybe"] = 1] = "Maybe"; + Ternary[Ternary["True"] = -1] = "True"; + })(Ternary = ts.Ternary || (ts.Ternary = {})); var SpecialPropertyAssignmentKind; (function (SpecialPropertyAssignmentKind) { SpecialPropertyAssignmentKind[SpecialPropertyAssignmentKind["None"] = 0] = "None"; @@ -799,6 +816,7 @@ var ts; ScriptKind[ScriptKind["TS"] = 3] = "TS"; ScriptKind[ScriptKind["TSX"] = 4] = "TSX"; ScriptKind[ScriptKind["External"] = 5] = "External"; + ScriptKind[ScriptKind["JSON"] = 6] = "JSON"; })(ScriptKind = ts.ScriptKind || (ts.ScriptKind = {})); var ScriptTarget; (function (ScriptTarget) { @@ -954,12 +972,11 @@ var ts; })(CharacterCodes = ts.CharacterCodes || (ts.CharacterCodes = {})); var Extension; (function (Extension) { - Extension[Extension["Ts"] = 0] = "Ts"; - Extension[Extension["Tsx"] = 1] = "Tsx"; - Extension[Extension["Dts"] = 2] = "Dts"; - Extension[Extension["Js"] = 3] = "Js"; - Extension[Extension["Jsx"] = 4] = "Jsx"; - Extension[Extension["LastTypeScriptExtension"] = 2] = "LastTypeScriptExtension"; + Extension["Ts"] = ".ts"; + Extension["Tsx"] = ".tsx"; + Extension["Dts"] = ".d.ts"; + Extension["Js"] = ".js"; + Extension["Jsx"] = ".jsx"; })(Extension = ts.Extension || (ts.Extension = {})); var TransformFlags; (function (TransformFlags) { @@ -1049,6 +1066,7 @@ var ts; EmitFlags[EmitFlags["HasEndOfDeclarationMarker"] = 4194304] = "HasEndOfDeclarationMarker"; EmitFlags[EmitFlags["Iterator"] = 8388608] = "Iterator"; EmitFlags[EmitFlags["NoAsciiEscaping"] = 16777216] = "NoAsciiEscaping"; + EmitFlags[EmitFlags["TypeScriptClassWrapper"] = 33554432] = "TypeScriptClassWrapper"; })(EmitFlags = ts.EmitFlags || (ts.EmitFlags = {})); var ExternalEmitHelpers; (function (ExternalEmitHelpers) { @@ -1081,7 +1099,8 @@ var ts; EmitHint[EmitHint["SourceFile"] = 0] = "SourceFile"; EmitHint[EmitHint["Expression"] = 1] = "Expression"; EmitHint[EmitHint["IdentifierName"] = 2] = "IdentifierName"; - EmitHint[EmitHint["Unspecified"] = 3] = "Unspecified"; + EmitHint[EmitHint["MappedTypeParameter"] = 3] = "MappedTypeParameter"; + EmitHint[EmitHint["Unspecified"] = 4] = "Unspecified"; })(EmitHint = ts.EmitHint || (ts.EmitHint = {})); })(ts || (ts = {})); var ts; @@ -1145,15 +1164,10 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.version = "2.4.2"; + ts.versionMajorMinor = "2.5"; + ts.version = ts.versionMajorMinor + ".3"; })(ts || (ts = {})); (function (ts) { - var Ternary; - (function (Ternary) { - Ternary[Ternary["False"] = 0] = "False"; - Ternary[Ternary["Maybe"] = 1] = "Maybe"; - Ternary[Ternary["True"] = -1] = "True"; - })(Ternary = ts.Ternary || (ts.Ternary = {})); ts.collator = typeof Intl === "object" && typeof Intl.Collator === "function" ? new Intl.Collator(undefined, { usage: "sort", sensitivity: "accent" }) : undefined; ts.localeCompareIsCorrect = ts.collator && ts.collator.compare("a", "B") < 0; function createDictionaryObject() { @@ -1166,6 +1180,21 @@ var ts; return new MapCtr(); } ts.createMap = createMap; + function createUnderscoreEscapedMap() { + return new MapCtr(); + } + ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap; + function createSymbolTable(symbols) { + var result = createMap(); + if (symbols) { + for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { + var symbol = symbols_1[_i]; + result.set(symbol.escapedName, symbol); + } + } + return result; + } + ts.createSymbolTable = createSymbolTable; function createMapFromTemplate(template) { var map = new MapCtr(); for (var key in template) { @@ -1242,45 +1271,6 @@ var ts; return class_1; }()); } - function createFileMap(keyMapper) { - var files = createMap(); - return { - get: get, - set: set, - contains: contains, - remove: remove, - forEachValue: forEachValueInMap, - getKeys: getKeys, - clear: clear, - }; - function forEachValueInMap(f) { - files.forEach(function (file, key) { - f(key, file); - }); - } - function getKeys() { - return arrayFrom(files.keys()); - } - function get(path) { - return files.get(toKey(path)); - } - function set(path, value) { - files.set(toKey(path), value); - } - function contains(path) { - return files.has(toKey(path)); - } - function remove(path) { - files.delete(toKey(path)); - } - function clear() { - files.clear(); - } - function toKey(path) { - return keyMapper ? keyMapper(path) : path; - } - } - ts.createFileMap = createFileMap; function toPath(fileName, basePath, getCanonicalFileName) { var nonCanonicalizedPath = isRootedDiskPath(fileName) ? normalizePath(fileName) @@ -1465,16 +1455,19 @@ var ts; ts.removeWhere = removeWhere; function filterMutate(array, f) { var outIndex = 0; - for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { - var item = array_3[_i]; - if (f(item)) { - array[outIndex] = item; + for (var i = 0; i < array.length; i++) { + if (f(array[i], i, array)) { + array[outIndex] = array[i]; outIndex++; } } array.length = outIndex; } ts.filterMutate = filterMutate; + function clear(array) { + array.length = 0; + } + ts.clear = clear; function map(array, f) { var result; if (array) { @@ -1510,8 +1503,8 @@ var ts; var result; if (array) { result = []; - for (var _i = 0, array_4 = array; _i < array_4.length; _i++) { - var v = array_4[_i]; + for (var _i = 0, array_3 = array; _i < array_3.length; _i++) { + var v = array_3[_i]; if (v) { if (isArray(v)) { addRange(result, v); @@ -1544,6 +1537,19 @@ var ts; return result; } ts.flatMap = flatMap; + function flatMapIter(iter, mapfn) { + var result = []; + while (true) { + var _a = iter.next(), value = _a.value, done = _a.done; + if (done) + break; + var res = mapfn(value); + if (res) + result.push.apply(result, res); + } + return result; + } + ts.flatMapIter = flatMapIter; function sameFlatMap(array, mapfn) { var result; if (array) { @@ -1568,11 +1574,13 @@ var ts; ts.sameFlatMap = sameFlatMap; function mapDefined(array, mapFn) { var result = []; - for (var i = 0; i < array.length; i++) { - var item = array[i]; - var mapped = mapFn(item, i); - if (mapped !== undefined) { - result.push(mapped); + if (array) { + for (var i = 0; i < array.length; i++) { + var item = array[i]; + var mapped = mapFn(item, i); + if (mapped !== undefined) { + result.push(mapped); + } } } return result; @@ -1640,8 +1648,8 @@ var ts; function some(array, predicate) { if (array) { if (predicate) { - for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { - var v = array_5[_i]; + for (var _i = 0, array_4 = array; _i < array_4.length; _i++) { + var v = array_4[_i]; if (predicate(v)) { return true; } @@ -1666,8 +1674,8 @@ var ts; var result; if (array) { result = []; - loop: for (var _i = 0, array_6 = array; _i < array_6.length; _i++) { - var item = array_6[_i]; + loop: for (var _i = 0, array_5 = array; _i < array_5.length; _i++) { + var item = array_5[_i]; for (var _a = 0, result_1 = result; _a < result_1.length; _a++) { var res = result_1[_a]; if (areEqual ? areEqual(res, item) : res === item) { @@ -1755,8 +1763,8 @@ var ts; ts.relativeComplement = relativeComplement; function sum(array, prop) { var result = 0; - for (var _i = 0, array_7 = array; _i < array_7.length; _i++) { - var v = array_7[_i]; + for (var _i = 0, array_6 = array; _i < array_6.length; _i++) { + var v = array_6[_i]; result += v[prop]; } return result; @@ -1945,15 +1953,6 @@ var ts; var _b; } ts.arrayFrom = arrayFrom; - function convertToArray(iterator, f) { - var result = []; - for (var _a = iterator.next(), value = _a.value, done = _a.done; !done; _b = iterator.next(), value = _b.value, done = _b.done, _b) { - result.push(f(value)); - } - return result; - var _b; - } - ts.convertToArray = convertToArray; function forEachEntry(map, callback) { var iterator = map.entries(); for (var _a = iterator.next(), pair = _a.value, done = _a.done; !done; _b = iterator.next(), pair = _b.value, done = _b.done, _b) { @@ -2025,13 +2024,17 @@ var ts; ts.equalOwnProperties = equalOwnProperties; function arrayToMap(array, makeKey, makeValue) { var result = createMap(); - for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { - var value = array_8[_i]; + for (var _i = 0, array_7 = array; _i < array_7.length; _i++) { + var value = array_7[_i]; result.set(makeKey(value), makeValue ? makeValue(value) : value); } return result; } ts.arrayToMap = arrayToMap; + function arrayToSet(array, makeKey) { + return arrayToMap(array, makeKey || (function (s) { return s; }), function () { return true; }); + } + ts.arrayToSet = arrayToSet; function cloneMap(map) { var clone = createMap(); copyEntries(map, clone); @@ -2182,11 +2185,11 @@ var ts; ts.getLocaleSpecificMessage = getLocaleSpecificMessage; function createFileDiagnostic(file, start, length, message) { var end = start + length; - Debug.assert(start >= 0, "start must be non-negative, is " + start); - Debug.assert(length >= 0, "length must be non-negative, is " + length); + Debug.assertGreaterThanOrEqual(start, 0); + Debug.assertGreaterThanOrEqual(length, 0); if (file) { - Debug.assert(start <= file.text.length, "start must be within the bounds of the file. " + start + " > " + file.text.length); - Debug.assert(end <= file.text.length, "end must be the bounds of the file. " + end + " > " + file.text.length); + Debug.assertLessThanOrEqual(start, file.text.length); + Debug.assertLessThanOrEqual(end, file.text.length); } var text = getLocaleSpecificMessage(message); if (arguments.length > 4) { @@ -2420,10 +2423,18 @@ var ts; return path && !isRootedDiskPath(path) && path.indexOf("://") !== -1; } ts.isUrl = isUrl; + function pathIsRelative(path) { + return /^\.\.?($|[\\/])/.test(path); + } + ts.pathIsRelative = pathIsRelative; function isExternalModuleNameRelative(moduleName) { - return /^\.\.?($|[\\/])/.test(moduleName); + return pathIsRelative(moduleName) || isRootedDiskPath(moduleName); } ts.isExternalModuleNameRelative = isExternalModuleNameRelative; + function moduleHasNonRelativeName(moduleName) { + return !isExternalModuleNameRelative(moduleName); + } + ts.moduleHasNonRelativeName = moduleHasNonRelativeName; function getEmitScriptTarget(compilerOptions) { return compilerOptions.target || 0; } @@ -2526,7 +2537,7 @@ var ts; var pathComponents = getNormalizedPathOrUrlComponents(relativeOrAbsolutePath, currentDirectory); var directoryComponents = getNormalizedPathOrUrlComponents(directoryPathOrUrl, currentDirectory); if (directoryComponents.length > 1 && lastOrUndefined(directoryComponents) === "") { - directoryComponents.length--; + directoryComponents.pop(); } var joinStartIndex; for (joinStartIndex = 0; joinStartIndex < pathComponents.length && joinStartIndex < directoryComponents.length; joinStartIndex++) { @@ -2662,8 +2673,28 @@ var ts; ts.fileExtensionIsOneOf = fileExtensionIsOneOf; var reservedCharacterPattern = /[^\w\s\/]/g; var wildcardCharCodes = [42, 63]; - var singleAsteriskRegexFragmentFiles = "([^./]|(\\.(?!min\\.js$))?)*"; - var singleAsteriskRegexFragmentOther = "[^/]*"; + ts.commonPackageFolders = ["node_modules", "bower_components", "jspm_packages"]; + var implicitExcludePathRegexPattern = "(?!(" + ts.commonPackageFolders.join("|") + ")(/|$))"; + var filesMatcher = { + singleAsteriskRegexFragment: "([^./]|(\\.(?!min\\.js$))?)*", + doubleAsteriskRegexFragment: "(/" + implicitExcludePathRegexPattern + "[^/.][^/]*)*?", + replaceWildcardCharacter: function (match) { return replaceWildcardCharacter(match, filesMatcher.singleAsteriskRegexFragment); } + }; + var directoriesMatcher = { + singleAsteriskRegexFragment: "[^/]*", + doubleAsteriskRegexFragment: "(/" + implicitExcludePathRegexPattern + "[^/.][^/]*)*?", + replaceWildcardCharacter: function (match) { return replaceWildcardCharacter(match, directoriesMatcher.singleAsteriskRegexFragment); } + }; + var excludeMatcher = { + singleAsteriskRegexFragment: "[^/]*", + doubleAsteriskRegexFragment: "(/.+?)?", + replaceWildcardCharacter: function (match) { return replaceWildcardCharacter(match, excludeMatcher.singleAsteriskRegexFragment); } + }; + var wildcardMatchers = { + files: filesMatcher, + directories: directoriesMatcher, + exclude: excludeMatcher + }; function getRegularExpressionForWildcard(specs, basePath, usage) { var patterns = getRegularExpressionsForWildcards(specs, basePath, usage); if (!patterns || !patterns.length) { @@ -2678,18 +2709,16 @@ var ts; if (specs === undefined || specs.length === 0) { return undefined; } - var replaceWildcardCharacter = usage === "files" ? replaceWildCardCharacterFiles : replaceWildCardCharacterOther; - var singleAsteriskRegexFragment = usage === "files" ? singleAsteriskRegexFragmentFiles : singleAsteriskRegexFragmentOther; - var doubleAsteriskRegexFragment = usage === "exclude" ? "(/.+?)?" : "(/[^/.][^/]*)*?"; return flatMap(specs, function (spec) { - return spec && getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter); + return spec && getSubPatternFromSpec(spec, basePath, usage, wildcardMatchers[usage]); }); } function isImplicitGlob(lastPathComponent) { return !/[.*?]/.test(lastPathComponent); } ts.isImplicitGlob = isImplicitGlob; - function getSubPatternFromSpec(spec, basePath, usage, singleAsteriskRegexFragment, doubleAsteriskRegexFragment, replaceWildcardCharacter) { + function getSubPatternFromSpec(spec, basePath, usage, _a) { + var singleAsteriskRegexFragment = _a.singleAsteriskRegexFragment, doubleAsteriskRegexFragment = _a.doubleAsteriskRegexFragment, replaceWildcardCharacter = _a.replaceWildcardCharacter; var subpattern = ""; var hasRecursiveDirectoryWildcard = false; var hasWrittenComponent = false; @@ -2721,16 +2750,24 @@ var ts; subpattern += ts.directorySeparator; } if (usage !== "exclude") { + var componentPattern = ""; if (component.charCodeAt(0) === 42) { - subpattern += "([^./]" + singleAsteriskRegexFragment + ")?"; + componentPattern += "([^./]" + singleAsteriskRegexFragment + ")?"; component = component.substr(1); } else if (component.charCodeAt(0) === 63) { - subpattern += "[^./]"; + componentPattern += "[^./]"; component = component.substr(1); } + componentPattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter); + if (componentPattern !== component) { + subpattern += implicitExcludePathRegexPattern; + } + subpattern += componentPattern; + } + else { + subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter); } - subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter); } hasWrittenComponent = true; } @@ -2740,12 +2777,6 @@ var ts; } return subpattern; } - function replaceWildCardCharacterFiles(match) { - return replaceWildcardCharacter(match, singleAsteriskRegexFragmentFiles); - } - function replaceWildCardCharacterOther(match) { - return replaceWildcardCharacter(match, singleAsteriskRegexFragmentOther); - } function replaceWildcardCharacter(match, singleAsteriskRegexFragment) { return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match; } @@ -2762,7 +2793,7 @@ var ts; }; } ts.getFileMatcherPatterns = getFileMatcherPatterns; - function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, getFileSystemEntries) { + function matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, currentDirectory, depth, getFileSystemEntries) { path = normalizePath(path); currentDirectory = normalizePath(currentDirectory); var patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory); @@ -2774,13 +2805,12 @@ var ts; var comparer = useCaseSensitiveFileNames ? compareStrings : compareStringsCaseInsensitive; for (var _i = 0, _a = patterns.basePaths; _i < _a.length; _i++) { var basePath = _a[_i]; - visitDirectory(basePath, combinePaths(currentDirectory, basePath)); + visitDirectory(basePath, combinePaths(currentDirectory, basePath), depth); } return flatten(results); - function visitDirectory(path, absolutePath) { + function visitDirectory(path, absolutePath, depth) { var _a = getFileSystemEntries(path), files = _a.files, directories = _a.directories; files = files.slice().sort(comparer); - directories = directories.slice().sort(comparer); var _loop_1 = function (current) { var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); @@ -2802,13 +2832,20 @@ var ts; var current = files_1[_i]; _loop_1(current); } + if (depth !== undefined) { + depth--; + if (depth === 0) { + return; + } + } + directories = directories.slice().sort(comparer); for (var _b = 0, directories_1 = directories; _b < directories_1.length; _b++) { var current = directories_1[_b]; var name = combinePaths(path, current); var absoluteName = combinePaths(absolutePath, current); if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) && (!excludeRegex || !excludeRegex.test(absoluteName))) { - visitDirectory(name, absoluteName); + visitDirectory(name, absoluteName, depth); } } } @@ -2846,7 +2883,7 @@ var ts; return absolute.substring(0, absolute.lastIndexOf(ts.directorySeparator, wildcardOffset)); } function ensureScriptKind(fileName, scriptKind) { - return (scriptKind || getScriptKindFromFileName(fileName)) || 3; + return scriptKind || getScriptKindFromFileName(fileName) || 3; } ts.ensureScriptKind = ensureScriptKind; function getScriptKindFromFileName(fileName) { @@ -2860,6 +2897,8 @@ var ts; return 3; case ".tsx": return 4; + case ".json": + return 6; default: return 0; } @@ -2874,14 +2913,7 @@ var ts; if (!extraFileExtensions || extraFileExtensions.length === 0 || !needAllExtensions) { return needAllExtensions ? allSupportedExtensions : ts.supportedTypeScriptExtensions; } - var extensions = allSupportedExtensions.slice(0); - for (var _i = 0, extraFileExtensions_1 = extraFileExtensions; _i < extraFileExtensions_1.length; _i++) { - var extInfo = extraFileExtensions_1[_i]; - if (extensions.indexOf(extInfo.extension) === -1) { - extensions.push(extInfo.extension); - } - } - return extensions; + return deduplicate(allSupportedExtensions.concat(extraFileExtensions.map(function (e) { return e.extension; }))); } ts.getSupportedExtensions = getSupportedExtensions; function hasJavaScriptFileExtension(fileName) { @@ -2968,7 +3000,7 @@ var ts; ts.changeExtension = changeExtension; function Symbol(flags, name) { this.flags = flags; - this.name = name; + this.escapedName = name; this.declarations = undefined; } function Type(checker, flags) { @@ -3023,15 +3055,40 @@ var ts; function assert(expression, message, verboseDebugInfo, stackCrawlMark) { if (!expression) { if (verboseDebugInfo) { - message += "\r\nVerbose Debug Information: " + verboseDebugInfo(); + message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo()); } fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert); } } Debug.assert = assert; + function assertEqual(a, b, msg, msg2) { + if (a !== b) { + var message = msg ? msg2 ? msg + " " + msg2 : msg : ""; + fail("Expected " + a + " === " + b + ". " + message); + } + } + Debug.assertEqual = assertEqual; + function assertLessThan(a, b, msg) { + if (a >= b) { + fail("Expected " + a + " < " + b + ". " + (msg || "")); + } + } + Debug.assertLessThan = assertLessThan; + function assertLessThanOrEqual(a, b) { + if (a > b) { + fail("Expected " + a + " <= " + b); + } + } + Debug.assertLessThanOrEqual = assertLessThanOrEqual; + function assertGreaterThanOrEqual(a, b) { + if (a < b) { + fail("Expected " + a + " >= " + b); + } + } + Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual; function fail(message, stackCrawlMark) { debugger; - var e = new Error(message ? "Debug Failure. " : "Debug Failure."); + var e = new Error(message ? "Debug Failure. " + message : "Debug Failure."); if (Error.captureStackTrace) { Error.captureStackTrace(e, stackCrawlMark || fail); } @@ -3152,7 +3209,7 @@ var ts; } ts.positionIsSynthesized = positionIsSynthesized; function extensionIsTypeScript(ext) { - return ext <= ts.Extension.LastTypeScriptExtension; + return ext === ".ts" || ext === ".tsx" || ext === ".d.ts"; } ts.extensionIsTypeScript = extensionIsTypeScript; function extensionFromPath(path) { @@ -3163,31 +3220,35 @@ var ts; Debug.fail("File " + path + " has unknown extension."); } ts.extensionFromPath = extensionFromPath; + function isAnySupportedFileExtension(path) { + return tryGetExtensionFromPath(path) !== undefined; + } + ts.isAnySupportedFileExtension = isAnySupportedFileExtension; function tryGetExtensionFromPath(path) { - if (fileExtensionIs(path, ".d.ts")) { - return ts.Extension.Dts; - } - if (fileExtensionIs(path, ".ts")) { - return ts.Extension.Ts; - } - if (fileExtensionIs(path, ".tsx")) { - return ts.Extension.Tsx; - } - if (fileExtensionIs(path, ".js")) { - return ts.Extension.Js; - } - if (fileExtensionIs(path, ".jsx")) { - return ts.Extension.Jsx; - } + return find(ts.supportedTypescriptExtensionsForExtractExtension, function (e) { return fileExtensionIs(path, e); }) || find(ts.supportedJavascriptExtensions, function (e) { return fileExtensionIs(path, e); }); } ts.tryGetExtensionFromPath = tryGetExtensionFromPath; function isCheckJsEnabledForFile(sourceFile, compilerOptions) { return sourceFile.checkJsDirective ? sourceFile.checkJsDirective.enabled : compilerOptions.checkJs; } ts.isCheckJsEnabledForFile = isCheckJsEnabledForFile; + function assertTypeIsNever(_) { } + ts.assertTypeIsNever = assertTypeIsNever; })(ts || (ts = {})); var ts; (function (ts) { + function setStackTraceLimit() { + if (Error.stackTraceLimit < 100) { + Error.stackTraceLimit = 100; + } + } + ts.setStackTraceLimit = setStackTraceLimit; + var FileWatcherEventKind; + (function (FileWatcherEventKind) { + FileWatcherEventKind[FileWatcherEventKind["Created"] = 0] = "Created"; + FileWatcherEventKind[FileWatcherEventKind["Changed"] = 1] = "Changed"; + FileWatcherEventKind[FileWatcherEventKind["Deleted"] = 2] = "Deleted"; + })(FileWatcherEventKind = ts.FileWatcherEventKind || (ts.FileWatcherEventKind = {})); function getNodeMajorVersion() { if (typeof process === "undefined") { return undefined; @@ -3231,7 +3292,7 @@ var ts; watcher.referenceCount += 1; return; } - watcher = _fs.watch(dirPath, { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); + watcher = _fs.watch(dirPath || ".", { persistent: true }, function (eventName, relativeFileName) { return fileEventHandler(eventName, relativeFileName, dirPath); }); watcher.referenceCount = 1; dirWatchers.set(dirPath, watcher); return; @@ -3260,7 +3321,7 @@ var ts; if (callbacks) { for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) { var fileCallback = callbacks_1[_i]; - fileCallback(fileName); + fileCallback(fileName, FileWatcherEventKind.Changed); } } } @@ -3273,7 +3334,13 @@ var ts; if (platform === "win32" || platform === "win64") { return false; } - return !fileExists(__filename.toUpperCase()) || !fileExists(__filename.toLowerCase()); + return !fileExists(swapCase(__filename)); + } + function swapCase(s) { + return s.replace(/\w/g, function (ch) { + var up = ch.toUpperCase(); + return ch === up ? ch.toLowerCase() : up; + }); } var platform = _os.platform(); var useCaseSensitiveFileNames = isFileSystemCaseSensitive(); @@ -3346,8 +3413,8 @@ var ts; return { files: [], directories: [] }; } } - function readDirectory(path, extensions, excludes, includes) { - return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), getAccessibleFileSystemEntries); + function readDirectory(path, extensions, excludes, includes, depth) { + return ts.matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames, process.cwd(), depth, getAccessibleFileSystemEntries); } var FileSystemEntryKind; (function (FileSystemEntryKind) { @@ -3399,10 +3466,19 @@ var ts; }; } function fileChanged(curr, prev) { - if (+curr.mtime <= +prev.mtime) { + var isCurrZero = +curr.mtime === 0; + var isPrevZero = +prev.mtime === 0; + var created = !isCurrZero && isPrevZero; + var deleted = isCurrZero && !isPrevZero; + var eventKind = created + ? FileWatcherEventKind.Created + : deleted + ? FileWatcherEventKind.Deleted + : FileWatcherEventKind.Changed; + if (eventKind === FileWatcherEventKind.Changed && +curr.mtime <= +prev.mtime) { return; } - callback(fileName); + callback(fileName, eventKind); } }, watchDirectory: function (directoryName, callback, recursive) { @@ -3422,9 +3498,7 @@ var ts; } }); }, - resolvePath: function (path) { - return _path.resolve(path); - }, + resolvePath: function (path) { return _path.resolve(path); }, fileExists: fileExists, directoryExists: directoryExists, createDirectory: function (directoryName) { @@ -3515,7 +3589,7 @@ var ts; getCurrentDirectory: function () { return ChakraHost.currentDirectory; }, getDirectories: ChakraHost.getDirectories, getEnvironmentVariable: ChakraHost.getEnvironmentVariable || (function () { return ""; }), - readDirectory: function (path, extensions, excludes, includes) { + readDirectory: function (path, extensions, excludes, includes, _depth) { var pattern = ts.getFileMatcherPatterns(path, excludes, includes, !!ChakraHost.useCaseSensitiveFileNames, ChakraHost.currentDirectory); return ChakraHost.readDirectory(path, extensions, pattern.basePaths, pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern); }, @@ -3563,4694 +3637,937 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - ts.Diagnostics = { - Unterminated_string_literal: { code: 1002, category: ts.DiagnosticCategory.Error, key: "Unterminated_string_literal_1002", message: "Unterminated string literal." }, - Identifier_expected: { code: 1003, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_1003", message: "Identifier expected." }, - _0_expected: { code: 1005, category: ts.DiagnosticCategory.Error, key: "_0_expected_1005", message: "'{0}' expected." }, - A_file_cannot_have_a_reference_to_itself: { code: 1006, category: ts.DiagnosticCategory.Error, key: "A_file_cannot_have_a_reference_to_itself_1006", message: "A file cannot have a reference to itself." }, - Trailing_comma_not_allowed: { code: 1009, category: ts.DiagnosticCategory.Error, key: "Trailing_comma_not_allowed_1009", message: "Trailing comma not allowed." }, - Asterisk_Slash_expected: { code: 1010, category: ts.DiagnosticCategory.Error, key: "Asterisk_Slash_expected_1010", message: "'*/' expected." }, - Unexpected_token: { code: 1012, category: ts.DiagnosticCategory.Error, key: "Unexpected_token_1012", message: "Unexpected token." }, - A_rest_parameter_must_be_last_in_a_parameter_list: { code: 1014, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_last_in_a_parameter_list_1014", message: "A rest parameter must be last in a parameter list." }, - Parameter_cannot_have_question_mark_and_initializer: { code: 1015, category: ts.DiagnosticCategory.Error, key: "Parameter_cannot_have_question_mark_and_initializer_1015", message: "Parameter cannot have question mark and initializer." }, - A_required_parameter_cannot_follow_an_optional_parameter: { code: 1016, category: ts.DiagnosticCategory.Error, key: "A_required_parameter_cannot_follow_an_optional_parameter_1016", message: "A required parameter cannot follow an optional parameter." }, - An_index_signature_cannot_have_a_rest_parameter: { code: 1017, category: ts.DiagnosticCategory.Error, key: "An_index_signature_cannot_have_a_rest_parameter_1017", message: "An index signature cannot have a rest parameter." }, - An_index_signature_parameter_cannot_have_an_accessibility_modifier: { code: 1018, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018", message: "An index signature parameter cannot have an accessibility modifier." }, - An_index_signature_parameter_cannot_have_a_question_mark: { code: 1019, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_cannot_have_a_question_mark_1019", message: "An index signature parameter cannot have a question mark." }, - An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_cannot_have_an_initializer_1020", message: "An index signature parameter cannot have an initializer." }, - An_index_signature_must_have_a_type_annotation: { code: 1021, category: ts.DiagnosticCategory.Error, key: "An_index_signature_must_have_a_type_annotation_1021", message: "An index signature must have a type annotation." }, - An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_must_have_a_type_annotation_1022", message: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: ts.DiagnosticCategory.Error, key: "An_index_signature_parameter_type_must_be_string_or_number_1023", message: "An index signature parameter type must be 'string' or 'number'." }, - readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: { code: 1024, category: ts.DiagnosticCategory.Error, key: "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024", message: "'readonly' modifier can only appear on a property declaration or index signature." }, - Accessibility_modifier_already_seen: { code: 1028, category: ts.DiagnosticCategory.Error, key: "Accessibility_modifier_already_seen_1028", message: "Accessibility modifier already seen." }, - _0_modifier_must_precede_1_modifier: { code: 1029, category: ts.DiagnosticCategory.Error, key: "_0_modifier_must_precede_1_modifier_1029", message: "'{0}' modifier must precede '{1}' modifier." }, - _0_modifier_already_seen: { code: 1030, category: ts.DiagnosticCategory.Error, key: "_0_modifier_already_seen_1030", message: "'{0}' modifier already seen." }, - _0_modifier_cannot_appear_on_a_class_element: { code: 1031, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_class_element_1031", message: "'{0}' modifier cannot appear on a class element." }, - super_must_be_followed_by_an_argument_list_or_member_access: { code: 1034, category: ts.DiagnosticCategory.Error, key: "super_must_be_followed_by_an_argument_list_or_member_access_1034", message: "'super' must be followed by an argument list or member access." }, - Only_ambient_modules_can_use_quoted_names: { code: 1035, category: ts.DiagnosticCategory.Error, key: "Only_ambient_modules_can_use_quoted_names_1035", message: "Only ambient modules can use quoted names." }, - Statements_are_not_allowed_in_ambient_contexts: { code: 1036, category: ts.DiagnosticCategory.Error, key: "Statements_are_not_allowed_in_ambient_contexts_1036", message: "Statements are not allowed in ambient contexts." }, - A_declare_modifier_cannot_be_used_in_an_already_ambient_context: { code: 1038, category: ts.DiagnosticCategory.Error, key: "A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038", message: "A 'declare' modifier cannot be used in an already ambient context." }, - Initializers_are_not_allowed_in_ambient_contexts: { code: 1039, category: ts.DiagnosticCategory.Error, key: "Initializers_are_not_allowed_in_ambient_contexts_1039", message: "Initializers are not allowed in ambient contexts." }, - _0_modifier_cannot_be_used_in_an_ambient_context: { code: 1040, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_in_an_ambient_context_1040", message: "'{0}' modifier cannot be used in an ambient context." }, - _0_modifier_cannot_be_used_with_a_class_declaration: { code: 1041, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_a_class_declaration_1041", message: "'{0}' modifier cannot be used with a class declaration." }, - _0_modifier_cannot_be_used_here: { code: 1042, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_here_1042", message: "'{0}' modifier cannot be used here." }, - _0_modifier_cannot_appear_on_a_data_property: { code: 1043, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_data_property_1043", message: "'{0}' modifier cannot appear on a data property." }, - _0_modifier_cannot_appear_on_a_module_or_namespace_element: { code: 1044, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", message: "'{0}' modifier cannot appear on a module or namespace element." }, - A_0_modifier_cannot_be_used_with_an_interface_declaration: { code: 1045, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", message: "A '{0}' modifier cannot be used with an interface declaration." }, - A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: { code: 1046, category: ts.DiagnosticCategory.Error, key: "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", message: "A 'declare' modifier is required for a top level declaration in a .d.ts file." }, - A_rest_parameter_cannot_be_optional: { code: 1047, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_cannot_be_optional_1047", message: "A rest parameter cannot be optional." }, - A_rest_parameter_cannot_have_an_initializer: { code: 1048, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_cannot_have_an_initializer_1048", message: "A rest parameter cannot have an initializer." }, - A_set_accessor_must_have_exactly_one_parameter: { code: 1049, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_must_have_exactly_one_parameter_1049", message: "A 'set' accessor must have exactly one parameter." }, - A_set_accessor_cannot_have_an_optional_parameter: { code: 1051, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_cannot_have_an_optional_parameter_1051", message: "A 'set' accessor cannot have an optional parameter." }, - A_set_accessor_parameter_cannot_have_an_initializer: { code: 1052, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_parameter_cannot_have_an_initializer_1052", message: "A 'set' accessor parameter cannot have an initializer." }, - A_set_accessor_cannot_have_rest_parameter: { code: 1053, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_cannot_have_rest_parameter_1053", message: "A 'set' accessor cannot have rest parameter." }, - A_get_accessor_cannot_have_parameters: { code: 1054, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_cannot_have_parameters_1054", message: "A 'get' accessor cannot have parameters." }, - Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: { code: 1055, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", message: "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value." }, - Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: ts.DiagnosticCategory.Error, key: "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", message: "Accessors are only available when targeting ECMAScript 5 and higher." }, - An_async_function_or_method_must_have_a_valid_awaitable_return_type: { code: 1057, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", message: "An async function or method must have a valid awaitable return type." }, - The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1058, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", message: "The return type of an async function must either be a valid promise or must not contain a callable 'then' member." }, - A_promise_must_have_a_then_method: { code: 1059, category: ts.DiagnosticCategory.Error, key: "A_promise_must_have_a_then_method_1059", message: "A promise must have a 'then' method." }, - The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: { code: 1060, category: ts.DiagnosticCategory.Error, key: "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", message: "The first parameter of the 'then' method of a promise must be a callback." }, - Enum_member_must_have_initializer: { code: 1061, category: ts.DiagnosticCategory.Error, key: "Enum_member_must_have_initializer_1061", message: "Enum member must have initializer." }, - Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: { code: 1062, category: ts.DiagnosticCategory.Error, key: "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", message: "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method." }, - An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_namespace_1063", message: "An export assignment cannot be used in a namespace." }, - The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: { code: 1064, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", message: "The return type of an async function or method must be the global Promise<T> type." }, - In_ambient_enum_declarations_member_initializer_must_be_constant_expression: { code: 1066, category: ts.DiagnosticCategory.Error, key: "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", message: "In ambient enum declarations member initializer must be constant expression." }, - Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: ts.DiagnosticCategory.Error, key: "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", message: "Unexpected token. A constructor, method, accessor, or property was expected." }, - _0_modifier_cannot_appear_on_a_type_member: { code: 1070, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_type_member_1070", message: "'{0}' modifier cannot appear on a type member." }, - _0_modifier_cannot_appear_on_an_index_signature: { code: 1071, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_an_index_signature_1071", message: "'{0}' modifier cannot appear on an index signature." }, - A_0_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: ts.DiagnosticCategory.Error, key: "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", message: "A '{0}' modifier cannot be used with an import declaration." }, - Invalid_reference_directive_syntax: { code: 1084, category: ts.DiagnosticCategory.Error, key: "Invalid_reference_directive_syntax_1084", message: "Invalid 'reference' directive syntax." }, - Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: { code: 1085, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", message: "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." }, - An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_be_declared_in_an_ambient_context_1086", message: "An accessor cannot be declared in an ambient context." }, - _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", message: "'{0}' modifier cannot appear on a constructor declaration." }, - _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_appear_on_a_parameter_1090", message: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: ts.DiagnosticCategory.Error, key: "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", message: "Only a single variable declaration is allowed in a 'for...in' statement." }, - Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: ts.DiagnosticCategory.Error, key: "Type_parameters_cannot_appear_on_a_constructor_declaration_1092", message: "Type parameters cannot appear on a constructor declaration." }, - Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: ts.DiagnosticCategory.Error, key: "Type_annotation_cannot_appear_on_a_constructor_declaration_1093", message: "Type annotation cannot appear on a constructor declaration." }, - An_accessor_cannot_have_type_parameters: { code: 1094, category: ts.DiagnosticCategory.Error, key: "An_accessor_cannot_have_type_parameters_1094", message: "An accessor cannot have type parameters." }, - A_set_accessor_cannot_have_a_return_type_annotation: { code: 1095, category: ts.DiagnosticCategory.Error, key: "A_set_accessor_cannot_have_a_return_type_annotation_1095", message: "A 'set' accessor cannot have a return type annotation." }, - An_index_signature_must_have_exactly_one_parameter: { code: 1096, category: ts.DiagnosticCategory.Error, key: "An_index_signature_must_have_exactly_one_parameter_1096", message: "An index signature must have exactly one parameter." }, - _0_list_cannot_be_empty: { code: 1097, category: ts.DiagnosticCategory.Error, key: "_0_list_cannot_be_empty_1097", message: "'{0}' list cannot be empty." }, - Type_parameter_list_cannot_be_empty: { code: 1098, category: ts.DiagnosticCategory.Error, key: "Type_parameter_list_cannot_be_empty_1098", message: "Type parameter list cannot be empty." }, - Type_argument_list_cannot_be_empty: { code: 1099, category: ts.DiagnosticCategory.Error, key: "Type_argument_list_cannot_be_empty_1099", message: "Type argument list cannot be empty." }, - Invalid_use_of_0_in_strict_mode: { code: 1100, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_in_strict_mode_1100", message: "Invalid use of '{0}' in strict mode." }, - with_statements_are_not_allowed_in_strict_mode: { code: 1101, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_strict_mode_1101", message: "'with' statements are not allowed in strict mode." }, - delete_cannot_be_called_on_an_identifier_in_strict_mode: { code: 1102, category: ts.DiagnosticCategory.Error, key: "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", message: "'delete' cannot be called on an identifier in strict mode." }, - A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator: { code: 1103, category: ts.DiagnosticCategory.Error, key: "A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator_1103", message: "A 'for-await-of' statement is only allowed within an async function or async generator." }, - A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: { code: 1104, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", message: "A 'continue' statement can only be used within an enclosing iteration statement." }, - A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: { code: 1105, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", message: "A 'break' statement can only be used within an enclosing iteration or switch statement." }, - Jump_target_cannot_cross_function_boundary: { code: 1107, category: ts.DiagnosticCategory.Error, key: "Jump_target_cannot_cross_function_boundary_1107", message: "Jump target cannot cross function boundary." }, - A_return_statement_can_only_be_used_within_a_function_body: { code: 1108, category: ts.DiagnosticCategory.Error, key: "A_return_statement_can_only_be_used_within_a_function_body_1108", message: "A 'return' statement can only be used within a function body." }, - Expression_expected: { code: 1109, category: ts.DiagnosticCategory.Error, key: "Expression_expected_1109", message: "Expression expected." }, - Type_expected: { code: 1110, category: ts.DiagnosticCategory.Error, key: "Type_expected_1110", message: "Type expected." }, - A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: { code: 1113, category: ts.DiagnosticCategory.Error, key: "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", message: "A 'default' clause cannot appear more than once in a 'switch' statement." }, - Duplicate_label_0: { code: 1114, category: ts.DiagnosticCategory.Error, key: "Duplicate_label_0_1114", message: "Duplicate label '{0}'." }, - A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: { code: 1115, category: ts.DiagnosticCategory.Error, key: "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", message: "A 'continue' statement can only jump to a label of an enclosing iteration statement." }, - A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: { code: 1116, category: ts.DiagnosticCategory.Error, key: "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", message: "A 'break' statement can only jump to a label of an enclosing statement." }, - An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: { code: 1117, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", message: "An object literal cannot have multiple properties with the same name in strict mode." }, - An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: { code: 1118, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", message: "An object literal cannot have multiple get/set accessors with the same name." }, - An_object_literal_cannot_have_property_and_accessor_with_the_same_name: { code: 1119, category: ts.DiagnosticCategory.Error, key: "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", message: "An object literal cannot have property and accessor with the same name." }, - An_export_assignment_cannot_have_modifiers: { code: 1120, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_have_modifiers_1120", message: "An export assignment cannot have modifiers." }, - Octal_literals_are_not_allowed_in_strict_mode: { code: 1121, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_strict_mode_1121", message: "Octal literals are not allowed in strict mode." }, - A_tuple_type_element_list_cannot_be_empty: { code: 1122, category: ts.DiagnosticCategory.Error, key: "A_tuple_type_element_list_cannot_be_empty_1122", message: "A tuple type element list cannot be empty." }, - Variable_declaration_list_cannot_be_empty: { code: 1123, category: ts.DiagnosticCategory.Error, key: "Variable_declaration_list_cannot_be_empty_1123", message: "Variable declaration list cannot be empty." }, - Digit_expected: { code: 1124, category: ts.DiagnosticCategory.Error, key: "Digit_expected_1124", message: "Digit expected." }, - Hexadecimal_digit_expected: { code: 1125, category: ts.DiagnosticCategory.Error, key: "Hexadecimal_digit_expected_1125", message: "Hexadecimal digit expected." }, - Unexpected_end_of_text: { code: 1126, category: ts.DiagnosticCategory.Error, key: "Unexpected_end_of_text_1126", message: "Unexpected end of text." }, - Invalid_character: { code: 1127, category: ts.DiagnosticCategory.Error, key: "Invalid_character_1127", message: "Invalid character." }, - Declaration_or_statement_expected: { code: 1128, category: ts.DiagnosticCategory.Error, key: "Declaration_or_statement_expected_1128", message: "Declaration or statement expected." }, - Statement_expected: { code: 1129, category: ts.DiagnosticCategory.Error, key: "Statement_expected_1129", message: "Statement expected." }, - case_or_default_expected: { code: 1130, category: ts.DiagnosticCategory.Error, key: "case_or_default_expected_1130", message: "'case' or 'default' expected." }, - Property_or_signature_expected: { code: 1131, category: ts.DiagnosticCategory.Error, key: "Property_or_signature_expected_1131", message: "Property or signature expected." }, - Enum_member_expected: { code: 1132, category: ts.DiagnosticCategory.Error, key: "Enum_member_expected_1132", message: "Enum member expected." }, - Variable_declaration_expected: { code: 1134, category: ts.DiagnosticCategory.Error, key: "Variable_declaration_expected_1134", message: "Variable declaration expected." }, - Argument_expression_expected: { code: 1135, category: ts.DiagnosticCategory.Error, key: "Argument_expression_expected_1135", message: "Argument expression expected." }, - Property_assignment_expected: { code: 1136, category: ts.DiagnosticCategory.Error, key: "Property_assignment_expected_1136", message: "Property assignment expected." }, - Expression_or_comma_expected: { code: 1137, category: ts.DiagnosticCategory.Error, key: "Expression_or_comma_expected_1137", message: "Expression or comma expected." }, - Parameter_declaration_expected: { code: 1138, category: ts.DiagnosticCategory.Error, key: "Parameter_declaration_expected_1138", message: "Parameter declaration expected." }, - Type_parameter_declaration_expected: { code: 1139, category: ts.DiagnosticCategory.Error, key: "Type_parameter_declaration_expected_1139", message: "Type parameter declaration expected." }, - Type_argument_expected: { code: 1140, category: ts.DiagnosticCategory.Error, key: "Type_argument_expected_1140", message: "Type argument expected." }, - String_literal_expected: { code: 1141, category: ts.DiagnosticCategory.Error, key: "String_literal_expected_1141", message: "String literal expected." }, - Line_break_not_permitted_here: { code: 1142, category: ts.DiagnosticCategory.Error, key: "Line_break_not_permitted_here_1142", message: "Line break not permitted here." }, - or_expected: { code: 1144, category: ts.DiagnosticCategory.Error, key: "or_expected_1144", message: "'{' or ';' expected." }, - Declaration_expected: { code: 1146, category: ts.DiagnosticCategory.Error, key: "Declaration_expected_1146", message: "Declaration expected." }, - Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: ts.DiagnosticCategory.Error, key: "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", message: "Import declarations in a namespace cannot reference a module." }, - Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: { code: 1148, category: ts.DiagnosticCategory.Error, key: "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", message: "Cannot use imports, exports, or module augmentations when '--module' is 'none'." }, - File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: ts.DiagnosticCategory.Error, key: "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", message: "File name '{0}' differs from already included file name '{1}' only in casing." }, - new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: ts.DiagnosticCategory.Error, key: "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", message: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." }, - const_declarations_must_be_initialized: { code: 1155, category: ts.DiagnosticCategory.Error, key: "const_declarations_must_be_initialized_1155", message: "'const' declarations must be initialized." }, - const_declarations_can_only_be_declared_inside_a_block: { code: 1156, category: ts.DiagnosticCategory.Error, key: "const_declarations_can_only_be_declared_inside_a_block_1156", message: "'const' declarations can only be declared inside a block." }, - let_declarations_can_only_be_declared_inside_a_block: { code: 1157, category: ts.DiagnosticCategory.Error, key: "let_declarations_can_only_be_declared_inside_a_block_1157", message: "'let' declarations can only be declared inside a block." }, - Unterminated_template_literal: { code: 1160, category: ts.DiagnosticCategory.Error, key: "Unterminated_template_literal_1160", message: "Unterminated template literal." }, - Unterminated_regular_expression_literal: { code: 1161, category: ts.DiagnosticCategory.Error, key: "Unterminated_regular_expression_literal_1161", message: "Unterminated regular expression literal." }, - An_object_member_cannot_be_declared_optional: { code: 1162, category: ts.DiagnosticCategory.Error, key: "An_object_member_cannot_be_declared_optional_1162", message: "An object member cannot be declared optional." }, - A_yield_expression_is_only_allowed_in_a_generator_body: { code: 1163, category: ts.DiagnosticCategory.Error, key: "A_yield_expression_is_only_allowed_in_a_generator_body_1163", message: "A 'yield' expression is only allowed in a generator body." }, - Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: ts.DiagnosticCategory.Error, key: "Computed_property_names_are_not_allowed_in_enums_1164", message: "Computed property names are not allowed in enums." }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol_1165", message: "A computed property name in an ambient context must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol_1166", message: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol_1168", message: "A computed property name in a method overload must directly refer to a built-in symbol." }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol_1169", message: "A computed property name in an interface must directly refer to a built-in symbol." }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol_1170", message: "A computed property name in a type literal must directly refer to a built-in symbol." }, - A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: ts.DiagnosticCategory.Error, key: "A_comma_expression_is_not_allowed_in_a_computed_property_name_1171", message: "A comma expression is not allowed in a computed property name." }, - extends_clause_already_seen: { code: 1172, category: ts.DiagnosticCategory.Error, key: "extends_clause_already_seen_1172", message: "'extends' clause already seen." }, - extends_clause_must_precede_implements_clause: { code: 1173, category: ts.DiagnosticCategory.Error, key: "extends_clause_must_precede_implements_clause_1173", message: "'extends' clause must precede 'implements' clause." }, - Classes_can_only_extend_a_single_class: { code: 1174, category: ts.DiagnosticCategory.Error, key: "Classes_can_only_extend_a_single_class_1174", message: "Classes can only extend a single class." }, - implements_clause_already_seen: { code: 1175, category: ts.DiagnosticCategory.Error, key: "implements_clause_already_seen_1175", message: "'implements' clause already seen." }, - Interface_declaration_cannot_have_implements_clause: { code: 1176, category: ts.DiagnosticCategory.Error, key: "Interface_declaration_cannot_have_implements_clause_1176", message: "Interface declaration cannot have 'implements' clause." }, - Binary_digit_expected: { code: 1177, category: ts.DiagnosticCategory.Error, key: "Binary_digit_expected_1177", message: "Binary digit expected." }, - Octal_digit_expected: { code: 1178, category: ts.DiagnosticCategory.Error, key: "Octal_digit_expected_1178", message: "Octal digit expected." }, - Unexpected_token_expected: { code: 1179, category: ts.DiagnosticCategory.Error, key: "Unexpected_token_expected_1179", message: "Unexpected token. '{' expected." }, - Property_destructuring_pattern_expected: { code: 1180, category: ts.DiagnosticCategory.Error, key: "Property_destructuring_pattern_expected_1180", message: "Property destructuring pattern expected." }, - Array_element_destructuring_pattern_expected: { code: 1181, category: ts.DiagnosticCategory.Error, key: "Array_element_destructuring_pattern_expected_1181", message: "Array element destructuring pattern expected." }, - A_destructuring_declaration_must_have_an_initializer: { code: 1182, category: ts.DiagnosticCategory.Error, key: "A_destructuring_declaration_must_have_an_initializer_1182", message: "A destructuring declaration must have an initializer." }, - An_implementation_cannot_be_declared_in_ambient_contexts: { code: 1183, category: ts.DiagnosticCategory.Error, key: "An_implementation_cannot_be_declared_in_ambient_contexts_1183", message: "An implementation cannot be declared in ambient contexts." }, - Modifiers_cannot_appear_here: { code: 1184, category: ts.DiagnosticCategory.Error, key: "Modifiers_cannot_appear_here_1184", message: "Modifiers cannot appear here." }, - Merge_conflict_marker_encountered: { code: 1185, category: ts.DiagnosticCategory.Error, key: "Merge_conflict_marker_encountered_1185", message: "Merge conflict marker encountered." }, - A_rest_element_cannot_have_an_initializer: { code: 1186, category: ts.DiagnosticCategory.Error, key: "A_rest_element_cannot_have_an_initializer_1186", message: "A rest element cannot have an initializer." }, - A_parameter_property_may_not_be_declared_using_a_binding_pattern: { code: 1187, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187", message: "A parameter property may not be declared using a binding pattern." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: ts.DiagnosticCategory.Error, key: "Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188", message: "Only a single variable declaration is allowed in a 'for...of' statement." }, - The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: ts.DiagnosticCategory.Error, key: "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189", message: "The variable declaration of a 'for...in' statement cannot have an initializer." }, - The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: ts.DiagnosticCategory.Error, key: "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190", message: "The variable declaration of a 'for...of' statement cannot have an initializer." }, - An_import_declaration_cannot_have_modifiers: { code: 1191, category: ts.DiagnosticCategory.Error, key: "An_import_declaration_cannot_have_modifiers_1191", message: "An import declaration cannot have modifiers." }, - Module_0_has_no_default_export: { code: 1192, category: ts.DiagnosticCategory.Error, key: "Module_0_has_no_default_export_1192", message: "Module '{0}' has no default export." }, - An_export_declaration_cannot_have_modifiers: { code: 1193, category: ts.DiagnosticCategory.Error, key: "An_export_declaration_cannot_have_modifiers_1193", message: "An export declaration cannot have modifiers." }, - Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: ts.DiagnosticCategory.Error, key: "Export_declarations_are_not_permitted_in_a_namespace_1194", message: "Export declarations are not permitted in a namespace." }, - Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: ts.DiagnosticCategory.Error, key: "Catch_clause_variable_cannot_have_a_type_annotation_1196", message: "Catch clause variable cannot have a type annotation." }, - Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: ts.DiagnosticCategory.Error, key: "Catch_clause_variable_cannot_have_an_initializer_1197", message: "Catch clause variable cannot have an initializer." }, - An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: { code: 1198, category: ts.DiagnosticCategory.Error, key: "An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198", message: "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive." }, - Unterminated_Unicode_escape_sequence: { code: 1199, category: ts.DiagnosticCategory.Error, key: "Unterminated_Unicode_escape_sequence_1199", message: "Unterminated Unicode escape sequence." }, - Line_terminator_not_permitted_before_arrow: { code: 1200, category: ts.DiagnosticCategory.Error, key: "Line_terminator_not_permitted_before_arrow_1200", message: "Line terminator not permitted before arrow." }, - Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: { code: 1202, category: ts.DiagnosticCategory.Error, key: "Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asteri_1202", message: "Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead." }, - Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead: { code: 1203, category: ts.DiagnosticCategory.Error, key: "Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_defaul_1203", message: "Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead." }, - Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided: { code: 1205, category: ts.DiagnosticCategory.Error, key: "Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided_1205", message: "Cannot re-export a type when the '--isolatedModules' flag is provided." }, - Decorators_are_not_valid_here: { code: 1206, category: ts.DiagnosticCategory.Error, key: "Decorators_are_not_valid_here_1206", message: "Decorators are not valid here." }, - Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: ts.DiagnosticCategory.Error, key: "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", message: "Decorators cannot be applied to multiple get/set accessors of the same name." }, - Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: { code: 1208, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", message: "Cannot compile namespaces when the '--isolatedModules' flag is provided." }, - Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: { code: 1209, category: ts.DiagnosticCategory.Error, key: "Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209", message: "Ambient const enums are not allowed when the '--isolatedModules' flag is provided." }, - Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", message: "Invalid use of '{0}'. Class definitions are automatically in strict mode." }, - A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: ts.DiagnosticCategory.Error, key: "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", message: "A class declaration without the 'default' modifier must have a name." }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", message: "Identifier expected. '{0}' is a reserved word in strict mode." }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", message: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." }, - Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: { code: 1214, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", message: "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode." }, - Invalid_use_of_0_Modules_are_automatically_in_strict_mode: { code: 1215, category: ts.DiagnosticCategory.Error, key: "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", message: "Invalid use of '{0}'. Modules are automatically in strict mode." }, - Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: { code: 1216, category: ts.DiagnosticCategory.Error, key: "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", message: "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules." }, - Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: ts.DiagnosticCategory.Error, key: "Export_assignment_is_not_supported_when_module_flag_is_system_1218", message: "Export assignment is not supported when '--module' flag is 'system'." }, - Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: { code: 1219, category: ts.DiagnosticCategory.Error, key: "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", message: "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." }, - Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: { code: 1220, category: ts.DiagnosticCategory.Error, key: "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", message: "Generators are only available when targeting ECMAScript 2015 or higher." }, - Generators_are_not_allowed_in_an_ambient_context: { code: 1221, category: ts.DiagnosticCategory.Error, key: "Generators_are_not_allowed_in_an_ambient_context_1221", message: "Generators are not allowed in an ambient context." }, - An_overload_signature_cannot_be_declared_as_a_generator: { code: 1222, category: ts.DiagnosticCategory.Error, key: "An_overload_signature_cannot_be_declared_as_a_generator_1222", message: "An overload signature cannot be declared as a generator." }, - _0_tag_already_specified: { code: 1223, category: ts.DiagnosticCategory.Error, key: "_0_tag_already_specified_1223", message: "'{0}' tag already specified." }, - Signature_0_must_have_a_type_predicate: { code: 1224, category: ts.DiagnosticCategory.Error, key: "Signature_0_must_have_a_type_predicate_1224", message: "Signature '{0}' must have a type predicate." }, - Cannot_find_parameter_0: { code: 1225, category: ts.DiagnosticCategory.Error, key: "Cannot_find_parameter_0_1225", message: "Cannot find parameter '{0}'." }, - Type_predicate_0_is_not_assignable_to_1: { code: 1226, category: ts.DiagnosticCategory.Error, key: "Type_predicate_0_is_not_assignable_to_1_1226", message: "Type predicate '{0}' is not assignable to '{1}'." }, - Parameter_0_is_not_in_the_same_position_as_parameter_1: { code: 1227, category: ts.DiagnosticCategory.Error, key: "Parameter_0_is_not_in_the_same_position_as_parameter_1_1227", message: "Parameter '{0}' is not in the same position as parameter '{1}'." }, - A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: { code: 1228, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228", message: "A type predicate is only allowed in return type position for functions and methods." }, - A_type_predicate_cannot_reference_a_rest_parameter: { code: 1229, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_cannot_reference_a_rest_parameter_1229", message: "A type predicate cannot reference a rest parameter." }, - A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: { code: 1230, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230", message: "A type predicate cannot reference element '{0}' in a binding pattern." }, - An_export_assignment_can_only_be_used_in_a_module: { code: 1231, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_can_only_be_used_in_a_module_1231", message: "An export assignment can only be used in a module." }, - An_import_declaration_can_only_be_used_in_a_namespace_or_module: { code: 1232, category: ts.DiagnosticCategory.Error, key: "An_import_declaration_can_only_be_used_in_a_namespace_or_module_1232", message: "An import declaration can only be used in a namespace or module." }, - An_export_declaration_can_only_be_used_in_a_module: { code: 1233, category: ts.DiagnosticCategory.Error, key: "An_export_declaration_can_only_be_used_in_a_module_1233", message: "An export declaration can only be used in a module." }, - An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: { code: 1234, category: ts.DiagnosticCategory.Error, key: "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234", message: "An ambient module declaration is only allowed at the top level in a file." }, - A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: { code: 1235, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235", message: "A namespace declaration is only allowed in a namespace or module." }, - The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: { code: 1236, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236", message: "The return type of a property decorator function must be either 'void' or 'any'." }, - The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: { code: 1237, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237", message: "The return type of a parameter decorator function must be either 'void' or 'any'." }, - Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: { code: 1238, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238", message: "Unable to resolve signature of class decorator when called as an expression." }, - Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: { code: 1239, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239", message: "Unable to resolve signature of parameter decorator when called as an expression." }, - Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: { code: 1240, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240", message: "Unable to resolve signature of property decorator when called as an expression." }, - Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: { code: 1241, category: ts.DiagnosticCategory.Error, key: "Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241", message: "Unable to resolve signature of method decorator when called as an expression." }, - abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: { code: 1242, category: ts.DiagnosticCategory.Error, key: "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242", message: "'abstract' modifier can only appear on a class, method, or property declaration." }, - _0_modifier_cannot_be_used_with_1_modifier: { code: 1243, category: ts.DiagnosticCategory.Error, key: "_0_modifier_cannot_be_used_with_1_modifier_1243", message: "'{0}' modifier cannot be used with '{1}' modifier." }, - Abstract_methods_can_only_appear_within_an_abstract_class: { code: 1244, category: ts.DiagnosticCategory.Error, key: "Abstract_methods_can_only_appear_within_an_abstract_class_1244", message: "Abstract methods can only appear within an abstract class." }, - Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: { code: 1245, category: ts.DiagnosticCategory.Error, key: "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245", message: "Method '{0}' cannot have an implementation because it is marked abstract." }, - An_interface_property_cannot_have_an_initializer: { code: 1246, category: ts.DiagnosticCategory.Error, key: "An_interface_property_cannot_have_an_initializer_1246", message: "An interface property cannot have an initializer." }, - A_type_literal_property_cannot_have_an_initializer: { code: 1247, category: ts.DiagnosticCategory.Error, key: "A_type_literal_property_cannot_have_an_initializer_1247", message: "A type literal property cannot have an initializer." }, - A_class_member_cannot_have_the_0_keyword: { code: 1248, category: ts.DiagnosticCategory.Error, key: "A_class_member_cannot_have_the_0_keyword_1248", message: "A class member cannot have the '{0}' keyword." }, - A_decorator_can_only_decorate_a_method_implementation_not_an_overload: { code: 1249, category: ts.DiagnosticCategory.Error, key: "A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249", message: "A decorator can only decorate a method implementation, not an overload." }, - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: { code: 1250, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'." }, - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: { code: 1251, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode." }, - Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: { code: 1252, category: ts.DiagnosticCategory.Error, key: "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", message: "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode." }, - _0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag: { code: 1253, category: ts.DiagnosticCategory.Error, key: "_0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag_1253", message: "'{0}' tag cannot be used independently as a top level JSDoc tag." }, - A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal: { code: 1254, category: ts.DiagnosticCategory.Error, key: "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_1254", message: "A 'const' initializer in an ambient context must be a string or numeric literal." }, - with_statements_are_not_allowed_in_an_async_function_block: { code: 1300, category: ts.DiagnosticCategory.Error, key: "with_statements_are_not_allowed_in_an_async_function_block_1300", message: "'with' statements are not allowed in an async function block." }, - await_expression_is_only_allowed_within_an_async_function: { code: 1308, category: ts.DiagnosticCategory.Error, key: "await_expression_is_only_allowed_within_an_async_function_1308", message: "'await' expression is only allowed within an async function." }, - can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: { code: 1312, category: ts.DiagnosticCategory.Error, key: "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", message: "'=' can only be used in an object literal property inside a destructuring assignment." }, - The_body_of_an_if_statement_cannot_be_the_empty_statement: { code: 1313, category: ts.DiagnosticCategory.Error, key: "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", message: "The body of an 'if' statement cannot be the empty statement." }, - Global_module_exports_may_only_appear_in_module_files: { code: 1314, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_module_files_1314", message: "Global module exports may only appear in module files." }, - Global_module_exports_may_only_appear_in_declaration_files: { code: 1315, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_in_declaration_files_1315", message: "Global module exports may only appear in declaration files." }, - Global_module_exports_may_only_appear_at_top_level: { code: 1316, category: ts.DiagnosticCategory.Error, key: "Global_module_exports_may_only_appear_at_top_level_1316", message: "Global module exports may only appear at top level." }, - A_parameter_property_cannot_be_declared_using_a_rest_parameter: { code: 1317, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", message: "A parameter property cannot be declared using a rest parameter." }, - An_abstract_accessor_cannot_have_an_implementation: { code: 1318, category: ts.DiagnosticCategory.Error, key: "An_abstract_accessor_cannot_have_an_implementation_1318", message: "An abstract accessor cannot have an implementation." }, - A_default_export_can_only_be_used_in_an_ECMAScript_style_module: { code: 1319, category: ts.DiagnosticCategory.Error, key: "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", message: "A default export can only be used in an ECMAScript-style module." }, - Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1320, category: ts.DiagnosticCategory.Error, key: "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", message: "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member." }, - Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1321, category: ts.DiagnosticCategory.Error, key: "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", message: "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member." }, - Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: { code: 1322, category: ts.DiagnosticCategory.Error, key: "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", message: "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member." }, - Dynamic_import_cannot_be_used_when_targeting_ECMAScript_2015_modules: { code: 1323, category: ts.DiagnosticCategory.Error, key: "Dynamic_import_cannot_be_used_when_targeting_ECMAScript_2015_modules_1323", message: "Dynamic import cannot be used when targeting ECMAScript 2015 modules." }, - Dynamic_import_must_have_one_specifier_as_an_argument: { code: 1324, category: ts.DiagnosticCategory.Error, key: "Dynamic_import_must_have_one_specifier_as_an_argument_1324", message: "Dynamic import must have one specifier as an argument." }, - Specifier_of_dynamic_import_cannot_be_spread_element: { code: 1325, category: ts.DiagnosticCategory.Error, key: "Specifier_of_dynamic_import_cannot_be_spread_element_1325", message: "Specifier of dynamic import cannot be spread element." }, - Dynamic_import_cannot_have_type_arguments: { code: 1326, category: ts.DiagnosticCategory.Error, key: "Dynamic_import_cannot_have_type_arguments_1326", message: "Dynamic import cannot have type arguments" }, - Duplicate_identifier_0: { code: 2300, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_2300", message: "Duplicate identifier '{0}'." }, - Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: ts.DiagnosticCategory.Error, key: "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", message: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, - Static_members_cannot_reference_class_type_parameters: { code: 2302, category: ts.DiagnosticCategory.Error, key: "Static_members_cannot_reference_class_type_parameters_2302", message: "Static members cannot reference class type parameters." }, - Circular_definition_of_import_alias_0: { code: 2303, category: ts.DiagnosticCategory.Error, key: "Circular_definition_of_import_alias_0_2303", message: "Circular definition of import alias '{0}'." }, - Cannot_find_name_0: { code: 2304, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_2304", message: "Cannot find name '{0}'." }, - Module_0_has_no_exported_member_1: { code: 2305, category: ts.DiagnosticCategory.Error, key: "Module_0_has_no_exported_member_1_2305", message: "Module '{0}' has no exported member '{1}'." }, - File_0_is_not_a_module: { code: 2306, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_a_module_2306", message: "File '{0}' is not a module." }, - Cannot_find_module_0: { code: 2307, category: ts.DiagnosticCategory.Error, key: "Cannot_find_module_0_2307", message: "Cannot find module '{0}'." }, - Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: { code: 2308, category: ts.DiagnosticCategory.Error, key: "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", message: "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity." }, - An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: ts.DiagnosticCategory.Error, key: "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", message: "An export assignment cannot be used in a module with other exported elements." }, - Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: ts.DiagnosticCategory.Error, key: "Type_0_recursively_references_itself_as_a_base_type_2310", message: "Type '{0}' recursively references itself as a base type." }, - A_class_may_only_extend_another_class: { code: 2311, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_extend_another_class_2311", message: "A class may only extend another class." }, - An_interface_may_only_extend_a_class_or_another_interface: { code: 2312, category: ts.DiagnosticCategory.Error, key: "An_interface_may_only_extend_a_class_or_another_interface_2312", message: "An interface may only extend a class or another interface." }, - Type_parameter_0_has_a_circular_constraint: { code: 2313, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_has_a_circular_constraint_2313", message: "Type parameter '{0}' has a circular constraint." }, - Generic_type_0_requires_1_type_argument_s: { code: 2314, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_1_type_argument_s_2314", message: "Generic type '{0}' requires {1} type argument(s)." }, - Type_0_is_not_generic: { code: 2315, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_generic_2315", message: "Type '{0}' is not generic." }, - Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: ts.DiagnosticCategory.Error, key: "Global_type_0_must_be_a_class_or_interface_type_2316", message: "Global type '{0}' must be a class or interface type." }, - Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: ts.DiagnosticCategory.Error, key: "Global_type_0_must_have_1_type_parameter_s_2317", message: "Global type '{0}' must have {1} type parameter(s)." }, - Cannot_find_global_type_0: { code: 2318, category: ts.DiagnosticCategory.Error, key: "Cannot_find_global_type_0_2318", message: "Cannot find global type '{0}'." }, - Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: ts.DiagnosticCategory.Error, key: "Named_property_0_of_types_1_and_2_are_not_identical_2319", message: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, - Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: ts.DiagnosticCategory.Error, key: "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320", message: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, - Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: ts.DiagnosticCategory.Error, key: "Excessive_stack_depth_comparing_types_0_and_1_2321", message: "Excessive stack depth comparing types '{0}' and '{1}'." }, - Type_0_is_not_assignable_to_type_1: { code: 2322, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_2322", message: "Type '{0}' is not assignable to type '{1}'." }, - Cannot_redeclare_exported_variable_0: { code: 2323, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_exported_variable_0_2323", message: "Cannot redeclare exported variable '{0}'." }, - Property_0_is_missing_in_type_1: { code: 2324, category: ts.DiagnosticCategory.Error, key: "Property_0_is_missing_in_type_1_2324", message: "Property '{0}' is missing in type '{1}'." }, - Property_0_is_private_in_type_1_but_not_in_type_2: { code: 2325, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_in_type_1_but_not_in_type_2_2325", message: "Property '{0}' is private in type '{1}' but not in type '{2}'." }, - Types_of_property_0_are_incompatible: { code: 2326, category: ts.DiagnosticCategory.Error, key: "Types_of_property_0_are_incompatible_2326", message: "Types of property '{0}' are incompatible." }, - Property_0_is_optional_in_type_1_but_required_in_type_2: { code: 2327, category: ts.DiagnosticCategory.Error, key: "Property_0_is_optional_in_type_1_but_required_in_type_2_2327", message: "Property '{0}' is optional in type '{1}' but required in type '{2}'." }, - Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: ts.DiagnosticCategory.Error, key: "Types_of_parameters_0_and_1_are_incompatible_2328", message: "Types of parameters '{0}' and '{1}' are incompatible." }, - Index_signature_is_missing_in_type_0: { code: 2329, category: ts.DiagnosticCategory.Error, key: "Index_signature_is_missing_in_type_0_2329", message: "Index signature is missing in type '{0}'." }, - Index_signatures_are_incompatible: { code: 2330, category: ts.DiagnosticCategory.Error, key: "Index_signatures_are_incompatible_2330", message: "Index signatures are incompatible." }, - this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_module_or_namespace_body_2331", message: "'this' cannot be referenced in a module or namespace body." }, - this_cannot_be_referenced_in_current_location: { code: 2332, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_current_location_2332", message: "'this' cannot be referenced in current location." }, - this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_constructor_arguments_2333", message: "'this' cannot be referenced in constructor arguments." }, - this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_static_property_initializer_2334", message: "'this' cannot be referenced in a static property initializer." }, - super_can_only_be_referenced_in_a_derived_class: { code: 2335, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_a_derived_class_2335", message: "'super' can only be referenced in a derived class." }, - super_cannot_be_referenced_in_constructor_arguments: { code: 2336, category: ts.DiagnosticCategory.Error, key: "super_cannot_be_referenced_in_constructor_arguments_2336", message: "'super' cannot be referenced in constructor arguments." }, - Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: { code: 2337, category: ts.DiagnosticCategory.Error, key: "Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337", message: "Super calls are not permitted outside constructors or in nested functions inside constructors." }, - super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: { code: 2338, category: ts.DiagnosticCategory.Error, key: "super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338", message: "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class." }, - Property_0_does_not_exist_on_type_1: { code: 2339, category: ts.DiagnosticCategory.Error, key: "Property_0_does_not_exist_on_type_1_2339", message: "Property '{0}' does not exist on type '{1}'." }, - Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: ts.DiagnosticCategory.Error, key: "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", message: "Only public and protected methods of the base class are accessible via the 'super' keyword." }, - Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: ts.DiagnosticCategory.Error, key: "Property_0_is_private_and_only_accessible_within_class_1_2341", message: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: ts.DiagnosticCategory.Error, key: "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", message: "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'." }, - This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: { code: 2343, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", message: "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'." }, - Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: ts.DiagnosticCategory.Error, key: "Type_0_does_not_satisfy_the_constraint_1_2344", message: "Type '{0}' does not satisfy the constraint '{1}'." }, - Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: ts.DiagnosticCategory.Error, key: "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", message: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, - Call_target_does_not_contain_any_signatures: { code: 2346, category: ts.DiagnosticCategory.Error, key: "Call_target_does_not_contain_any_signatures_2346", message: "Call target does not contain any signatures." }, - Untyped_function_calls_may_not_accept_type_arguments: { code: 2347, category: ts.DiagnosticCategory.Error, key: "Untyped_function_calls_may_not_accept_type_arguments_2347", message: "Untyped function calls may not accept type arguments." }, - Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: { code: 2348, category: ts.DiagnosticCategory.Error, key: "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", message: "Value of type '{0}' is not callable. Did you mean to include 'new'?" }, - Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures: { code: 2349, category: ts.DiagnosticCategory.Error, key: "Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatur_2349", message: "Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures." }, - Only_a_void_function_can_be_called_with_the_new_keyword: { code: 2350, category: ts.DiagnosticCategory.Error, key: "Only_a_void_function_can_be_called_with_the_new_keyword_2350", message: "Only a void function can be called with the 'new' keyword." }, - Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: { code: 2351, category: ts.DiagnosticCategory.Error, key: "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", message: "Cannot use 'new' with an expression whose type lacks a call or construct signature." }, - Type_0_cannot_be_converted_to_type_1: { code: 2352, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_converted_to_type_1_2352", message: "Type '{0}' cannot be converted to type '{1}'." }, - Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: { code: 2353, category: ts.DiagnosticCategory.Error, key: "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", message: "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'." }, - This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: { code: 2354, category: ts.DiagnosticCategory.Error, key: "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", message: "This syntax requires an imported helper but module '{0}' cannot be found." }, - A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: { code: 2355, category: ts.DiagnosticCategory.Error, key: "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", message: "A function whose declared type is neither 'void' nor 'any' must return a value." }, - An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: { code: 2356, category: ts.DiagnosticCategory.Error, key: "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", message: "An arithmetic operand must be of type 'any', 'number' or an enum type." }, - The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: { code: 2357, category: ts.DiagnosticCategory.Error, key: "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", message: "The operand of an increment or decrement operator must be a variable or a property access." }, - The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", message: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, - The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", message: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", message: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, - The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", message: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter." }, - The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", message: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", message: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, - The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: { code: 2364, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", message: "The left-hand side of an assignment expression must be a variable or a property access." }, - Operator_0_cannot_be_applied_to_types_1_and_2: { code: 2365, category: ts.DiagnosticCategory.Error, key: "Operator_0_cannot_be_applied_to_types_1_and_2_2365", message: "Operator '{0}' cannot be applied to types '{1}' and '{2}'." }, - Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: { code: 2366, category: ts.DiagnosticCategory.Error, key: "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", message: "Function lacks ending return statement and return type does not include 'undefined'." }, - Type_parameter_name_cannot_be_0: { code: 2368, category: ts.DiagnosticCategory.Error, key: "Type_parameter_name_cannot_be_0_2368", message: "Type parameter name cannot be '{0}'." }, - A_parameter_property_is_only_allowed_in_a_constructor_implementation: { code: 2369, category: ts.DiagnosticCategory.Error, key: "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", message: "A parameter property is only allowed in a constructor implementation." }, - A_rest_parameter_must_be_of_an_array_type: { code: 2370, category: ts.DiagnosticCategory.Error, key: "A_rest_parameter_must_be_of_an_array_type_2370", message: "A rest parameter must be of an array type." }, - A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: { code: 2371, category: ts.DiagnosticCategory.Error, key: "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", message: "A parameter initializer is only allowed in a function or constructor implementation." }, - Parameter_0_cannot_be_referenced_in_its_initializer: { code: 2372, category: ts.DiagnosticCategory.Error, key: "Parameter_0_cannot_be_referenced_in_its_initializer_2372", message: "Parameter '{0}' cannot be referenced in its initializer." }, - Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: { code: 2373, category: ts.DiagnosticCategory.Error, key: "Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373", message: "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it." }, - Duplicate_string_index_signature: { code: 2374, category: ts.DiagnosticCategory.Error, key: "Duplicate_string_index_signature_2374", message: "Duplicate string index signature." }, - Duplicate_number_index_signature: { code: 2375, category: ts.DiagnosticCategory.Error, key: "Duplicate_number_index_signature_2375", message: "Duplicate number index signature." }, - A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: { code: 2376, category: ts.DiagnosticCategory.Error, key: "A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376", message: "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties." }, - Constructors_for_derived_classes_must_contain_a_super_call: { code: 2377, category: ts.DiagnosticCategory.Error, key: "Constructors_for_derived_classes_must_contain_a_super_call_2377", message: "Constructors for derived classes must contain a 'super' call." }, - A_get_accessor_must_return_a_value: { code: 2378, category: ts.DiagnosticCategory.Error, key: "A_get_accessor_must_return_a_value_2378", message: "A 'get' accessor must return a value." }, - Getter_and_setter_accessors_do_not_agree_in_visibility: { code: 2379, category: ts.DiagnosticCategory.Error, key: "Getter_and_setter_accessors_do_not_agree_in_visibility_2379", message: "Getter and setter accessors do not agree in visibility." }, - get_and_set_accessor_must_have_the_same_type: { code: 2380, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_type_2380", message: "'get' and 'set' accessor must have the same type." }, - A_signature_with_an_implementation_cannot_use_a_string_literal_type: { code: 2381, category: ts.DiagnosticCategory.Error, key: "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", message: "A signature with an implementation cannot use a string literal type." }, - Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: { code: 2382, category: ts.DiagnosticCategory.Error, key: "Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382", message: "Specialized overload signature is not assignable to any non-specialized signature." }, - Overload_signatures_must_all_be_exported_or_non_exported: { code: 2383, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_exported_or_non_exported_2383", message: "Overload signatures must all be exported or non-exported." }, - Overload_signatures_must_all_be_ambient_or_non_ambient: { code: 2384, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", message: "Overload signatures must all be ambient or non-ambient." }, - Overload_signatures_must_all_be_public_private_or_protected: { code: 2385, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_public_private_or_protected_2385", message: "Overload signatures must all be public, private or protected." }, - Overload_signatures_must_all_be_optional_or_required: { code: 2386, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_optional_or_required_2386", message: "Overload signatures must all be optional or required." }, - Function_overload_must_be_static: { code: 2387, category: ts.DiagnosticCategory.Error, key: "Function_overload_must_be_static_2387", message: "Function overload must be static." }, - Function_overload_must_not_be_static: { code: 2388, category: ts.DiagnosticCategory.Error, key: "Function_overload_must_not_be_static_2388", message: "Function overload must not be static." }, - Function_implementation_name_must_be_0: { code: 2389, category: ts.DiagnosticCategory.Error, key: "Function_implementation_name_must_be_0_2389", message: "Function implementation name must be '{0}'." }, - Constructor_implementation_is_missing: { code: 2390, category: ts.DiagnosticCategory.Error, key: "Constructor_implementation_is_missing_2390", message: "Constructor implementation is missing." }, - Function_implementation_is_missing_or_not_immediately_following_the_declaration: { code: 2391, category: ts.DiagnosticCategory.Error, key: "Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391", message: "Function implementation is missing or not immediately following the declaration." }, - Multiple_constructor_implementations_are_not_allowed: { code: 2392, category: ts.DiagnosticCategory.Error, key: "Multiple_constructor_implementations_are_not_allowed_2392", message: "Multiple constructor implementations are not allowed." }, - Duplicate_function_implementation: { code: 2393, category: ts.DiagnosticCategory.Error, key: "Duplicate_function_implementation_2393", message: "Duplicate function implementation." }, - Overload_signature_is_not_compatible_with_function_implementation: { code: 2394, category: ts.DiagnosticCategory.Error, key: "Overload_signature_is_not_compatible_with_function_implementation_2394", message: "Overload signature is not compatible with function implementation." }, - Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: { code: 2395, category: ts.DiagnosticCategory.Error, key: "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395", message: "Individual declarations in merged declaration '{0}' must be all exported or all local." }, - Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: { code: 2396, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396", message: "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters." }, - Declaration_name_conflicts_with_built_in_global_identifier_0: { code: 2397, category: ts.DiagnosticCategory.Error, key: "Declaration_name_conflicts_with_built_in_global_identifier_0_2397", message: "Declaration name conflicts with built-in global identifier '{0}'." }, - Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: { code: 2399, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", message: "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference." }, - Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: { code: 2400, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", message: "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference." }, - Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: { code: 2401, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401", message: "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference." }, - Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: { code: 2402, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402", message: "Expression resolves to '_super' that compiler uses to capture base class reference." }, - Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: { code: 2403, category: ts.DiagnosticCategory.Error, key: "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", message: "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'." }, - The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: { code: 2404, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", message: "The left-hand side of a 'for...in' statement cannot use a type annotation." }, - The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: { code: 2405, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", message: "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'." }, - The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: { code: 2406, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", message: "The left-hand side of a 'for...in' statement must be a variable or a property access." }, - The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2407, category: ts.DiagnosticCategory.Error, key: "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", message: "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter." }, - Setters_cannot_return_a_value: { code: 2408, category: ts.DiagnosticCategory.Error, key: "Setters_cannot_return_a_value_2408", message: "Setters cannot return a value." }, - Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: { code: 2409, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", message: "Return type of constructor signature must be assignable to the instance type of the class." }, - The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: { code: 2410, category: ts.DiagnosticCategory.Error, key: "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", message: "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'." }, - Property_0_of_type_1_is_not_assignable_to_string_index_type_2: { code: 2411, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411", message: "Property '{0}' of type '{1}' is not assignable to string index type '{2}'." }, - Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: { code: 2412, category: ts.DiagnosticCategory.Error, key: "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412", message: "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'." }, - Numeric_index_type_0_is_not_assignable_to_string_index_type_1: { code: 2413, category: ts.DiagnosticCategory.Error, key: "Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413", message: "Numeric index type '{0}' is not assignable to string index type '{1}'." }, - Class_name_cannot_be_0: { code: 2414, category: ts.DiagnosticCategory.Error, key: "Class_name_cannot_be_0_2414", message: "Class name cannot be '{0}'." }, - Class_0_incorrectly_extends_base_class_1: { code: 2415, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_extends_base_class_1_2415", message: "Class '{0}' incorrectly extends base class '{1}'." }, - Class_static_side_0_incorrectly_extends_base_class_static_side_1: { code: 2417, category: ts.DiagnosticCategory.Error, key: "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", message: "Class static side '{0}' incorrectly extends base class static side '{1}'." }, - Class_0_incorrectly_implements_interface_1: { code: 2420, category: ts.DiagnosticCategory.Error, key: "Class_0_incorrectly_implements_interface_1_2420", message: "Class '{0}' incorrectly implements interface '{1}'." }, - A_class_may_only_implement_another_class_or_interface: { code: 2422, category: ts.DiagnosticCategory.Error, key: "A_class_may_only_implement_another_class_or_interface_2422", message: "A class may only implement another class or interface." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: { code: 2423, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor." }, - Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: { code: 2424, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424", message: "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property." }, - Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2425, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", message: "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function." }, - Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: { code: 2426, category: ts.DiagnosticCategory.Error, key: "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", message: "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function." }, - Interface_name_cannot_be_0: { code: 2427, category: ts.DiagnosticCategory.Error, key: "Interface_name_cannot_be_0_2427", message: "Interface name cannot be '{0}'." }, - All_declarations_of_0_must_have_identical_type_parameters: { code: 2428, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_type_parameters_2428", message: "All declarations of '{0}' must have identical type parameters." }, - Interface_0_incorrectly_extends_interface_1: { code: 2430, category: ts.DiagnosticCategory.Error, key: "Interface_0_incorrectly_extends_interface_1_2430", message: "Interface '{0}' incorrectly extends interface '{1}'." }, - Enum_name_cannot_be_0: { code: 2431, category: ts.DiagnosticCategory.Error, key: "Enum_name_cannot_be_0_2431", message: "Enum name cannot be '{0}'." }, - In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: ts.DiagnosticCategory.Error, key: "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", message: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." }, - A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", message: "A namespace declaration cannot be in a different file from a class or function with which it is merged." }, - A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: ts.DiagnosticCategory.Error, key: "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", message: "A namespace declaration cannot be located prior to a class or function with which it is merged." }, - Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: { code: 2435, category: ts.DiagnosticCategory.Error, key: "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", message: "Ambient modules cannot be nested in other modules or namespaces." }, - Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: ts.DiagnosticCategory.Error, key: "Ambient_module_declaration_cannot_specify_relative_module_name_2436", message: "Ambient module declaration cannot specify relative module name." }, - Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: ts.DiagnosticCategory.Error, key: "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", message: "Module '{0}' is hidden by a local declaration with the same name." }, - Import_name_cannot_be_0: { code: 2438, category: ts.DiagnosticCategory.Error, key: "Import_name_cannot_be_0_2438", message: "Import name cannot be '{0}'." }, - Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: ts.DiagnosticCategory.Error, key: "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", message: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." }, - Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: ts.DiagnosticCategory.Error, key: "Import_declaration_conflicts_with_local_declaration_of_0_2440", message: "Import declaration conflicts with local declaration of '{0}'." }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." }, - Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: ts.DiagnosticCategory.Error, key: "Types_have_separate_declarations_of_a_private_property_0_2442", message: "Types have separate declarations of a private property '{0}'." }, - Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", message: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." }, - Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_in_type_1_but_public_in_type_2_2444", message: "Property '{0}' is protected in type '{1}' but public in type '{2}'." }, - Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: { code: 2445, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445", message: "Property '{0}' is protected and only accessible within class '{1}' and its subclasses." }, - Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: { code: 2446, category: ts.DiagnosticCategory.Error, key: "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", message: "Property '{0}' is protected and only accessible through an instance of class '{1}'." }, - The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: { code: 2447, category: ts.DiagnosticCategory.Error, key: "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", message: "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead." }, - Block_scoped_variable_0_used_before_its_declaration: { code: 2448, category: ts.DiagnosticCategory.Error, key: "Block_scoped_variable_0_used_before_its_declaration_2448", message: "Block-scoped variable '{0}' used before its declaration." }, - Class_0_used_before_its_declaration: { code: 2449, category: ts.DiagnosticCategory.Error, key: "Class_0_used_before_its_declaration_2449", message: "Class '{0}' used before its declaration." }, - Enum_0_used_before_its_declaration: { code: 2450, category: ts.DiagnosticCategory.Error, key: "Enum_0_used_before_its_declaration_2450", message: "Enum '{0}' used before its declaration." }, - Cannot_redeclare_block_scoped_variable_0: { code: 2451, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_block_scoped_variable_0_2451", message: "Cannot redeclare block-scoped variable '{0}'." }, - An_enum_member_cannot_have_a_numeric_name: { code: 2452, category: ts.DiagnosticCategory.Error, key: "An_enum_member_cannot_have_a_numeric_name_2452", message: "An enum member cannot have a numeric name." }, - The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: { code: 2453, category: ts.DiagnosticCategory.Error, key: "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", message: "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly." }, - Variable_0_is_used_before_being_assigned: { code: 2454, category: ts.DiagnosticCategory.Error, key: "Variable_0_is_used_before_being_assigned_2454", message: "Variable '{0}' is used before being assigned." }, - Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: { code: 2455, category: ts.DiagnosticCategory.Error, key: "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", message: "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'." }, - Type_alias_0_circularly_references_itself: { code: 2456, category: ts.DiagnosticCategory.Error, key: "Type_alias_0_circularly_references_itself_2456", message: "Type alias '{0}' circularly references itself." }, - Type_alias_name_cannot_be_0: { code: 2457, category: ts.DiagnosticCategory.Error, key: "Type_alias_name_cannot_be_0_2457", message: "Type alias name cannot be '{0}'." }, - An_AMD_module_cannot_have_multiple_name_assignments: { code: 2458, category: ts.DiagnosticCategory.Error, key: "An_AMD_module_cannot_have_multiple_name_assignments_2458", message: "An AMD module cannot have multiple name assignments." }, - Type_0_has_no_property_1_and_no_string_index_signature: { code: 2459, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_and_no_string_index_signature_2459", message: "Type '{0}' has no property '{1}' and no string index signature." }, - Type_0_has_no_property_1: { code: 2460, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_property_1_2460", message: "Type '{0}' has no property '{1}'." }, - Type_0_is_not_an_array_type: { code: 2461, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_2461", message: "Type '{0}' is not an array type." }, - A_rest_element_must_be_last_in_a_destructuring_pattern: { code: 2462, category: ts.DiagnosticCategory.Error, key: "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", message: "A rest element must be last in a destructuring pattern." }, - A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: ts.DiagnosticCategory.Error, key: "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", message: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", message: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, - this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: ts.DiagnosticCategory.Error, key: "this_cannot_be_referenced_in_a_computed_property_name_2465", message: "'this' cannot be referenced in a computed property name." }, - super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: ts.DiagnosticCategory.Error, key: "super_cannot_be_referenced_in_a_computed_property_name_2466", message: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467", message: "A computed property name cannot reference a type parameter from its containing type." }, - Cannot_find_global_value_0: { code: 2468, category: ts.DiagnosticCategory.Error, key: "Cannot_find_global_value_0_2468", message: "Cannot find global value '{0}'." }, - The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: ts.DiagnosticCategory.Error, key: "The_0_operator_cannot_be_applied_to_type_symbol_2469", message: "The '{0}' operator cannot be applied to type 'symbol'." }, - Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: ts.DiagnosticCategory.Error, key: "Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object_2470", message: "'Symbol' reference does not refer to the global Symbol constructor object." }, - A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: ts.DiagnosticCategory.Error, key: "A_computed_property_name_of_the_form_0_must_be_of_type_symbol_2471", message: "A computed property name of the form '{0}' must be of type 'symbol'." }, - Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: { code: 2472, category: ts.DiagnosticCategory.Error, key: "Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472", message: "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 2473, category: ts.DiagnosticCategory.Error, key: "Enum_declarations_must_all_be_const_or_non_const_2473", message: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2474, category: ts.DiagnosticCategory.Error, key: "In_const_enum_declarations_member_initializer_must_be_constant_expression_2474", message: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2475, category: ts.DiagnosticCategory.Error, key: "const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475", message: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2476, category: ts.DiagnosticCategory.Error, key: "A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476", message: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2477, category: ts.DiagnosticCategory.Error, key: "const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477", message: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2478, category: ts.DiagnosticCategory.Error, key: "const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478", message: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 2479, category: ts.DiagnosticCategory.Error, key: "Property_0_does_not_exist_on_const_enum_1_2479", message: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2480, category: ts.DiagnosticCategory.Error, key: "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", message: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2481, category: ts.DiagnosticCategory.Error, key: "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", message: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", message: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, - Export_declaration_conflicts_with_exported_declaration_of_0: { code: 2484, category: ts.DiagnosticCategory.Error, key: "Export_declaration_conflicts_with_exported_declaration_of_0_2484", message: "Export declaration conflicts with exported declaration of '{0}'." }, - The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: { code: 2487, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", message: "The left-hand side of a 'for...of' statement must be a variable or a property access." }, - Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2488, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", message: "Type must have a '[Symbol.iterator]()' method that returns an iterator." }, - An_iterator_must_have_a_next_method: { code: 2489, category: ts.DiagnosticCategory.Error, key: "An_iterator_must_have_a_next_method_2489", message: "An iterator must have a 'next()' method." }, - The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", message: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, - The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: ts.DiagnosticCategory.Error, key: "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", message: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, - Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: ts.DiagnosticCategory.Error, key: "Cannot_redeclare_identifier_0_in_catch_clause_2492", message: "Cannot redeclare identifier '{0}' in catch clause." }, - Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: { code: 2493, category: ts.DiagnosticCategory.Error, key: "Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493", message: "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'." }, - Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: ts.DiagnosticCategory.Error, key: "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", message: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." }, - Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_2495", message: "Type '{0}' is not an array type or a string type." }, - The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496", message: "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression." }, - Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: ts.DiagnosticCategory.Error, key: "Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497", message: "Module '{0}' resolves to a non-module entity and cannot be imported using this construct." }, - Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: ts.DiagnosticCategory.Error, key: "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498", message: "Module '{0}' uses 'export =' and cannot be used with 'export *'." }, - An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: ts.DiagnosticCategory.Error, key: "An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499", message: "An interface can only extend an identifier/qualified-name with optional type arguments." }, - A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: ts.DiagnosticCategory.Error, key: "A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500", message: "A class can only implement an identifier/qualified-name with optional type arguments." }, - A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: ts.DiagnosticCategory.Error, key: "A_rest_element_cannot_contain_a_binding_pattern_2501", message: "A rest element cannot contain a binding pattern." }, - _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: { code: 2502, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", message: "'{0}' is referenced directly or indirectly in its own type annotation." }, - Cannot_find_namespace_0: { code: 2503, category: ts.DiagnosticCategory.Error, key: "Cannot_find_namespace_0_2503", message: "Cannot find namespace '{0}'." }, - Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: { code: 2504, category: ts.DiagnosticCategory.Error, key: "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", message: "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator." }, - A_generator_cannot_have_a_void_type_annotation: { code: 2505, category: ts.DiagnosticCategory.Error, key: "A_generator_cannot_have_a_void_type_annotation_2505", message: "A generator cannot have a 'void' type annotation." }, - _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: { code: 2506, category: ts.DiagnosticCategory.Error, key: "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", message: "'{0}' is referenced directly or indirectly in its own base expression." }, - Type_0_is_not_a_constructor_function_type: { code: 2507, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_a_constructor_function_type_2507", message: "Type '{0}' is not a constructor function type." }, - No_base_constructor_has_the_specified_number_of_type_arguments: { code: 2508, category: ts.DiagnosticCategory.Error, key: "No_base_constructor_has_the_specified_number_of_type_arguments_2508", message: "No base constructor has the specified number of type arguments." }, - Base_constructor_return_type_0_is_not_a_class_or_interface_type: { code: 2509, category: ts.DiagnosticCategory.Error, key: "Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509", message: "Base constructor return type '{0}' is not a class or interface type." }, - Base_constructors_must_all_have_the_same_return_type: { code: 2510, category: ts.DiagnosticCategory.Error, key: "Base_constructors_must_all_have_the_same_return_type_2510", message: "Base constructors must all have the same return type." }, - Cannot_create_an_instance_of_the_abstract_class_0: { code: 2511, category: ts.DiagnosticCategory.Error, key: "Cannot_create_an_instance_of_the_abstract_class_0_2511", message: "Cannot create an instance of the abstract class '{0}'." }, - Overload_signatures_must_all_be_abstract_or_non_abstract: { code: 2512, category: ts.DiagnosticCategory.Error, key: "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", message: "Overload signatures must all be abstract or non-abstract." }, - Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: { code: 2513, category: ts.DiagnosticCategory.Error, key: "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", message: "Abstract method '{0}' in class '{1}' cannot be accessed via super expression." }, - Classes_containing_abstract_methods_must_be_marked_abstract: { code: 2514, category: ts.DiagnosticCategory.Error, key: "Classes_containing_abstract_methods_must_be_marked_abstract_2514", message: "Classes containing abstract methods must be marked abstract." }, - Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: { code: 2515, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", message: "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'." }, - All_declarations_of_an_abstract_method_must_be_consecutive: { code: 2516, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_an_abstract_method_must_be_consecutive_2516", message: "All declarations of an abstract method must be consecutive." }, - Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: { code: 2517, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", message: "Cannot assign an abstract constructor type to a non-abstract constructor type." }, - A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: { code: 2518, category: ts.DiagnosticCategory.Error, key: "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", message: "A 'this'-based type guard is not compatible with a parameter-based type guard." }, - An_async_iterator_must_have_a_next_method: { code: 2519, category: ts.DiagnosticCategory.Error, key: "An_async_iterator_must_have_a_next_method_2519", message: "An async iterator must have a 'next()' method." }, - Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: { code: 2520, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", message: "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions." }, - Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: { code: 2521, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", message: "Expression resolves to variable declaration '{0}' that compiler uses to support async functions." }, - The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: { code: 2522, category: ts.DiagnosticCategory.Error, key: "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", message: "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method." }, - yield_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2523, category: ts.DiagnosticCategory.Error, key: "yield_expressions_cannot_be_used_in_a_parameter_initializer_2523", message: "'yield' expressions cannot be used in a parameter initializer." }, - await_expressions_cannot_be_used_in_a_parameter_initializer: { code: 2524, category: ts.DiagnosticCategory.Error, key: "await_expressions_cannot_be_used_in_a_parameter_initializer_2524", message: "'await' expressions cannot be used in a parameter initializer." }, - Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: { code: 2525, category: ts.DiagnosticCategory.Error, key: "Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525", message: "Initializer provides no value for this binding element and the binding element has no default value." }, - A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: { code: 2526, category: ts.DiagnosticCategory.Error, key: "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", message: "A 'this' type is available only in a non-static member of a class or interface." }, - The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: { code: 2527, category: ts.DiagnosticCategory.Error, key: "The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary_2527", message: "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary." }, - A_module_cannot_have_multiple_default_exports: { code: 2528, category: ts.DiagnosticCategory.Error, key: "A_module_cannot_have_multiple_default_exports_2528", message: "A module cannot have multiple default exports." }, - Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: { code: 2529, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", message: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions." }, - Property_0_is_incompatible_with_index_signature: { code: 2530, category: ts.DiagnosticCategory.Error, key: "Property_0_is_incompatible_with_index_signature_2530", message: "Property '{0}' is incompatible with index signature." }, - Object_is_possibly_null: { code: 2531, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_2531", message: "Object is possibly 'null'." }, - Object_is_possibly_undefined: { code: 2532, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_undefined_2532", message: "Object is possibly 'undefined'." }, - Object_is_possibly_null_or_undefined: { code: 2533, category: ts.DiagnosticCategory.Error, key: "Object_is_possibly_null_or_undefined_2533", message: "Object is possibly 'null' or 'undefined'." }, - A_function_returning_never_cannot_have_a_reachable_end_point: { code: 2534, category: ts.DiagnosticCategory.Error, key: "A_function_returning_never_cannot_have_a_reachable_end_point_2534", message: "A function returning 'never' cannot have a reachable end point." }, - Enum_type_0_has_members_with_initializers_that_are_not_literals: { code: 2535, category: ts.DiagnosticCategory.Error, key: "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", message: "Enum type '{0}' has members with initializers that are not literals." }, - Type_0_cannot_be_used_to_index_type_1: { code: 2536, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_to_index_type_1_2536", message: "Type '{0}' cannot be used to index type '{1}'." }, - Type_0_has_no_matching_index_signature_for_type_1: { code: 2537, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_matching_index_signature_for_type_1_2537", message: "Type '{0}' has no matching index signature for type '{1}'." }, - Type_0_cannot_be_used_as_an_index_type: { code: 2538, category: ts.DiagnosticCategory.Error, key: "Type_0_cannot_be_used_as_an_index_type_2538", message: "Type '{0}' cannot be used as an index type." }, - Cannot_assign_to_0_because_it_is_not_a_variable: { code: 2539, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_not_a_variable_2539", message: "Cannot assign to '{0}' because it is not a variable." }, - Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: { code: 2540, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", message: "Cannot assign to '{0}' because it is a constant or a read-only property." }, - The_target_of_an_assignment_must_be_a_variable_or_a_property_access: { code: 2541, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", message: "The target of an assignment must be a variable or a property access." }, - Index_signature_in_type_0_only_permits_reading: { code: 2542, category: ts.DiagnosticCategory.Error, key: "Index_signature_in_type_0_only_permits_reading_2542", message: "Index signature in type '{0}' only permits reading." }, - Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: { code: 2543, category: ts.DiagnosticCategory.Error, key: "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", message: "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference." }, - Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: { code: 2544, category: ts.DiagnosticCategory.Error, key: "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", message: "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference." }, - A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: { code: 2545, category: ts.DiagnosticCategory.Error, key: "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", message: "A mixin class must have a constructor with a single rest parameter of type 'any[]'." }, - Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1: { code: 2546, category: ts.DiagnosticCategory.Error, key: "Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1_2546", message: "Property '{0}' has conflicting declarations and is inaccessible in type '{1}'." }, - The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: { code: 2547, category: ts.DiagnosticCategory.Error, key: "The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value__2547", message: "The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property." }, - Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2548, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", message: "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, - Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: { code: 2549, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", message: "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator." }, - Generic_type_instantiation_is_excessively_deep_and_possibly_infinite: { code: 2550, category: ts.DiagnosticCategory.Error, key: "Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550", message: "Generic type instantiation is excessively deep and possibly infinite." }, - Property_0_does_not_exist_on_type_1_Did_you_mean_2: { code: 2551, category: ts.DiagnosticCategory.Error, key: "Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551", message: "Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?" }, - Cannot_find_name_0_Did_you_mean_1: { code: 2552, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_1_2552", message: "Cannot find name '{0}'. Did you mean '{1}'?" }, - Computed_values_are_not_permitted_in_an_enum_with_string_valued_members: { code: 2553, category: ts.DiagnosticCategory.Error, key: "Computed_values_are_not_permitted_in_an_enum_with_string_valued_members_2553", message: "Computed values are not permitted in an enum with string valued members." }, - Expected_0_arguments_but_got_1: { code: 2554, category: ts.DiagnosticCategory.Error, key: "Expected_0_arguments_but_got_1_2554", message: "Expected {0} arguments, but got {1}." }, - Expected_at_least_0_arguments_but_got_1: { code: 2555, category: ts.DiagnosticCategory.Error, key: "Expected_at_least_0_arguments_but_got_1_2555", message: "Expected at least {0} arguments, but got {1}." }, - Expected_0_arguments_but_got_a_minimum_of_1: { code: 2556, category: ts.DiagnosticCategory.Error, key: "Expected_0_arguments_but_got_a_minimum_of_1_2556", message: "Expected {0} arguments, but got a minimum of {1}." }, - Expected_at_least_0_arguments_but_got_a_minimum_of_1: { code: 2557, category: ts.DiagnosticCategory.Error, key: "Expected_at_least_0_arguments_but_got_a_minimum_of_1_2557", message: "Expected at least {0} arguments, but got a minimum of {1}." }, - Expected_0_type_arguments_but_got_1: { code: 2558, category: ts.DiagnosticCategory.Error, key: "Expected_0_type_arguments_but_got_1_2558", message: "Expected {0} type arguments, but got {1}." }, - Type_0_has_no_properties_in_common_with_type_1: { code: 2559, category: ts.DiagnosticCategory.Error, key: "Type_0_has_no_properties_in_common_with_type_1_2559", message: "Type '{0}' has no properties in common with type '{1}'." }, - JSX_element_attributes_type_0_may_not_be_a_union_type: { code: 2600, category: ts.DiagnosticCategory.Error, key: "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", message: "JSX element attributes type '{0}' may not be a union type." }, - The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: ts.DiagnosticCategory.Error, key: "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", message: "The return type of a JSX element constructor must return an object type." }, - JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", message: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." }, - Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: ts.DiagnosticCategory.Error, key: "Property_0_in_type_1_is_not_assignable_to_type_2_2603", message: "Property '{0}' in type '{1}' is not assignable to type '{2}'." }, - JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", message: "JSX element type '{0}' does not have any construct or call signatures." }, - JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: ts.DiagnosticCategory.Error, key: "JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605", message: "JSX element type '{0}' is not a constructor function for JSX elements." }, - Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: { code: 2606, category: ts.DiagnosticCategory.Error, key: "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", message: "Property '{0}' of JSX spread attribute is not assignable to target property." }, - JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: { code: 2607, category: ts.DiagnosticCategory.Error, key: "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", message: "JSX element class does not support attributes because it does not have a '{0}' property." }, - The_global_type_JSX_0_may_not_have_more_than_one_property: { code: 2608, category: ts.DiagnosticCategory.Error, key: "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", message: "The global type 'JSX.{0}' may not have more than one property." }, - JSX_spread_child_must_be_an_array_type: { code: 2609, category: ts.DiagnosticCategory.Error, key: "JSX_spread_child_must_be_an_array_type_2609", message: "JSX spread child must be an array type." }, - Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: { code: 2649, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", message: "Cannot augment module '{0}' with value exports because it resolves to a non-module entity." }, - A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: { code: 2651, category: ts.DiagnosticCategory.Error, key: "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", message: "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums." }, - Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: { code: 2652, category: ts.DiagnosticCategory.Error, key: "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", message: "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead." }, - Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: { code: 2653, category: ts.DiagnosticCategory.Error, key: "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", message: "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'." }, - Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: { code: 2654, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", message: "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition." }, - Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: { code: 2656, category: ts.DiagnosticCategory.Error, key: "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", message: "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition." }, - JSX_expressions_must_have_one_parent_element: { code: 2657, category: ts.DiagnosticCategory.Error, key: "JSX_expressions_must_have_one_parent_element_2657", message: "JSX expressions must have one parent element." }, - Type_0_provides_no_match_for_the_signature_1: { code: 2658, category: ts.DiagnosticCategory.Error, key: "Type_0_provides_no_match_for_the_signature_1_2658", message: "Type '{0}' provides no match for the signature '{1}'." }, - super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: { code: 2659, category: ts.DiagnosticCategory.Error, key: "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", message: "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher." }, - super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: { code: 2660, category: ts.DiagnosticCategory.Error, key: "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", message: "'super' can only be referenced in members of derived classes or object literal expressions." }, - Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: { code: 2661, category: ts.DiagnosticCategory.Error, key: "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", message: "Cannot export '{0}'. Only local declarations can be exported from a module." }, - Cannot_find_name_0_Did_you_mean_the_static_member_1_0: { code: 2662, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", message: "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?" }, - Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: { code: 2663, category: ts.DiagnosticCategory.Error, key: "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", message: "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?" }, - Invalid_module_name_in_augmentation_module_0_cannot_be_found: { code: 2664, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", message: "Invalid module name in augmentation, module '{0}' cannot be found." }, - Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: { code: 2665, category: ts.DiagnosticCategory.Error, key: "Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665", message: "Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented." }, - Exports_and_export_assignments_are_not_permitted_in_module_augmentations: { code: 2666, category: ts.DiagnosticCategory.Error, key: "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", message: "Exports and export assignments are not permitted in module augmentations." }, - Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: { code: 2667, category: ts.DiagnosticCategory.Error, key: "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", message: "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module." }, - export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: { code: 2668, category: ts.DiagnosticCategory.Error, key: "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", message: "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible." }, - Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: { code: 2669, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669", message: "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations." }, - Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: { code: 2670, category: ts.DiagnosticCategory.Error, key: "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670", message: "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context." }, - Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: { code: 2671, category: ts.DiagnosticCategory.Error, key: "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671", message: "Cannot augment module '{0}' because it resolves to a non-module entity." }, - Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: { code: 2672, category: ts.DiagnosticCategory.Error, key: "Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672", message: "Cannot assign a '{0}' constructor type to a '{1}' constructor type." }, - Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: { code: 2673, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673", message: "Constructor of class '{0}' is private and only accessible within the class declaration." }, - Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: { code: 2674, category: ts.DiagnosticCategory.Error, key: "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", message: "Constructor of class '{0}' is protected and only accessible within the class declaration." }, - Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: { code: 2675, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", message: "Cannot extend a class '{0}'. Class constructor is marked as private." }, - Accessors_must_both_be_abstract_or_non_abstract: { code: 2676, category: ts.DiagnosticCategory.Error, key: "Accessors_must_both_be_abstract_or_non_abstract_2676", message: "Accessors must both be abstract or non-abstract." }, - A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: { code: 2677, category: ts.DiagnosticCategory.Error, key: "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", message: "A type predicate's type must be assignable to its parameter's type." }, - Type_0_is_not_comparable_to_type_1: { code: 2678, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_comparable_to_type_1_2678", message: "Type '{0}' is not comparable to type '{1}'." }, - A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: { code: 2679, category: ts.DiagnosticCategory.Error, key: "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", message: "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'." }, - A_this_parameter_must_be_the_first_parameter: { code: 2680, category: ts.DiagnosticCategory.Error, key: "A_this_parameter_must_be_the_first_parameter_2680", message: "A 'this' parameter must be the first parameter." }, - A_constructor_cannot_have_a_this_parameter: { code: 2681, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_have_a_this_parameter_2681", message: "A constructor cannot have a 'this' parameter." }, - get_and_set_accessor_must_have_the_same_this_type: { code: 2682, category: ts.DiagnosticCategory.Error, key: "get_and_set_accessor_must_have_the_same_this_type_2682", message: "'get' and 'set' accessor must have the same 'this' type." }, - this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: { code: 2683, category: ts.DiagnosticCategory.Error, key: "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", message: "'this' implicitly has type 'any' because it does not have a type annotation." }, - The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: { code: 2684, category: ts.DiagnosticCategory.Error, key: "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", message: "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'." }, - The_this_types_of_each_signature_are_incompatible: { code: 2685, category: ts.DiagnosticCategory.Error, key: "The_this_types_of_each_signature_are_incompatible_2685", message: "The 'this' types of each signature are incompatible." }, - _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: { code: 2686, category: ts.DiagnosticCategory.Error, key: "_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686", message: "'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead." }, - All_declarations_of_0_must_have_identical_modifiers: { code: 2687, category: ts.DiagnosticCategory.Error, key: "All_declarations_of_0_must_have_identical_modifiers_2687", message: "All declarations of '{0}' must have identical modifiers." }, - Cannot_find_type_definition_file_for_0: { code: 2688, category: ts.DiagnosticCategory.Error, key: "Cannot_find_type_definition_file_for_0_2688", message: "Cannot find type definition file for '{0}'." }, - Cannot_extend_an_interface_0_Did_you_mean_implements: { code: 2689, category: ts.DiagnosticCategory.Error, key: "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", message: "Cannot extend an interface '{0}'. Did you mean 'implements'?" }, - An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: { code: 2691, category: ts.DiagnosticCategory.Error, key: "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", message: "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead." }, - _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: { code: 2692, category: ts.DiagnosticCategory.Error, key: "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", message: "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible." }, - _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: { code: 2693, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", message: "'{0}' only refers to a type, but is being used as a value here." }, - Namespace_0_has_no_exported_member_1: { code: 2694, category: ts.DiagnosticCategory.Error, key: "Namespace_0_has_no_exported_member_1_2694", message: "Namespace '{0}' has no exported member '{1}'." }, - Left_side_of_comma_operator_is_unused_and_has_no_side_effects: { code: 2695, category: ts.DiagnosticCategory.Error, key: "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", message: "Left side of comma operator is unused and has no side effects." }, - The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: { code: 2696, category: ts.DiagnosticCategory.Error, key: "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", message: "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?" }, - An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2697, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", message: "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, - Spread_types_may_only_be_created_from_object_types: { code: 2698, category: ts.DiagnosticCategory.Error, key: "Spread_types_may_only_be_created_from_object_types_2698", message: "Spread types may only be created from object types." }, - Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: { code: 2699, category: ts.DiagnosticCategory.Error, key: "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", message: "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'." }, - Rest_types_may_only_be_created_from_object_types: { code: 2700, category: ts.DiagnosticCategory.Error, key: "Rest_types_may_only_be_created_from_object_types_2700", message: "Rest types may only be created from object types." }, - The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: { code: 2701, category: ts.DiagnosticCategory.Error, key: "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", message: "The target of an object rest assignment must be a variable or a property access." }, - _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: { code: 2702, category: ts.DiagnosticCategory.Error, key: "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", message: "'{0}' only refers to a type, but is being used as a namespace here." }, - The_operand_of_a_delete_operator_must_be_a_property_reference: { code: 2703, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", message: "The operand of a delete operator must be a property reference." }, - The_operand_of_a_delete_operator_cannot_be_a_read_only_property: { code: 2704, category: ts.DiagnosticCategory.Error, key: "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", message: "The operand of a delete operator cannot be a read-only property." }, - An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2705, category: ts.DiagnosticCategory.Error, key: "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", message: "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, - Required_type_parameters_may_not_follow_optional_type_parameters: { code: 2706, category: ts.DiagnosticCategory.Error, key: "Required_type_parameters_may_not_follow_optional_type_parameters_2706", message: "Required type parameters may not follow optional type parameters." }, - Generic_type_0_requires_between_1_and_2_type_arguments: { code: 2707, category: ts.DiagnosticCategory.Error, key: "Generic_type_0_requires_between_1_and_2_type_arguments_2707", message: "Generic type '{0}' requires between {1} and {2} type arguments." }, - Cannot_use_namespace_0_as_a_value: { code: 2708, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_value_2708", message: "Cannot use namespace '{0}' as a value." }, - Cannot_use_namespace_0_as_a_type: { code: 2709, category: ts.DiagnosticCategory.Error, key: "Cannot_use_namespace_0_as_a_type_2709", message: "Cannot use namespace '{0}' as a type." }, - _0_are_specified_twice_The_attribute_named_0_will_be_overwritten: { code: 2710, category: ts.DiagnosticCategory.Error, key: "_0_are_specified_twice_The_attribute_named_0_will_be_overwritten_2710", message: "'{0}' are specified twice. The attribute named '{0}' will be overwritten." }, - A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: { code: 2711, category: ts.DiagnosticCategory.Error, key: "A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711", message: "A dynamic import call returns a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option." }, - A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: { code: 2712, category: ts.DiagnosticCategory.Error, key: "A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declarat_2712", message: "A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option." }, - Import_declaration_0_is_using_private_name_1: { code: 4000, category: ts.DiagnosticCategory.Error, key: "Import_declaration_0_is_using_private_name_1_4000", message: "Import declaration '{0}' is using private name '{1}'." }, - Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", message: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, - Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", message: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4006, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006", message: "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4008, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008", message: "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4010, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010", message: "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4012, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012", message: "Type parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4014, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", message: "Type parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4016, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", message: "Type parameter '{0}' of exported function has or is using private name '{1}'." }, - Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4019, category: ts.DiagnosticCategory.Error, key: "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", message: "Implements clause of exported class '{0}' has or is using private name '{1}'." }, - extends_clause_of_exported_class_0_has_or_is_using_private_name_1: { code: 4020, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", message: "'extends' clause of exported class '{0}' has or is using private name '{1}'." }, - extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: { code: 4022, category: ts.DiagnosticCategory.Error, key: "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", message: "'extends' clause of exported interface '{0}' has or is using private name '{1}'." }, - Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4023, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", message: "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named." }, - Exported_variable_0_has_or_is_using_name_1_from_private_module_2: { code: 4024, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", message: "Exported variable '{0}' has or is using name '{1}' from private module '{2}'." }, - Exported_variable_0_has_or_is_using_private_name_1: { code: 4025, category: ts.DiagnosticCategory.Error, key: "Exported_variable_0_has_or_is_using_private_name_1_4025", message: "Exported variable '{0}' has or is using private name '{1}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4026, category: ts.DiagnosticCategory.Error, key: "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026", message: "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4027, category: ts.DiagnosticCategory.Error, key: "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027", message: "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4028, category: ts.DiagnosticCategory.Error, key: "Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028", message: "Public static property '{0}' of exported class has or is using private name '{1}'." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4029, category: ts.DiagnosticCategory.Error, key: "Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029", message: "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4030, category: ts.DiagnosticCategory.Error, key: "Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030", message: "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'." }, - Public_property_0_of_exported_class_has_or_is_using_private_name_1: { code: 4031, category: ts.DiagnosticCategory.Error, key: "Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031", message: "Public property '{0}' of exported class has or is using private name '{1}'." }, - Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4032, category: ts.DiagnosticCategory.Error, key: "Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032", message: "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'." }, - Property_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4033, category: ts.DiagnosticCategory.Error, key: "Property_0_of_exported_interface_has_or_is_using_private_name_1_4033", message: "Property '{0}' of exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4034, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_4034", message: "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4035, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1_4035", message: "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4036, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_4036", message: "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: { code: 4037, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1_4037", message: "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4038, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_externa_4038", message: "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4039, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_4039", message: "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4040, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0_4040", message: "Return type of public static property getter from exported class has or is using private name '{0}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4041, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_modul_4041", message: "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4042, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_4042", message: "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: { code: 4043, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0_4043", message: "Return type of public property getter from exported class has or is using private name '{0}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4044, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044", message: "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4045, category: ts.DiagnosticCategory.Error, key: "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045", message: "Return type of constructor signature from exported interface has or is using private name '{0}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4046, category: ts.DiagnosticCategory.Error, key: "Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046", message: "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4047, category: ts.DiagnosticCategory.Error, key: "Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047", message: "Return type of call signature from exported interface has or is using private name '{0}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4048, category: ts.DiagnosticCategory.Error, key: "Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048", message: "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: { code: 4049, category: ts.DiagnosticCategory.Error, key: "Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049", message: "Return type of index signature from exported interface has or is using private name '{0}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4050, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050", message: "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4051, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051", message: "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: { code: 4052, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052", message: "Return type of public static method from exported class has or is using private name '{0}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4053, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053", message: "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: { code: 4054, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054", message: "Return type of public method from exported class has or is using name '{0}' from private module '{1}'." }, - Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: { code: 4055, category: ts.DiagnosticCategory.Error, key: "Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055", message: "Return type of public method from exported class has or is using private name '{0}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: { code: 4056, category: ts.DiagnosticCategory.Error, key: "Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056", message: "Return type of method from exported interface has or is using name '{0}' from private module '{1}'." }, - Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: { code: 4057, category: ts.DiagnosticCategory.Error, key: "Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057", message: "Return type of method from exported interface has or is using private name '{0}'." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: { code: 4058, category: ts.DiagnosticCategory.Error, key: "Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058", message: "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named." }, - Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: { code: 4059, category: ts.DiagnosticCategory.Error, key: "Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059", message: "Return type of exported function has or is using name '{0}' from private module '{1}'." }, - Return_type_of_exported_function_has_or_is_using_private_name_0: { code: 4060, category: ts.DiagnosticCategory.Error, key: "Return_type_of_exported_function_has_or_is_using_private_name_0_4060", message: "Return type of exported function has or is using private name '{0}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4061, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061", message: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4062, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062", message: "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: { code: 4063, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063", message: "Parameter '{0}' of constructor from exported class has or is using private name '{1}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4064, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064", message: "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4065, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065", message: "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4066, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066", message: "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4067, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067", message: "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4068, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068", message: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4069, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069", message: "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: { code: 4070, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070", message: "Parameter '{0}' of public static method from exported class has or is using private name '{1}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4071, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071", message: "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: { code: 4072, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072", message: "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: { code: 4073, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073", message: "Parameter '{0}' of public method from exported class has or is using private name '{1}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4074, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074", message: "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: { code: 4075, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075", message: "Parameter '{0}' of method from exported interface has or is using private name '{1}'." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: { code: 4076, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076", message: "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named." }, - Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077", message: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", message: "Parameter '{0}' of exported function has or is using private name '{1}'." }, - Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: ts.DiagnosticCategory.Error, key: "Exported_type_alias_0_has_or_is_using_private_name_1_4081", message: "Exported type alias '{0}' has or is using private name '{1}'." }, - Default_export_of_the_module_has_or_is_using_private_name_0: { code: 4082, category: ts.DiagnosticCategory.Error, key: "Default_export_of_the_module_has_or_is_using_private_name_0_4082", message: "Default export of the module has or is using private name '{0}'." }, - Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: { code: 4083, category: ts.DiagnosticCategory.Error, key: "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", message: "Type parameter '{0}' of exported type alias has or is using private name '{1}'." }, - Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: { code: 4090, category: ts.DiagnosticCategory.Message, key: "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", message: "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict." }, - Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: { code: 4091, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", message: "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'." }, - Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: { code: 4092, category: ts.DiagnosticCategory.Error, key: "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", message: "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'." }, - Property_0_of_exported_class_expression_may_not_be_private_or_protected: { code: 4094, category: ts.DiagnosticCategory.Error, key: "Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094", message: "Property '{0}' of exported class expression may not be private or protected." }, - The_current_host_does_not_support_the_0_option: { code: 5001, category: ts.DiagnosticCategory.Error, key: "The_current_host_does_not_support_the_0_option_5001", message: "The current host does not support the '{0}' option." }, - Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: ts.DiagnosticCategory.Error, key: "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", message: "Cannot find the common subdirectory path for the input files." }, - File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5010, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", message: "File specification cannot end in a recursive directory wildcard ('**'): '{0}'." }, - File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: { code: 5011, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0_5011", message: "File specification cannot contain multiple recursive directory wildcards ('**'): '{0}'." }, - Cannot_read_file_0_Colon_1: { code: 5012, category: ts.DiagnosticCategory.Error, key: "Cannot_read_file_0_Colon_1_5012", message: "Cannot read file '{0}': {1}." }, - Failed_to_parse_file_0_Colon_1: { code: 5014, category: ts.DiagnosticCategory.Error, key: "Failed_to_parse_file_0_Colon_1_5014", message: "Failed to parse file '{0}': {1}." }, - Unknown_compiler_option_0: { code: 5023, category: ts.DiagnosticCategory.Error, key: "Unknown_compiler_option_0_5023", message: "Unknown compiler option '{0}'." }, - Compiler_option_0_requires_a_value_of_type_1: { code: 5024, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_requires_a_value_of_type_1_5024", message: "Compiler option '{0}' requires a value of type {1}." }, - Could_not_write_file_0_Colon_1: { code: 5033, category: ts.DiagnosticCategory.Error, key: "Could_not_write_file_0_Colon_1_5033", message: "Could not write file '{0}': {1}." }, - Option_project_cannot_be_mixed_with_source_files_on_a_command_line: { code: 5042, category: ts.DiagnosticCategory.Error, key: "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", message: "Option 'project' cannot be mixed with source files on a command line." }, - Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: { code: 5047, category: ts.DiagnosticCategory.Error, key: "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", message: "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher." }, - Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: { code: 5051, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", message: "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided." }, - Option_0_cannot_be_specified_without_specifying_option_1: { code: 5052, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_without_specifying_option_1_5052", message: "Option '{0}' cannot be specified without specifying option '{1}'." }, - Option_0_cannot_be_specified_with_option_1: { code: 5053, category: ts.DiagnosticCategory.Error, key: "Option_0_cannot_be_specified_with_option_1_5053", message: "Option '{0}' cannot be specified with option '{1}'." }, - A_tsconfig_json_file_is_already_defined_at_Colon_0: { code: 5054, category: ts.DiagnosticCategory.Error, key: "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", message: "A 'tsconfig.json' file is already defined at: '{0}'." }, - Cannot_write_file_0_because_it_would_overwrite_input_file: { code: 5055, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", message: "Cannot write file '{0}' because it would overwrite input file." }, - Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: { code: 5056, category: ts.DiagnosticCategory.Error, key: "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", message: "Cannot write file '{0}' because it would be overwritten by multiple input files." }, - Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: { code: 5057, category: ts.DiagnosticCategory.Error, key: "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", message: "Cannot find a tsconfig.json file at the specified directory: '{0}'." }, - The_specified_path_does_not_exist_Colon_0: { code: 5058, category: ts.DiagnosticCategory.Error, key: "The_specified_path_does_not_exist_Colon_0_5058", message: "The specified path does not exist: '{0}'." }, - Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: { code: 5059, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", message: "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier." }, - Option_paths_cannot_be_used_without_specifying_baseUrl_option: { code: 5060, category: ts.DiagnosticCategory.Error, key: "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", message: "Option 'paths' cannot be used without specifying '--baseUrl' option." }, - Pattern_0_can_have_at_most_one_Asterisk_character: { code: 5061, category: ts.DiagnosticCategory.Error, key: "Pattern_0_can_have_at_most_one_Asterisk_character_5061", message: "Pattern '{0}' can have at most one '*' character." }, - Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: { code: 5062, category: ts.DiagnosticCategory.Error, key: "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", message: "Substitution '{0}' in pattern '{1}' in can have at most one '*' character." }, - Substitutions_for_pattern_0_should_be_an_array: { code: 5063, category: ts.DiagnosticCategory.Error, key: "Substitutions_for_pattern_0_should_be_an_array_5063", message: "Substitutions for pattern '{0}' should be an array." }, - Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: { code: 5064, category: ts.DiagnosticCategory.Error, key: "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", message: "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'." }, - File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: { code: 5065, category: ts.DiagnosticCategory.Error, key: "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", message: "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'." }, - Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: { code: 5066, category: ts.DiagnosticCategory.Error, key: "Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066", message: "Substitutions for pattern '{0}' shouldn't be an empty array." }, - Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: { code: 5067, category: ts.DiagnosticCategory.Error, key: "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067", message: "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name." }, - Concatenate_and_emit_output_to_single_file: { code: 6001, category: ts.DiagnosticCategory.Message, key: "Concatenate_and_emit_output_to_single_file_6001", message: "Concatenate and emit output to single file." }, - Generates_corresponding_d_ts_file: { code: 6002, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_d_ts_file_6002", message: "Generates corresponding '.d.ts' file." }, - Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: { code: 6003, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", message: "Specify the location where debugger should locate map files instead of generated locations." }, - Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: { code: 6004, category: ts.DiagnosticCategory.Message, key: "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", message: "Specify the location where debugger should locate TypeScript files instead of source locations." }, - Watch_input_files: { code: 6005, category: ts.DiagnosticCategory.Message, key: "Watch_input_files_6005", message: "Watch input files." }, - Redirect_output_structure_to_the_directory: { code: 6006, category: ts.DiagnosticCategory.Message, key: "Redirect_output_structure_to_the_directory_6006", message: "Redirect output structure to the directory." }, - Do_not_erase_const_enum_declarations_in_generated_code: { code: 6007, category: ts.DiagnosticCategory.Message, key: "Do_not_erase_const_enum_declarations_in_generated_code_6007", message: "Do not erase const enum declarations in generated code." }, - Do_not_emit_outputs_if_any_errors_were_reported: { code: 6008, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_if_any_errors_were_reported_6008", message: "Do not emit outputs if any errors were reported." }, - Do_not_emit_comments_to_output: { code: 6009, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_comments_to_output_6009", message: "Do not emit comments to output." }, - Do_not_emit_outputs: { code: 6010, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_outputs_6010", message: "Do not emit outputs." }, - Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: { code: 6011, category: ts.DiagnosticCategory.Message, key: "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", message: "Allow default imports from modules with no default export. This does not affect code emit, just typechecking." }, - Skip_type_checking_of_declaration_files: { code: 6012, category: ts.DiagnosticCategory.Message, key: "Skip_type_checking_of_declaration_files_6012", message: "Skip type checking of declaration files." }, - Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: { code: 6015, category: ts.DiagnosticCategory.Message, key: "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", message: "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'." }, - Specify_module_code_generation_Colon_commonjs_amd_system_umd_es2015_or_ESNext: { code: 6016, category: ts.DiagnosticCategory.Message, key: "Specify_module_code_generation_Colon_commonjs_amd_system_umd_es2015_or_ESNext_6016", message: "Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'." }, - Print_this_message: { code: 6017, category: ts.DiagnosticCategory.Message, key: "Print_this_message_6017", message: "Print this message." }, - Print_the_compiler_s_version: { code: 6019, category: ts.DiagnosticCategory.Message, key: "Print_the_compiler_s_version_6019", message: "Print the compiler's version." }, - Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: { code: 6020, category: ts.DiagnosticCategory.Message, key: "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", message: "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'." }, - Syntax_Colon_0: { code: 6023, category: ts.DiagnosticCategory.Message, key: "Syntax_Colon_0_6023", message: "Syntax: {0}" }, - options: { code: 6024, category: ts.DiagnosticCategory.Message, key: "options_6024", message: "options" }, - file: { code: 6025, category: ts.DiagnosticCategory.Message, key: "file_6025", message: "file" }, - Examples_Colon_0: { code: 6026, category: ts.DiagnosticCategory.Message, key: "Examples_Colon_0_6026", message: "Examples: {0}" }, - Options_Colon: { code: 6027, category: ts.DiagnosticCategory.Message, key: "Options_Colon_6027", message: "Options:" }, - Version_0: { code: 6029, category: ts.DiagnosticCategory.Message, key: "Version_0_6029", message: "Version {0}" }, - Insert_command_line_options_and_files_from_a_file: { code: 6030, category: ts.DiagnosticCategory.Message, key: "Insert_command_line_options_and_files_from_a_file_6030", message: "Insert command line options and files from a file." }, - File_change_detected_Starting_incremental_compilation: { code: 6032, category: ts.DiagnosticCategory.Message, key: "File_change_detected_Starting_incremental_compilation_6032", message: "File change detected. Starting incremental compilation..." }, - KIND: { code: 6034, category: ts.DiagnosticCategory.Message, key: "KIND_6034", message: "KIND" }, - FILE: { code: 6035, category: ts.DiagnosticCategory.Message, key: "FILE_6035", message: "FILE" }, - VERSION: { code: 6036, category: ts.DiagnosticCategory.Message, key: "VERSION_6036", message: "VERSION" }, - LOCATION: { code: 6037, category: ts.DiagnosticCategory.Message, key: "LOCATION_6037", message: "LOCATION" }, - DIRECTORY: { code: 6038, category: ts.DiagnosticCategory.Message, key: "DIRECTORY_6038", message: "DIRECTORY" }, - STRATEGY: { code: 6039, category: ts.DiagnosticCategory.Message, key: "STRATEGY_6039", message: "STRATEGY" }, - FILE_OR_DIRECTORY: { code: 6040, category: ts.DiagnosticCategory.Message, key: "FILE_OR_DIRECTORY_6040", message: "FILE OR DIRECTORY" }, - Compilation_complete_Watching_for_file_changes: { code: 6042, category: ts.DiagnosticCategory.Message, key: "Compilation_complete_Watching_for_file_changes_6042", message: "Compilation complete. Watching for file changes." }, - Generates_corresponding_map_file: { code: 6043, category: ts.DiagnosticCategory.Message, key: "Generates_corresponding_map_file_6043", message: "Generates corresponding '.map' file." }, - Compiler_option_0_expects_an_argument: { code: 6044, category: ts.DiagnosticCategory.Error, key: "Compiler_option_0_expects_an_argument_6044", message: "Compiler option '{0}' expects an argument." }, - Unterminated_quoted_string_in_response_file_0: { code: 6045, category: ts.DiagnosticCategory.Error, key: "Unterminated_quoted_string_in_response_file_0_6045", message: "Unterminated quoted string in response file '{0}'." }, - Argument_for_0_option_must_be_Colon_1: { code: 6046, category: ts.DiagnosticCategory.Error, key: "Argument_for_0_option_must_be_Colon_1_6046", message: "Argument for '{0}' option must be: {1}." }, - Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: { code: 6048, category: ts.DiagnosticCategory.Error, key: "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", message: "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'." }, - Unsupported_locale_0: { code: 6049, category: ts.DiagnosticCategory.Error, key: "Unsupported_locale_0_6049", message: "Unsupported locale '{0}'." }, - Unable_to_open_file_0: { code: 6050, category: ts.DiagnosticCategory.Error, key: "Unable_to_open_file_0_6050", message: "Unable to open file '{0}'." }, - Corrupted_locale_file_0: { code: 6051, category: ts.DiagnosticCategory.Error, key: "Corrupted_locale_file_0_6051", message: "Corrupted locale file {0}." }, - Raise_error_on_expressions_and_declarations_with_an_implied_any_type: { code: 6052, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052", message: "Raise error on expressions and declarations with an implied 'any' type." }, - File_0_not_found: { code: 6053, category: ts.DiagnosticCategory.Error, key: "File_0_not_found_6053", message: "File '{0}' not found." }, - File_0_has_unsupported_extension_The_only_supported_extensions_are_1: { code: 6054, category: ts.DiagnosticCategory.Error, key: "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", message: "File '{0}' has unsupported extension. The only supported extensions are {1}." }, - Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: { code: 6055, category: ts.DiagnosticCategory.Message, key: "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", message: "Suppress noImplicitAny errors for indexing objects lacking index signatures." }, - Do_not_emit_declarations_for_code_that_has_an_internal_annotation: { code: 6056, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", message: "Do not emit declarations for code that has an '@internal' annotation." }, - Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: { code: 6058, category: ts.DiagnosticCategory.Message, key: "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", message: "Specify the root directory of input files. Use to control the output directory structure with --outDir." }, - File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: { code: 6059, category: ts.DiagnosticCategory.Error, key: "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", message: "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files." }, - Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: { code: 6060, category: ts.DiagnosticCategory.Message, key: "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", message: "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)." }, - NEWLINE: { code: 6061, category: ts.DiagnosticCategory.Message, key: "NEWLINE_6061", message: "NEWLINE" }, - Option_0_can_only_be_specified_in_tsconfig_json_file: { code: 6064, category: ts.DiagnosticCategory.Error, key: "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", message: "Option '{0}' can only be specified in 'tsconfig.json' file." }, - Enables_experimental_support_for_ES7_decorators: { code: 6065, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_decorators_6065", message: "Enables experimental support for ES7 decorators." }, - Enables_experimental_support_for_emitting_type_metadata_for_decorators: { code: 6066, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", message: "Enables experimental support for emitting type metadata for decorators." }, - Enables_experimental_support_for_ES7_async_functions: { code: 6068, category: ts.DiagnosticCategory.Message, key: "Enables_experimental_support_for_ES7_async_functions_6068", message: "Enables experimental support for ES7 async functions." }, - Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: { code: 6069, category: ts.DiagnosticCategory.Message, key: "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", message: "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)." }, - Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: { code: 6070, category: ts.DiagnosticCategory.Message, key: "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", message: "Initializes a TypeScript project and creates a tsconfig.json file." }, - Successfully_created_a_tsconfig_json_file: { code: 6071, category: ts.DiagnosticCategory.Message, key: "Successfully_created_a_tsconfig_json_file_6071", message: "Successfully created a tsconfig.json file." }, - Suppress_excess_property_checks_for_object_literals: { code: 6072, category: ts.DiagnosticCategory.Message, key: "Suppress_excess_property_checks_for_object_literals_6072", message: "Suppress excess property checks for object literals." }, - Stylize_errors_and_messages_using_color_and_context_experimental: { code: 6073, category: ts.DiagnosticCategory.Message, key: "Stylize_errors_and_messages_using_color_and_context_experimental_6073", message: "Stylize errors and messages using color and context (experimental)." }, - Do_not_report_errors_on_unused_labels: { code: 6074, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unused_labels_6074", message: "Do not report errors on unused labels." }, - Report_error_when_not_all_code_paths_in_function_return_a_value: { code: 6075, category: ts.DiagnosticCategory.Message, key: "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", message: "Report error when not all code paths in function return a value." }, - Report_errors_for_fallthrough_cases_in_switch_statement: { code: 6076, category: ts.DiagnosticCategory.Message, key: "Report_errors_for_fallthrough_cases_in_switch_statement_6076", message: "Report errors for fallthrough cases in switch statement." }, - Do_not_report_errors_on_unreachable_code: { code: 6077, category: ts.DiagnosticCategory.Message, key: "Do_not_report_errors_on_unreachable_code_6077", message: "Do not report errors on unreachable code." }, - Disallow_inconsistently_cased_references_to_the_same_file: { code: 6078, category: ts.DiagnosticCategory.Message, key: "Disallow_inconsistently_cased_references_to_the_same_file_6078", message: "Disallow inconsistently-cased references to the same file." }, - Specify_library_files_to_be_included_in_the_compilation_Colon: { code: 6079, category: ts.DiagnosticCategory.Message, key: "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", message: "Specify library files to be included in the compilation: " }, - Specify_JSX_code_generation_Colon_preserve_react_native_or_react: { code: 6080, category: ts.DiagnosticCategory.Message, key: "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", message: "Specify JSX code generation: 'preserve', 'react-native', or 'react'." }, - File_0_has_an_unsupported_extension_so_skipping_it: { code: 6081, category: ts.DiagnosticCategory.Message, key: "File_0_has_an_unsupported_extension_so_skipping_it_6081", message: "File '{0}' has an unsupported extension, so skipping it." }, - Only_amd_and_system_modules_are_supported_alongside_0: { code: 6082, category: ts.DiagnosticCategory.Error, key: "Only_amd_and_system_modules_are_supported_alongside_0_6082", message: "Only 'amd' and 'system' modules are supported alongside --{0}." }, - Base_directory_to_resolve_non_absolute_module_names: { code: 6083, category: ts.DiagnosticCategory.Message, key: "Base_directory_to_resolve_non_absolute_module_names_6083", message: "Base directory to resolve non-absolute module names." }, - Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: { code: 6084, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", message: "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit" }, - Enable_tracing_of_the_name_resolution_process: { code: 6085, category: ts.DiagnosticCategory.Message, key: "Enable_tracing_of_the_name_resolution_process_6085", message: "Enable tracing of the name resolution process." }, - Resolving_module_0_from_1: { code: 6086, category: ts.DiagnosticCategory.Message, key: "Resolving_module_0_from_1_6086", message: "======== Resolving module '{0}' from '{1}'. ========" }, - Explicitly_specified_module_resolution_kind_Colon_0: { code: 6087, category: ts.DiagnosticCategory.Message, key: "Explicitly_specified_module_resolution_kind_Colon_0_6087", message: "Explicitly specified module resolution kind: '{0}'." }, - Module_resolution_kind_is_not_specified_using_0: { code: 6088, category: ts.DiagnosticCategory.Message, key: "Module_resolution_kind_is_not_specified_using_0_6088", message: "Module resolution kind is not specified, using '{0}'." }, - Module_name_0_was_successfully_resolved_to_1: { code: 6089, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_successfully_resolved_to_1_6089", message: "======== Module name '{0}' was successfully resolved to '{1}'. ========" }, - Module_name_0_was_not_resolved: { code: 6090, category: ts.DiagnosticCategory.Message, key: "Module_name_0_was_not_resolved_6090", message: "======== Module name '{0}' was not resolved. ========" }, - paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: { code: 6091, category: ts.DiagnosticCategory.Message, key: "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091", message: "'paths' option is specified, looking for a pattern to match module name '{0}'." }, - Module_name_0_matched_pattern_1: { code: 6092, category: ts.DiagnosticCategory.Message, key: "Module_name_0_matched_pattern_1_6092", message: "Module name '{0}', matched pattern '{1}'." }, - Trying_substitution_0_candidate_module_location_Colon_1: { code: 6093, category: ts.DiagnosticCategory.Message, key: "Trying_substitution_0_candidate_module_location_Colon_1_6093", message: "Trying substitution '{0}', candidate module location: '{1}'." }, - Resolving_module_name_0_relative_to_base_url_1_2: { code: 6094, category: ts.DiagnosticCategory.Message, key: "Resolving_module_name_0_relative_to_base_url_1_2_6094", message: "Resolving module name '{0}' relative to base url '{1}' - '{2}'." }, - Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: { code: 6095, category: ts.DiagnosticCategory.Message, key: "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", message: "Loading module as file / folder, candidate module location '{0}', target file type '{1}'." }, - File_0_does_not_exist: { code: 6096, category: ts.DiagnosticCategory.Message, key: "File_0_does_not_exist_6096", message: "File '{0}' does not exist." }, - File_0_exist_use_it_as_a_name_resolution_result: { code: 6097, category: ts.DiagnosticCategory.Message, key: "File_0_exist_use_it_as_a_name_resolution_result_6097", message: "File '{0}' exist - use it as a name resolution result." }, - Loading_module_0_from_node_modules_folder_target_file_type_1: { code: 6098, category: ts.DiagnosticCategory.Message, key: "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", message: "Loading module '{0}' from 'node_modules' folder, target file type '{1}'." }, - Found_package_json_at_0: { code: 6099, category: ts.DiagnosticCategory.Message, key: "Found_package_json_at_0_6099", message: "Found 'package.json' at '{0}'." }, - package_json_does_not_have_a_0_field: { code: 6100, category: ts.DiagnosticCategory.Message, key: "package_json_does_not_have_a_0_field_6100", message: "'package.json' does not have a '{0}' field." }, - package_json_has_0_field_1_that_references_2: { code: 6101, category: ts.DiagnosticCategory.Message, key: "package_json_has_0_field_1_that_references_2_6101", message: "'package.json' has '{0}' field '{1}' that references '{2}'." }, - Allow_javascript_files_to_be_compiled: { code: 6102, category: ts.DiagnosticCategory.Message, key: "Allow_javascript_files_to_be_compiled_6102", message: "Allow javascript files to be compiled." }, - Option_0_should_have_array_of_strings_as_a_value: { code: 6103, category: ts.DiagnosticCategory.Error, key: "Option_0_should_have_array_of_strings_as_a_value_6103", message: "Option '{0}' should have array of strings as a value." }, - Checking_if_0_is_the_longest_matching_prefix_for_1_2: { code: 6104, category: ts.DiagnosticCategory.Message, key: "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", message: "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'." }, - Expected_type_of_0_field_in_package_json_to_be_string_got_1: { code: 6105, category: ts.DiagnosticCategory.Message, key: "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", message: "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'." }, - baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: { code: 6106, category: ts.DiagnosticCategory.Message, key: "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", message: "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'." }, - rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: { code: 6107, category: ts.DiagnosticCategory.Message, key: "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", message: "'rootDirs' option is set, using it to resolve relative module name '{0}'." }, - Longest_matching_prefix_for_0_is_1: { code: 6108, category: ts.DiagnosticCategory.Message, key: "Longest_matching_prefix_for_0_is_1_6108", message: "Longest matching prefix for '{0}' is '{1}'." }, - Loading_0_from_the_root_dir_1_candidate_location_2: { code: 6109, category: ts.DiagnosticCategory.Message, key: "Loading_0_from_the_root_dir_1_candidate_location_2_6109", message: "Loading '{0}' from the root dir '{1}', candidate location '{2}'." }, - Trying_other_entries_in_rootDirs: { code: 6110, category: ts.DiagnosticCategory.Message, key: "Trying_other_entries_in_rootDirs_6110", message: "Trying other entries in 'rootDirs'." }, - Module_resolution_using_rootDirs_has_failed: { code: 6111, category: ts.DiagnosticCategory.Message, key: "Module_resolution_using_rootDirs_has_failed_6111", message: "Module resolution using 'rootDirs' has failed." }, - Do_not_emit_use_strict_directives_in_module_output: { code: 6112, category: ts.DiagnosticCategory.Message, key: "Do_not_emit_use_strict_directives_in_module_output_6112", message: "Do not emit 'use strict' directives in module output." }, - Enable_strict_null_checks: { code: 6113, category: ts.DiagnosticCategory.Message, key: "Enable_strict_null_checks_6113", message: "Enable strict null checks." }, - Unknown_option_excludes_Did_you_mean_exclude: { code: 6114, category: ts.DiagnosticCategory.Error, key: "Unknown_option_excludes_Did_you_mean_exclude_6114", message: "Unknown option 'excludes'. Did you mean 'exclude'?" }, - Raise_error_on_this_expressions_with_an_implied_any_type: { code: 6115, category: ts.DiagnosticCategory.Message, key: "Raise_error_on_this_expressions_with_an_implied_any_type_6115", message: "Raise error on 'this' expressions with an implied 'any' type." }, - Resolving_type_reference_directive_0_containing_file_1_root_directory_2: { code: 6116, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========" }, - Resolving_using_primary_search_paths: { code: 6117, category: ts.DiagnosticCategory.Message, key: "Resolving_using_primary_search_paths_6117", message: "Resolving using primary search paths..." }, - Resolving_from_node_modules_folder: { code: 6118, category: ts.DiagnosticCategory.Message, key: "Resolving_from_node_modules_folder_6118", message: "Resolving from node_modules folder..." }, - Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: { code: 6119, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", message: "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========" }, - Type_reference_directive_0_was_not_resolved: { code: 6120, category: ts.DiagnosticCategory.Message, key: "Type_reference_directive_0_was_not_resolved_6120", message: "======== Type reference directive '{0}' was not resolved. ========" }, - Resolving_with_primary_search_path_0: { code: 6121, category: ts.DiagnosticCategory.Message, key: "Resolving_with_primary_search_path_0_6121", message: "Resolving with primary search path '{0}'." }, - Root_directory_cannot_be_determined_skipping_primary_search_paths: { code: 6122, category: ts.DiagnosticCategory.Message, key: "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", message: "Root directory cannot be determined, skipping primary search paths." }, - Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: { code: 6123, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", message: "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========" }, - Type_declaration_files_to_be_included_in_compilation: { code: 6124, category: ts.DiagnosticCategory.Message, key: "Type_declaration_files_to_be_included_in_compilation_6124", message: "Type declaration files to be included in compilation." }, - Looking_up_in_node_modules_folder_initial_location_0: { code: 6125, category: ts.DiagnosticCategory.Message, key: "Looking_up_in_node_modules_folder_initial_location_0_6125", message: "Looking up in 'node_modules' folder, initial location '{0}'." }, - Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: { code: 6126, category: ts.DiagnosticCategory.Message, key: "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", message: "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder." }, - Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: { code: 6127, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", message: "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========" }, - Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: { code: 6128, category: ts.DiagnosticCategory.Message, key: "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", message: "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========" }, - The_config_file_0_found_doesn_t_contain_any_source_files: { code: 6129, category: ts.DiagnosticCategory.Error, key: "The_config_file_0_found_doesn_t_contain_any_source_files_6129", message: "The config file '{0}' found doesn't contain any source files." }, - Resolving_real_path_for_0_result_1: { code: 6130, category: ts.DiagnosticCategory.Message, key: "Resolving_real_path_for_0_result_1_6130", message: "Resolving real path for '{0}', result '{1}'." }, - Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: { code: 6131, category: ts.DiagnosticCategory.Error, key: "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", message: "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'." }, - File_name_0_has_a_1_extension_stripping_it: { code: 6132, category: ts.DiagnosticCategory.Message, key: "File_name_0_has_a_1_extension_stripping_it_6132", message: "File name '{0}' has a '{1}' extension - stripping it." }, - _0_is_declared_but_never_used: { code: 6133, category: ts.DiagnosticCategory.Error, key: "_0_is_declared_but_never_used_6133", message: "'{0}' is declared but never used." }, - Report_errors_on_unused_locals: { code: 6134, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_locals_6134", message: "Report errors on unused locals." }, - Report_errors_on_unused_parameters: { code: 6135, category: ts.DiagnosticCategory.Message, key: "Report_errors_on_unused_parameters_6135", message: "Report errors on unused parameters." }, - The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: { code: 6136, category: ts.DiagnosticCategory.Message, key: "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", message: "The maximum dependency depth to search under node_modules and load JavaScript files." }, - Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1: { code: 6137, category: ts.DiagnosticCategory.Error, key: "Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1_6137", message: "Cannot import type declaration files. Consider importing '{0}' instead of '{1}'." }, - Property_0_is_declared_but_never_used: { code: 6138, category: ts.DiagnosticCategory.Error, key: "Property_0_is_declared_but_never_used_6138", message: "Property '{0}' is declared but never used." }, - Import_emit_helpers_from_tslib: { code: 6139, category: ts.DiagnosticCategory.Message, key: "Import_emit_helpers_from_tslib_6139", message: "Import emit helpers from 'tslib'." }, - Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: { code: 6140, category: ts.DiagnosticCategory.Error, key: "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", message: "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'." }, - Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: { code: 6141, category: ts.DiagnosticCategory.Message, key: "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", message: "Parse in strict mode and emit \"use strict\" for each source file." }, - Module_0_was_resolved_to_1_but_jsx_is_not_set: { code: 6142, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", message: "Module '{0}' was resolved to '{1}', but '--jsx' is not set." }, - Module_0_was_resolved_to_1_but_allowJs_is_not_set: { code: 6143, category: ts.DiagnosticCategory.Error, key: "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143", message: "Module '{0}' was resolved to '{1}', but '--allowJs' is not set." }, - Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: { code: 6144, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", message: "Module '{0}' was resolved as locally declared ambient module in file '{1}'." }, - Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: { code: 6145, category: ts.DiagnosticCategory.Message, key: "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", message: "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified." }, - Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: { code: 6146, category: ts.DiagnosticCategory.Message, key: "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", message: "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'." }, - Resolution_for_module_0_was_found_in_cache: { code: 6147, category: ts.DiagnosticCategory.Message, key: "Resolution_for_module_0_was_found_in_cache_6147", message: "Resolution for module '{0}' was found in cache." }, - Directory_0_does_not_exist_skipping_all_lookups_in_it: { code: 6148, category: ts.DiagnosticCategory.Message, key: "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", message: "Directory '{0}' does not exist, skipping all lookups in it." }, - Show_diagnostic_information: { code: 6149, category: ts.DiagnosticCategory.Message, key: "Show_diagnostic_information_6149", message: "Show diagnostic information." }, - Show_verbose_diagnostic_information: { code: 6150, category: ts.DiagnosticCategory.Message, key: "Show_verbose_diagnostic_information_6150", message: "Show verbose diagnostic information." }, - Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: { code: 6151, category: ts.DiagnosticCategory.Message, key: "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", message: "Emit a single file with source maps instead of having a separate file." }, - Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: { code: 6152, category: ts.DiagnosticCategory.Message, key: "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", message: "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set." }, - Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: { code: 6153, category: ts.DiagnosticCategory.Message, key: "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", message: "Transpile each file as a separate module (similar to 'ts.transpileModule')." }, - Print_names_of_generated_files_part_of_the_compilation: { code: 6154, category: ts.DiagnosticCategory.Message, key: "Print_names_of_generated_files_part_of_the_compilation_6154", message: "Print names of generated files part of the compilation." }, - Print_names_of_files_part_of_the_compilation: { code: 6155, category: ts.DiagnosticCategory.Message, key: "Print_names_of_files_part_of_the_compilation_6155", message: "Print names of files part of the compilation." }, - The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: { code: 6156, category: ts.DiagnosticCategory.Message, key: "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", message: "The locale used when displaying messages to the user (e.g. 'en-us')" }, - Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: { code: 6157, category: ts.DiagnosticCategory.Message, key: "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", message: "Do not generate custom helper functions like '__extends' in compiled output." }, - Do_not_include_the_default_library_file_lib_d_ts: { code: 6158, category: ts.DiagnosticCategory.Message, key: "Do_not_include_the_default_library_file_lib_d_ts_6158", message: "Do not include the default library file (lib.d.ts)." }, - Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: { code: 6159, category: ts.DiagnosticCategory.Message, key: "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", message: "Do not add triple-slash references or imported modules to the list of compiled files." }, - Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: { code: 6160, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", message: "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files." }, - List_of_folders_to_include_type_definitions_from: { code: 6161, category: ts.DiagnosticCategory.Message, key: "List_of_folders_to_include_type_definitions_from_6161", message: "List of folders to include type definitions from." }, - Disable_size_limitations_on_JavaScript_projects: { code: 6162, category: ts.DiagnosticCategory.Message, key: "Disable_size_limitations_on_JavaScript_projects_6162", message: "Disable size limitations on JavaScript projects." }, - The_character_set_of_the_input_files: { code: 6163, category: ts.DiagnosticCategory.Message, key: "The_character_set_of_the_input_files_6163", message: "The character set of the input files." }, - Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: { code: 6164, category: ts.DiagnosticCategory.Message, key: "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164", message: "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files." }, - Do_not_truncate_error_messages: { code: 6165, category: ts.DiagnosticCategory.Message, key: "Do_not_truncate_error_messages_6165", message: "Do not truncate error messages." }, - Output_directory_for_generated_declaration_files: { code: 6166, category: ts.DiagnosticCategory.Message, key: "Output_directory_for_generated_declaration_files_6166", message: "Output directory for generated declaration files." }, - A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: { code: 6167, category: ts.DiagnosticCategory.Message, key: "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", message: "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'." }, - List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: { code: 6168, category: ts.DiagnosticCategory.Message, key: "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", message: "List of root folders whose combined content represents the structure of the project at runtime." }, - Show_all_compiler_options: { code: 6169, category: ts.DiagnosticCategory.Message, key: "Show_all_compiler_options_6169", message: "Show all compiler options." }, - Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: { code: 6170, category: ts.DiagnosticCategory.Message, key: "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", message: "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file" }, - Command_line_Options: { code: 6171, category: ts.DiagnosticCategory.Message, key: "Command_line_Options_6171", message: "Command-line Options" }, - Basic_Options: { code: 6172, category: ts.DiagnosticCategory.Message, key: "Basic_Options_6172", message: "Basic Options" }, - Strict_Type_Checking_Options: { code: 6173, category: ts.DiagnosticCategory.Message, key: "Strict_Type_Checking_Options_6173", message: "Strict Type-Checking Options" }, - Module_Resolution_Options: { code: 6174, category: ts.DiagnosticCategory.Message, key: "Module_Resolution_Options_6174", message: "Module Resolution Options" }, - Source_Map_Options: { code: 6175, category: ts.DiagnosticCategory.Message, key: "Source_Map_Options_6175", message: "Source Map Options" }, - Additional_Checks: { code: 6176, category: ts.DiagnosticCategory.Message, key: "Additional_Checks_6176", message: "Additional Checks" }, - Experimental_Options: { code: 6177, category: ts.DiagnosticCategory.Message, key: "Experimental_Options_6177", message: "Experimental Options" }, - Advanced_Options: { code: 6178, category: ts.DiagnosticCategory.Message, key: "Advanced_Options_6178", message: "Advanced Options" }, - Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: { code: 6179, category: ts.DiagnosticCategory.Message, key: "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", message: "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'." }, - Enable_all_strict_type_checking_options: { code: 6180, category: ts.DiagnosticCategory.Message, key: "Enable_all_strict_type_checking_options_6180", message: "Enable all strict type-checking options." }, - List_of_language_service_plugins: { code: 6181, category: ts.DiagnosticCategory.Message, key: "List_of_language_service_plugins_6181", message: "List of language service plugins." }, - Scoped_package_detected_looking_in_0: { code: 6182, category: ts.DiagnosticCategory.Message, key: "Scoped_package_detected_looking_in_0_6182", message: "Scoped package detected, looking in '{0}'" }, - Reusing_resolution_of_module_0_to_file_1_from_old_program: { code: 6183, category: ts.DiagnosticCategory.Message, key: "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183", message: "Reusing resolution of module '{0}' to file '{1}' from old program." }, - Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program: { code: 6184, category: ts.DiagnosticCategory.Message, key: "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184", message: "Reusing module resolutions originating in '{0}' since resolutions are unchanged from old program." }, - Disable_strict_checking_of_generic_signatures_in_function_types: { code: 6185, category: ts.DiagnosticCategory.Message, key: "Disable_strict_checking_of_generic_signatures_in_function_types_6185", message: "Disable strict checking of generic signatures in function types." }, - Variable_0_implicitly_has_an_1_type: { code: 7005, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_an_1_type_7005", message: "Variable '{0}' implicitly has an '{1}' type." }, - Parameter_0_implicitly_has_an_1_type: { code: 7006, category: ts.DiagnosticCategory.Error, key: "Parameter_0_implicitly_has_an_1_type_7006", message: "Parameter '{0}' implicitly has an '{1}' type." }, - Member_0_implicitly_has_an_1_type: { code: 7008, category: ts.DiagnosticCategory.Error, key: "Member_0_implicitly_has_an_1_type_7008", message: "Member '{0}' implicitly has an '{1}' type." }, - new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: { code: 7009, category: ts.DiagnosticCategory.Error, key: "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", message: "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type." }, - _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: { code: 7010, category: ts.DiagnosticCategory.Error, key: "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", message: "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type." }, - Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: { code: 7011, category: ts.DiagnosticCategory.Error, key: "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", message: "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type." }, - Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7013, category: ts.DiagnosticCategory.Error, key: "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", message: "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: { code: 7015, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", message: "Element implicitly has an 'any' type because index expression is not of type 'number'." }, - Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: { code: 7016, category: ts.DiagnosticCategory.Error, key: "Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016", message: "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type." }, - Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: { code: 7017, category: ts.DiagnosticCategory.Error, key: "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017", message: "Element implicitly has an 'any' type because type '{0}' has no index signature." }, - Object_literal_s_property_0_implicitly_has_an_1_type: { code: 7018, category: ts.DiagnosticCategory.Error, key: "Object_literal_s_property_0_implicitly_has_an_1_type_7018", message: "Object literal's property '{0}' implicitly has an '{1}' type." }, - Rest_parameter_0_implicitly_has_an_any_type: { code: 7019, category: ts.DiagnosticCategory.Error, key: "Rest_parameter_0_implicitly_has_an_any_type_7019", message: "Rest parameter '{0}' implicitly has an 'any[]' type." }, - Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: { code: 7020, category: ts.DiagnosticCategory.Error, key: "Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020", message: "Call signature, which lacks return-type annotation, implicitly has an 'any' return type." }, - _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: { code: 7022, category: ts.DiagnosticCategory.Error, key: "_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022", message: "'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer." }, - _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7023, category: ts.DiagnosticCategory.Error, key: "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", message: "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: { code: 7024, category: ts.DiagnosticCategory.Error, key: "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", message: "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions." }, - Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: { code: 7025, category: ts.DiagnosticCategory.Error, key: "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", message: "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type." }, - JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: { code: 7026, category: ts.DiagnosticCategory.Error, key: "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", message: "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists." }, - Unreachable_code_detected: { code: 7027, category: ts.DiagnosticCategory.Error, key: "Unreachable_code_detected_7027", message: "Unreachable code detected." }, - Unused_label: { code: 7028, category: ts.DiagnosticCategory.Error, key: "Unused_label_7028", message: "Unused label." }, - Fallthrough_case_in_switch: { code: 7029, category: ts.DiagnosticCategory.Error, key: "Fallthrough_case_in_switch_7029", message: "Fallthrough case in switch." }, - Not_all_code_paths_return_a_value: { code: 7030, category: ts.DiagnosticCategory.Error, key: "Not_all_code_paths_return_a_value_7030", message: "Not all code paths return a value." }, - Binding_element_0_implicitly_has_an_1_type: { code: 7031, category: ts.DiagnosticCategory.Error, key: "Binding_element_0_implicitly_has_an_1_type_7031", message: "Binding element '{0}' implicitly has an '{1}' type." }, - Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: { code: 7032, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032", message: "Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation." }, - Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: { code: 7033, category: ts.DiagnosticCategory.Error, key: "Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033", message: "Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation." }, - Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: { code: 7034, category: ts.DiagnosticCategory.Error, key: "Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034", message: "Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined." }, - Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0: { code: 7035, category: ts.DiagnosticCategory.Error, key: "Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_mod_7035", message: "Try `npm install @types/{0}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`" }, - Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0: { code: 7036, category: ts.DiagnosticCategory.Error, key: "Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036", message: "Dynamic import's specifier must be of type 'string', but here has type '{0}'." }, - You_cannot_rename_this_element: { code: 8000, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_this_element_8000", message: "You cannot rename this element." }, - You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: { code: 8001, category: ts.DiagnosticCategory.Error, key: "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", message: "You cannot rename elements that are defined in the standard TypeScript library." }, - import_can_only_be_used_in_a_ts_file: { code: 8002, category: ts.DiagnosticCategory.Error, key: "import_can_only_be_used_in_a_ts_file_8002", message: "'import ... =' can only be used in a .ts file." }, - export_can_only_be_used_in_a_ts_file: { code: 8003, category: ts.DiagnosticCategory.Error, key: "export_can_only_be_used_in_a_ts_file_8003", message: "'export=' can only be used in a .ts file." }, - type_parameter_declarations_can_only_be_used_in_a_ts_file: { code: 8004, category: ts.DiagnosticCategory.Error, key: "type_parameter_declarations_can_only_be_used_in_a_ts_file_8004", message: "'type parameter declarations' can only be used in a .ts file." }, - implements_clauses_can_only_be_used_in_a_ts_file: { code: 8005, category: ts.DiagnosticCategory.Error, key: "implements_clauses_can_only_be_used_in_a_ts_file_8005", message: "'implements clauses' can only be used in a .ts file." }, - interface_declarations_can_only_be_used_in_a_ts_file: { code: 8006, category: ts.DiagnosticCategory.Error, key: "interface_declarations_can_only_be_used_in_a_ts_file_8006", message: "'interface declarations' can only be used in a .ts file." }, - module_declarations_can_only_be_used_in_a_ts_file: { code: 8007, category: ts.DiagnosticCategory.Error, key: "module_declarations_can_only_be_used_in_a_ts_file_8007", message: "'module declarations' can only be used in a .ts file." }, - type_aliases_can_only_be_used_in_a_ts_file: { code: 8008, category: ts.DiagnosticCategory.Error, key: "type_aliases_can_only_be_used_in_a_ts_file_8008", message: "'type aliases' can only be used in a .ts file." }, - _0_can_only_be_used_in_a_ts_file: { code: 8009, category: ts.DiagnosticCategory.Error, key: "_0_can_only_be_used_in_a_ts_file_8009", message: "'{0}' can only be used in a .ts file." }, - types_can_only_be_used_in_a_ts_file: { code: 8010, category: ts.DiagnosticCategory.Error, key: "types_can_only_be_used_in_a_ts_file_8010", message: "'types' can only be used in a .ts file." }, - type_arguments_can_only_be_used_in_a_ts_file: { code: 8011, category: ts.DiagnosticCategory.Error, key: "type_arguments_can_only_be_used_in_a_ts_file_8011", message: "'type arguments' can only be used in a .ts file." }, - parameter_modifiers_can_only_be_used_in_a_ts_file: { code: 8012, category: ts.DiagnosticCategory.Error, key: "parameter_modifiers_can_only_be_used_in_a_ts_file_8012", message: "'parameter modifiers' can only be used in a .ts file." }, - enum_declarations_can_only_be_used_in_a_ts_file: { code: 8015, category: ts.DiagnosticCategory.Error, key: "enum_declarations_can_only_be_used_in_a_ts_file_8015", message: "'enum declarations' can only be used in a .ts file." }, - type_assertion_expressions_can_only_be_used_in_a_ts_file: { code: 8016, category: ts.DiagnosticCategory.Error, key: "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", message: "'type assertion expressions' can only be used in a .ts file." }, - Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clause: { code: 9002, category: ts.DiagnosticCategory.Error, key: "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", message: "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause." }, - class_expressions_are_not_currently_supported: { code: 9003, category: ts.DiagnosticCategory.Error, key: "class_expressions_are_not_currently_supported_9003", message: "'class' expressions are not currently supported." }, - Language_service_is_disabled: { code: 9004, category: ts.DiagnosticCategory.Error, key: "Language_service_is_disabled_9004", message: "Language service is disabled." }, - JSX_attributes_must_only_be_assigned_a_non_empty_expression: { code: 17000, category: ts.DiagnosticCategory.Error, key: "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", message: "JSX attributes must only be assigned a non-empty 'expression'." }, - JSX_elements_cannot_have_multiple_attributes_with_the_same_name: { code: 17001, category: ts.DiagnosticCategory.Error, key: "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", message: "JSX elements cannot have multiple attributes with the same name." }, - Expected_corresponding_JSX_closing_tag_for_0: { code: 17002, category: ts.DiagnosticCategory.Error, key: "Expected_corresponding_JSX_closing_tag_for_0_17002", message: "Expected corresponding JSX closing tag for '{0}'." }, - JSX_attribute_expected: { code: 17003, category: ts.DiagnosticCategory.Error, key: "JSX_attribute_expected_17003", message: "JSX attribute expected." }, - Cannot_use_JSX_unless_the_jsx_flag_is_provided: { code: 17004, category: ts.DiagnosticCategory.Error, key: "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", message: "Cannot use JSX unless the '--jsx' flag is provided." }, - A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: { code: 17005, category: ts.DiagnosticCategory.Error, key: "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", message: "A constructor cannot contain a 'super' call when its class extends 'null'." }, - An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17006, category: ts.DiagnosticCategory.Error, key: "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", message: "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, - A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: { code: 17007, category: ts.DiagnosticCategory.Error, key: "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", message: "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses." }, - 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." }, - _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: { code: 17012, category: ts.DiagnosticCategory.Error, key: "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", message: "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?" }, - Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: { code: 17013, category: ts.DiagnosticCategory.Error, key: "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", message: "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." }, - 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." }, - No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: { code: 18003, category: ts.DiagnosticCategory.Error, key: "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", message: "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'." }, - Add_missing_super_call: { code: 90001, category: ts.DiagnosticCategory.Message, key: "Add_missing_super_call_90001", message: "Add missing 'super()' call." }, - Make_super_call_the_first_statement_in_the_constructor: { code: 90002, category: ts.DiagnosticCategory.Message, key: "Make_super_call_the_first_statement_in_the_constructor_90002", message: "Make 'super()' call the first statement in the constructor." }, - Change_extends_to_implements: { code: 90003, category: ts.DiagnosticCategory.Message, key: "Change_extends_to_implements_90003", message: "Change 'extends' to 'implements'." }, - Remove_declaration_for_Colon_0: { code: 90004, category: ts.DiagnosticCategory.Message, key: "Remove_declaration_for_Colon_0_90004", message: "Remove declaration for: '{0}'." }, - Implement_interface_0: { code: 90006, category: ts.DiagnosticCategory.Message, key: "Implement_interface_0_90006", message: "Implement interface '{0}'." }, - Implement_inherited_abstract_class: { code: 90007, category: ts.DiagnosticCategory.Message, key: "Implement_inherited_abstract_class_90007", message: "Implement inherited abstract class." }, - Add_this_to_unresolved_variable: { code: 90008, category: ts.DiagnosticCategory.Message, key: "Add_this_to_unresolved_variable_90008", message: "Add 'this.' to unresolved variable." }, - Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: { code: 90009, category: ts.DiagnosticCategory.Error, key: "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", message: "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig." }, - Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: { code: 90010, category: ts.DiagnosticCategory.Error, key: "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", message: "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated." }, - Import_0_from_1: { code: 90013, category: ts.DiagnosticCategory.Message, key: "Import_0_from_1_90013", message: "Import {0} from {1}." }, - Change_0_to_1: { code: 90014, category: ts.DiagnosticCategory.Message, key: "Change_0_to_1_90014", message: "Change {0} to {1}." }, - Add_0_to_existing_import_declaration_from_1: { code: 90015, category: ts.DiagnosticCategory.Message, key: "Add_0_to_existing_import_declaration_from_1_90015", message: "Add {0} to existing import declaration from {1}." }, - Declare_property_0: { code: 90016, category: ts.DiagnosticCategory.Message, key: "Declare_property_0_90016", message: "Declare property '{0}'." }, - Add_index_signature_for_property_0: { code: 90017, category: ts.DiagnosticCategory.Message, key: "Add_index_signature_for_property_0_90017", message: "Add index signature for property '{0}'." }, - Disable_checking_for_this_file: { code: 90018, category: ts.DiagnosticCategory.Message, key: "Disable_checking_for_this_file_90018", message: "Disable checking for this file." }, - Ignore_this_error_message: { code: 90019, category: ts.DiagnosticCategory.Message, key: "Ignore_this_error_message_90019", message: "Ignore this error message." }, - Initialize_property_0_in_the_constructor: { code: 90020, category: ts.DiagnosticCategory.Message, key: "Initialize_property_0_in_the_constructor_90020", message: "Initialize property '{0}' in the constructor." }, - Initialize_static_property_0: { code: 90021, category: ts.DiagnosticCategory.Message, key: "Initialize_static_property_0_90021", message: "Initialize static property '{0}'." }, - Change_spelling_to_0: { code: 90022, category: ts.DiagnosticCategory.Message, key: "Change_spelling_to_0_90022", message: "Change spelling to '{0}'." }, - Declare_method_0: { code: 90023, category: ts.DiagnosticCategory.Message, key: "Declare_method_0_90023", message: "Declare method '{0}'." }, - Declare_static_method_0: { code: 90024, category: ts.DiagnosticCategory.Message, key: "Declare_static_method_0_90024", message: "Declare static method '{0}'." }, - Prefix_0_with_an_underscore: { code: 90025, category: ts.DiagnosticCategory.Message, key: "Prefix_0_with_an_underscore_90025", message: "Prefix '{0}' with an underscore." }, - Convert_function_to_an_ES2015_class: { code: 95001, category: ts.DiagnosticCategory.Message, key: "Convert_function_to_an_ES2015_class_95001", message: "Convert function to an ES2015 class" }, - Convert_function_0_to_class: { code: 95002, category: ts.DiagnosticCategory.Message, key: "Convert_function_0_to_class_95002", message: "Convert function '{0}' to class" }, - Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: { code: 8017, category: ts.DiagnosticCategory.Error, key: "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", message: "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." }, - Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: { code: 8018, category: ts.DiagnosticCategory.Error, key: "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", message: "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'." }, - Report_errors_in_js_files: { code: 8019, category: ts.DiagnosticCategory.Message, key: "Report_errors_in_js_files_8019", message: "Report errors in .js files." }, - }; -})(ts || (ts = {})); -var ts; -(function (ts) { - function tokenIsIdentifierOrKeyword(token) { - return token >= 71; - } - ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; - var textToToken = ts.createMapFromTemplate({ - "abstract": 117, - "any": 119, - "as": 118, - "boolean": 122, - "break": 72, - "case": 73, - "catch": 74, - "class": 75, - "continue": 77, - "const": 76, - "constructor": 123, - "debugger": 78, - "declare": 124, - "default": 79, - "delete": 80, - "do": 81, - "else": 82, - "enum": 83, - "export": 84, - "extends": 85, - "false": 86, - "finally": 87, - "for": 88, - "from": 140, - "function": 89, - "get": 125, - "if": 90, - "implements": 108, - "import": 91, - "in": 92, - "instanceof": 93, - "interface": 109, - "is": 126, - "keyof": 127, - "let": 110, - "module": 128, - "namespace": 129, - "never": 130, - "new": 94, - "null": 95, - "number": 133, - "object": 134, - "package": 111, - "private": 112, - "protected": 113, - "public": 114, - "readonly": 131, - "require": 132, - "global": 141, - "return": 96, - "set": 135, - "static": 115, - "string": 136, - "super": 97, - "switch": 98, - "symbol": 137, - "this": 99, - "throw": 100, - "true": 101, - "try": 102, - "type": 138, - "typeof": 103, - "undefined": 139, - "var": 104, - "void": 105, - "while": 106, - "with": 107, - "yield": 116, - "async": 120, - "await": 121, - "of": 142, - "{": 17, - "}": 18, - "(": 19, - ")": 20, - "[": 21, - "]": 22, - ".": 23, - "...": 24, - ";": 25, - ",": 26, - "<": 27, - ">": 29, - "<=": 30, - ">=": 31, - "==": 32, - "!=": 33, - "===": 34, - "!==": 35, - "=>": 36, - "+": 37, - "-": 38, - "**": 40, - "*": 39, - "/": 41, - "%": 42, - "++": 43, - "--": 44, - "<<": 45, - "</": 28, - ">>": 46, - ">>>": 47, - "&": 48, - "|": 49, - "^": 50, - "!": 51, - "~": 52, - "&&": 53, - "||": 54, - "?": 55, - ":": 56, - "=": 58, - "+=": 59, - "-=": 60, - "*=": 61, - "**=": 62, - "/=": 63, - "%=": 64, - "<<=": 65, - ">>=": 66, - ">>>=": 67, - "&=": 68, - "|=": 69, - "^=": 70, - "@": 57, - }); - var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; - function lookupInUnicodeMap(code, map) { - if (code < map[0]) { - return false; - } - var lo = 0; - var hi = map.length; - var mid; - while (lo + 1 < hi) { - mid = lo + (hi - lo) / 2; - mid -= mid % 2; - if (map[mid] <= code && code <= map[mid + 1]) { - return true; - } - if (code < map[mid]) { - hi = mid; - } - else { - lo = mid + 2; - } - } - return false; - } - function isUnicodeIdentifierStart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierStart) : - lookupInUnicodeMap(code, unicodeES3IdentifierStart); + function diag(code, category, key, message) { + return { code: code, category: category, key: key, message: message }; } - ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; - function isUnicodeIdentifierPart(code, languageVersion) { - return languageVersion >= 1 ? - lookupInUnicodeMap(code, unicodeES5IdentifierPart) : - lookupInUnicodeMap(code, unicodeES3IdentifierPart); - } - function makeReverseMap(source) { - var result = []; - source.forEach(function (value, name) { - result[value] = name; - }); - return result; - } - var tokenStrings = makeReverseMap(textToToken); - function tokenToString(t) { - return tokenStrings[t]; - } - ts.tokenToString = tokenToString; - function stringToToken(s) { - return textToToken.get(s); - } - ts.stringToToken = stringToToken; - function computeLineStarts(text) { - var result = new Array(); - var pos = 0; - var lineStart = 0; - while (pos < text.length) { - var ch = text.charCodeAt(pos); - pos++; - switch (ch) { - case 13: - if (text.charCodeAt(pos) === 10) { - pos++; - } - case 10: - result.push(lineStart); - lineStart = pos; - break; - default: - if (ch > 127 && isLineBreak(ch)) { - result.push(lineStart); - lineStart = pos; - } - break; - } - } - result.push(lineStart); - return result; - } - ts.computeLineStarts = computeLineStarts; - function getPositionOfLineAndCharacter(sourceFile, line, character) { - return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); - } - ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; - function computePositionOfLineAndCharacter(lineStarts, line, character) { - ts.Debug.assert(line >= 0 && line < lineStarts.length); - return lineStarts[line] + character; - } - ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; - function getLineStarts(sourceFile) { - return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); - } - ts.getLineStarts = getLineStarts; - function computeLineAndCharacterOfPosition(lineStarts, position) { - var lineNumber = ts.binarySearch(lineStarts, position); - if (lineNumber < 0) { - lineNumber = ~lineNumber - 1; - ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file"); - } - return { - line: lineNumber, - character: position - lineStarts[lineNumber] - }; - } - ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; - function getLineAndCharacterOfPosition(sourceFile, position) { - return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); - } - ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; - function isWhiteSpaceLike(ch) { - return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); - } - ts.isWhiteSpaceLike = isWhiteSpaceLike; - function isWhiteSpaceSingleLine(ch) { - return ch === 32 || - ch === 9 || - ch === 11 || - ch === 12 || - ch === 160 || - ch === 133 || - ch === 5760 || - ch >= 8192 && ch <= 8203 || - ch === 8239 || - ch === 8287 || - ch === 12288 || - ch === 65279; - } - ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine; - function isLineBreak(ch) { - return ch === 10 || - ch === 13 || - ch === 8232 || - ch === 8233; - } - ts.isLineBreak = isLineBreak; - function isDigit(ch) { - return ch >= 48 && ch <= 57; - } - function isOctalDigit(ch) { - return ch >= 48 && ch <= 55; - } - ts.isOctalDigit = isOctalDigit; - function couldStartTrivia(text, pos) { - var ch = text.charCodeAt(pos); - switch (ch) { - case 13: - case 10: - case 9: - case 11: - case 12: - case 32: - case 47: - case 60: - case 124: - case 61: - case 62: - return true; - case 35: - return pos === 0; - default: - return ch > 127; - } - } - ts.couldStartTrivia = couldStartTrivia; - function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) { - if (stopAtComments === void 0) { stopAtComments = false; } - if (ts.positionIsSynthesized(pos)) { - return pos; - } - while (true) { - var ch = text.charCodeAt(pos); - switch (ch) { - case 13: - if (text.charCodeAt(pos + 1) === 10) { - pos++; - } - case 10: - pos++; - if (stopAfterLineBreak) { - return pos; - } - continue; - case 9: - case 11: - case 12: - case 32: - pos++; - continue; - case 47: - if (stopAtComments) { - break; - } - if (text.charCodeAt(pos + 1) === 47) { - pos += 2; - while (pos < text.length) { - if (isLineBreak(text.charCodeAt(pos))) { - break; - } - pos++; - } - continue; - } - if (text.charCodeAt(pos + 1) === 42) { - pos += 2; - while (pos < text.length) { - if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { - pos += 2; - break; - } - pos++; - } - continue; - } - break; - case 60: - case 124: - case 61: - case 62: - if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos); - continue; - } - break; - case 35: - if (pos === 0 && isShebangTrivia(text, pos)) { - pos = scanShebangTrivia(text, pos); - continue; - } - break; - default: - if (ch > 127 && (isWhiteSpaceLike(ch))) { - pos++; - continue; - } - break; - } - return pos; - } - } - ts.skipTrivia = skipTrivia; - var mergeConflictMarkerLength = "<<<<<<<".length; - function isConflictMarkerTrivia(text, pos) { - ts.Debug.assert(pos >= 0); - if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { - var ch = text.charCodeAt(pos); - if ((pos + mergeConflictMarkerLength) < text.length) { - for (var i = 0; i < mergeConflictMarkerLength; i++) { - if (text.charCodeAt(pos + i) !== ch) { - return false; - } - } - return ch === 61 || - text.charCodeAt(pos + mergeConflictMarkerLength) === 32; - } - } - return false; - } - function scanConflictMarkerTrivia(text, pos, error) { - if (error) { - error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength); - } - var ch = text.charCodeAt(pos); - var len = text.length; - if (ch === 60 || ch === 62) { - while (pos < len && !isLineBreak(text.charCodeAt(pos))) { - pos++; - } - } - else { - ts.Debug.assert(ch === 124 || ch === 61); - while (pos < len) { - var currentChar = text.charCodeAt(pos); - if ((currentChar === 61 || currentChar === 62) && currentChar !== ch && isConflictMarkerTrivia(text, pos)) { - break; - } - pos++; - } - } - return pos; - } - var shebangTriviaRegex = /^#!.*/; - function isShebangTrivia(text, pos) { - ts.Debug.assert(pos === 0); - return shebangTriviaRegex.test(text); - } - function scanShebangTrivia(text, pos) { - var shebang = shebangTriviaRegex.exec(text)[0]; - pos = pos + shebang.length; - return pos; - } - function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) { - var pendingPos; - var pendingEnd; - var pendingKind; - var pendingHasTrailingNewLine; - var hasPendingCommentRange = false; - var collecting = trailing || pos === 0; - var accumulator = initial; - scan: while (pos >= 0 && pos < text.length) { - var ch = text.charCodeAt(pos); - switch (ch) { - case 13: - if (text.charCodeAt(pos + 1) === 10) { - pos++; - } - case 10: - pos++; - if (trailing) { - break scan; - } - collecting = true; - if (hasPendingCommentRange) { - pendingHasTrailingNewLine = true; - } - continue; - case 9: - case 11: - case 12: - case 32: - pos++; - continue; - case 47: - var nextChar = text.charCodeAt(pos + 1); - var hasTrailingNewLine = false; - if (nextChar === 47 || nextChar === 42) { - var kind = nextChar === 47 ? 2 : 3; - var startPos = pos; - pos += 2; - if (nextChar === 47) { - while (pos < text.length) { - if (isLineBreak(text.charCodeAt(pos))) { - hasTrailingNewLine = true; - break; - } - pos++; - } - } - else { - while (pos < text.length) { - if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { - pos += 2; - break; - } - pos++; - } - } - if (collecting) { - if (hasPendingCommentRange) { - accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); - if (!reduce && accumulator) { - return accumulator; - } - hasPendingCommentRange = false; - } - pendingPos = startPos; - pendingEnd = pos; - pendingKind = kind; - pendingHasTrailingNewLine = hasTrailingNewLine; - hasPendingCommentRange = true; - } - continue; - } - break scan; - default: - if (ch > 127 && (isWhiteSpaceLike(ch))) { - if (hasPendingCommentRange && isLineBreak(ch)) { - pendingHasTrailingNewLine = true; - } - pos++; - continue; - } - break scan; - } - } - if (hasPendingCommentRange) { - accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); - } - return accumulator; - } - function forEachLeadingCommentRange(text, pos, cb, state) { - return iterateCommentRanges(false, text, pos, false, cb, state); - } - ts.forEachLeadingCommentRange = forEachLeadingCommentRange; - function forEachTrailingCommentRange(text, pos, cb, state) { - return iterateCommentRanges(false, text, pos, true, cb, state); - } - ts.forEachTrailingCommentRange = forEachTrailingCommentRange; - function reduceEachLeadingCommentRange(text, pos, cb, state, initial) { - return iterateCommentRanges(true, text, pos, false, cb, state, initial); - } - ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange; - function reduceEachTrailingCommentRange(text, pos, cb, state, initial) { - return iterateCommentRanges(true, text, pos, true, cb, state, initial); - } - ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange; - function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) { - if (!comments) { - comments = []; - } - comments.push({ kind: kind, pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine }); - return comments; - } - function getLeadingCommentRanges(text, pos) { - return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined); - } - ts.getLeadingCommentRanges = getLeadingCommentRanges; - function getTrailingCommentRanges(text, pos) { - return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined); - } - ts.getTrailingCommentRanges = getTrailingCommentRanges; - function getShebang(text) { - var match = shebangTriviaRegex.exec(text); - if (match) { - return match[0]; - } - } - ts.getShebang = getShebang; - function isIdentifierStart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); - } - ts.isIdentifierStart = isIdentifierStart; - function isIdentifierPart(ch, languageVersion) { - return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || - ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || - ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); - } - ts.isIdentifierPart = isIdentifierPart; - function isIdentifierText(name, languageVersion) { - if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { - return false; - } - for (var i = 1; i < name.length; i++) { - if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { - return false; - } - } - return true; - } - ts.isIdentifierText = isIdentifierText; - function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { - if (languageVariant === void 0) { languageVariant = 0; } - var pos; - var end; - var startPos; - var tokenPos; - var token; - var tokenValue; - var precedingLineBreak; - var hasExtendedUnicodeEscape; - var tokenIsUnterminated; - var numericLiteralFlags; - setText(text, start, length); - return { - getStartPos: function () { return startPos; }, - getTextPos: function () { return pos; }, - getToken: function () { return token; }, - getTokenPos: function () { return tokenPos; }, - getTokenText: function () { return text.substring(tokenPos, pos); }, - getTokenValue: function () { return tokenValue; }, - hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, - hasPrecedingLineBreak: function () { return precedingLineBreak; }, - isIdentifier: function () { return token === 71 || token > 107; }, - isReservedWord: function () { return token >= 72 && token <= 107; }, - isUnterminated: function () { return tokenIsUnterminated; }, - getNumericLiteralFlags: function () { return numericLiteralFlags; }, - reScanGreaterToken: reScanGreaterToken, - reScanSlashToken: reScanSlashToken, - reScanTemplateToken: reScanTemplateToken, - scanJsxIdentifier: scanJsxIdentifier, - scanJsxAttributeValue: scanJsxAttributeValue, - reScanJsxToken: reScanJsxToken, - scanJsxToken: scanJsxToken, - scanJSDocToken: scanJSDocToken, - scan: scan, - getText: getText, - setText: setText, - setScriptTarget: setScriptTarget, - setLanguageVariant: setLanguageVariant, - setOnError: setOnError, - setTextPos: setTextPos, - tryScan: tryScan, - lookAhead: lookAhead, - scanRange: scanRange, - }; - function error(message, length) { - if (onError) { - onError(message, length || 0); - } - } - function scanNumber() { - var start = pos; - while (isDigit(text.charCodeAt(pos))) - pos++; - if (text.charCodeAt(pos) === 46) { - pos++; - while (isDigit(text.charCodeAt(pos))) - pos++; - } - var end = pos; - if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { - pos++; - numericLiteralFlags = 2; - if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) - pos++; - if (isDigit(text.charCodeAt(pos))) { - pos++; - while (isDigit(text.charCodeAt(pos))) - pos++; - end = pos; - } - else { - error(ts.Diagnostics.Digit_expected); - } - } - return "" + +(text.substring(start, end)); - } - function scanOctalDigits() { - var start = pos; - while (isOctalDigit(text.charCodeAt(pos))) { - pos++; - } - return +(text.substring(start, pos)); - } - function scanExactNumberOfHexDigits(count) { - return scanHexDigits(count, false); - } - function scanMinimumNumberOfHexDigits(count) { - return scanHexDigits(count, true); - } - function scanHexDigits(minCount, scanAsManyAsPossible) { - var digits = 0; - var value = 0; - while (digits < minCount || scanAsManyAsPossible) { - var ch = text.charCodeAt(pos); - if (ch >= 48 && ch <= 57) { - value = value * 16 + ch - 48; - } - else if (ch >= 65 && ch <= 70) { - value = value * 16 + ch - 65 + 10; - } - else if (ch >= 97 && ch <= 102) { - value = value * 16 + ch - 97 + 10; - } - else { - break; - } - pos++; - digits++; - } - if (digits < minCount) { - value = -1; - } - return value; - } - function scanString(allowEscapes) { - if (allowEscapes === void 0) { allowEscapes = true; } - var quote = text.charCodeAt(pos); - pos++; - var result = ""; - var start = pos; - while (true) { - if (pos >= end) { - result += text.substring(start, pos); - tokenIsUnterminated = true; - error(ts.Diagnostics.Unterminated_string_literal); - break; - } - var ch = text.charCodeAt(pos); - if (ch === quote) { - result += text.substring(start, pos); - pos++; - break; - } - if (ch === 92 && allowEscapes) { - result += text.substring(start, pos); - result += scanEscapeSequence(); - start = pos; - continue; - } - if (isLineBreak(ch)) { - result += text.substring(start, pos); - tokenIsUnterminated = true; - error(ts.Diagnostics.Unterminated_string_literal); - break; - } - pos++; - } - return result; - } - function scanTemplateAndSetTokenValue() { - var startedWithBacktick = text.charCodeAt(pos) === 96; - pos++; - var start = pos; - var contents = ""; - var resultingToken; - while (true) { - if (pos >= end) { - contents += text.substring(start, pos); - tokenIsUnterminated = true; - error(ts.Diagnostics.Unterminated_template_literal); - resultingToken = startedWithBacktick ? 13 : 16; - break; - } - var currChar = text.charCodeAt(pos); - if (currChar === 96) { - contents += text.substring(start, pos); - pos++; - resultingToken = startedWithBacktick ? 13 : 16; - break; - } - if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) { - contents += text.substring(start, pos); - pos += 2; - resultingToken = startedWithBacktick ? 14 : 15; - break; - } - if (currChar === 92) { - contents += text.substring(start, pos); - contents += scanEscapeSequence(); - start = pos; - continue; - } - if (currChar === 13) { - contents += text.substring(start, pos); - pos++; - if (pos < end && text.charCodeAt(pos) === 10) { - pos++; - } - contents += "\n"; - start = pos; - continue; - } - pos++; - } - ts.Debug.assert(resultingToken !== undefined); - tokenValue = contents; - return resultingToken; - } - function scanEscapeSequence() { - pos++; - if (pos >= end) { - error(ts.Diagnostics.Unexpected_end_of_text); - return ""; - } - var ch = text.charCodeAt(pos); - pos++; - switch (ch) { - case 48: - return "\0"; - case 98: - return "\b"; - case 116: - return "\t"; - case 110: - return "\n"; - case 118: - return "\v"; - case 102: - return "\f"; - case 114: - return "\r"; - case 39: - return "\'"; - case 34: - return "\""; - case 117: - if (pos < end && text.charCodeAt(pos) === 123) { - hasExtendedUnicodeEscape = true; - pos++; - return scanExtendedUnicodeEscape(); - } - return scanHexadecimalEscape(4); - case 120: - return scanHexadecimalEscape(2); - case 13: - if (pos < end && text.charCodeAt(pos) === 10) { - pos++; - } - case 10: - case 8232: - case 8233: - return ""; - default: - return String.fromCharCode(ch); - } - } - function scanHexadecimalEscape(numDigits) { - var escapedValue = scanExactNumberOfHexDigits(numDigits); - if (escapedValue >= 0) { - return String.fromCharCode(escapedValue); - } - else { - error(ts.Diagnostics.Hexadecimal_digit_expected); - return ""; - } - } - function scanExtendedUnicodeEscape() { - var escapedValue = scanMinimumNumberOfHexDigits(1); - var isInvalidExtendedEscape = false; - if (escapedValue < 0) { - error(ts.Diagnostics.Hexadecimal_digit_expected); - isInvalidExtendedEscape = true; - } - else if (escapedValue > 0x10FFFF) { - error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); - isInvalidExtendedEscape = true; - } - if (pos >= end) { - error(ts.Diagnostics.Unexpected_end_of_text); - isInvalidExtendedEscape = true; - } - else if (text.charCodeAt(pos) === 125) { - pos++; - } - else { - error(ts.Diagnostics.Unterminated_Unicode_escape_sequence); - isInvalidExtendedEscape = true; - } - if (isInvalidExtendedEscape) { - return ""; - } - return utf16EncodeAsString(escapedValue); - } - function utf16EncodeAsString(codePoint) { - ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF); - if (codePoint <= 65535) { - return String.fromCharCode(codePoint); - } - var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800; - var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00; - return String.fromCharCode(codeUnit1, codeUnit2); - } - function peekUnicodeEscape() { - if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) { - var start_1 = pos; - pos += 2; - var value = scanExactNumberOfHexDigits(4); - pos = start_1; - return value; - } - return -1; - } - function scanIdentifierParts() { - var result = ""; - var start = pos; - while (pos < end) { - var ch = text.charCodeAt(pos); - if (isIdentifierPart(ch, languageVersion)) { - pos++; - } - else if (ch === 92) { - ch = peekUnicodeEscape(); - if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { - break; - } - result += text.substring(start, pos); - result += String.fromCharCode(ch); - pos += 6; - start = pos; - } - else { - break; - } - } - result += text.substring(start, pos); - return result; - } - function getIdentifierToken() { - var len = tokenValue.length; - if (len >= 2 && len <= 11) { - var ch = tokenValue.charCodeAt(0); - if (ch >= 97 && ch <= 122) { - token = textToToken.get(tokenValue); - if (token !== undefined) { - return token; - } - } - } - return token = 71; - } - function scanBinaryOrOctalDigits(base) { - ts.Debug.assert(base === 2 || base === 8, "Expected either base 2 or base 8"); - var value = 0; - var numberOfDigits = 0; - while (true) { - var ch = text.charCodeAt(pos); - var valueOfCh = ch - 48; - if (!isDigit(ch) || valueOfCh >= base) { - break; - } - value = value * base + valueOfCh; - pos++; - numberOfDigits++; - } - if (numberOfDigits === 0) { - return -1; - } - return value; - } - function scan() { - startPos = pos; - hasExtendedUnicodeEscape = false; - precedingLineBreak = false; - tokenIsUnterminated = false; - numericLiteralFlags = 0; - while (true) { - tokenPos = pos; - if (pos >= end) { - return token = 1; - } - var ch = text.charCodeAt(pos); - if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) { - pos = scanShebangTrivia(text, pos); - if (skipTrivia) { - continue; - } - else { - return token = 6; - } - } - switch (ch) { - case 10: - case 13: - precedingLineBreak = true; - if (skipTrivia) { - pos++; - continue; - } - else { - if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) { - pos += 2; - } - else { - pos++; - } - return token = 4; - } - case 9: - case 11: - case 12: - case 32: - if (skipTrivia) { - pos++; - continue; - } - else { - while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) { - pos++; - } - return token = 5; - } - case 33: - if (text.charCodeAt(pos + 1) === 61) { - if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 35; - } - return pos += 2, token = 33; - } - pos++; - return token = 51; - case 34: - case 39: - tokenValue = scanString(); - return token = 9; - case 96: - return token = scanTemplateAndSetTokenValue(); - case 37: - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 64; - } - pos++; - return token = 42; - case 38: - if (text.charCodeAt(pos + 1) === 38) { - return pos += 2, token = 53; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 68; - } - pos++; - return token = 48; - case 40: - pos++; - return token = 19; - case 41: - pos++; - return token = 20; - case 42: - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 61; - } - if (text.charCodeAt(pos + 1) === 42) { - if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 62; - } - return pos += 2, token = 40; - } - pos++; - return token = 39; - case 43: - if (text.charCodeAt(pos + 1) === 43) { - return pos += 2, token = 43; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 59; - } - pos++; - return token = 37; - case 44: - pos++; - return token = 26; - case 45: - if (text.charCodeAt(pos + 1) === 45) { - return pos += 2, token = 44; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 60; - } - pos++; - return token = 38; - case 46: - if (isDigit(text.charCodeAt(pos + 1))) { - tokenValue = scanNumber(); - return token = 8; - } - if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { - return pos += 3, token = 24; - } - pos++; - return token = 23; - case 47: - if (text.charCodeAt(pos + 1) === 47) { - pos += 2; - while (pos < end) { - if (isLineBreak(text.charCodeAt(pos))) { - break; - } - pos++; - } - if (skipTrivia) { - continue; - } - else { - return token = 2; - } - } - if (text.charCodeAt(pos + 1) === 42) { - pos += 2; - var commentClosed = false; - while (pos < end) { - var ch_1 = text.charCodeAt(pos); - if (ch_1 === 42 && text.charCodeAt(pos + 1) === 47) { - pos += 2; - commentClosed = true; - break; - } - if (isLineBreak(ch_1)) { - precedingLineBreak = true; - } - pos++; - } - if (!commentClosed) { - error(ts.Diagnostics.Asterisk_Slash_expected); - } - if (skipTrivia) { - continue; - } - else { - tokenIsUnterminated = !commentClosed; - return token = 3; - } - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 63; - } - pos++; - return token = 41; - case 48: - if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { - pos += 2; - var value = scanMinimumNumberOfHexDigits(1); - if (value < 0) { - error(ts.Diagnostics.Hexadecimal_digit_expected); - value = 0; - } - tokenValue = "" + value; - numericLiteralFlags = 8; - return token = 8; - } - else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { - pos += 2; - var value = scanBinaryOrOctalDigits(2); - if (value < 0) { - error(ts.Diagnostics.Binary_digit_expected); - value = 0; - } - tokenValue = "" + value; - numericLiteralFlags = 16; - return token = 8; - } - else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { - pos += 2; - var value = scanBinaryOrOctalDigits(8); - if (value < 0) { - error(ts.Diagnostics.Octal_digit_expected); - value = 0; - } - tokenValue = "" + value; - numericLiteralFlags = 32; - return token = 8; - } - if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { - tokenValue = "" + scanOctalDigits(); - numericLiteralFlags = 4; - return token = 8; - } - case 49: - case 50: - case 51: - case 52: - case 53: - case 54: - case 55: - case 56: - case 57: - tokenValue = scanNumber(); - return token = 8; - case 58: - pos++; - return token = 56; - case 59: - pos++; - return token = 25; - case 60: - if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); - if (skipTrivia) { - continue; - } - else { - return token = 7; - } - } - if (text.charCodeAt(pos + 1) === 60) { - if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 65; - } - return pos += 2, token = 45; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 30; - } - if (languageVariant === 1 && - text.charCodeAt(pos + 1) === 47 && - text.charCodeAt(pos + 2) !== 42) { - return pos += 2, token = 28; - } - pos++; - return token = 27; - case 61: - if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); - if (skipTrivia) { - continue; - } - else { - return token = 7; - } - } - if (text.charCodeAt(pos + 1) === 61) { - if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 34; - } - return pos += 2, token = 32; - } - if (text.charCodeAt(pos + 1) === 62) { - return pos += 2, token = 36; - } - pos++; - return token = 58; - case 62: - if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); - if (skipTrivia) { - continue; - } - else { - return token = 7; - } - } - pos++; - return token = 29; - case 63: - pos++; - return token = 55; - case 91: - pos++; - return token = 21; - case 93: - pos++; - return token = 22; - case 94: - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 70; - } - pos++; - return token = 50; - case 123: - pos++; - return token = 17; - case 124: - if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); - if (skipTrivia) { - continue; - } - else { - return token = 7; - } - } - if (text.charCodeAt(pos + 1) === 124) { - return pos += 2, token = 54; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 69; - } - pos++; - return token = 49; - case 125: - pos++; - return token = 18; - case 126: - pos++; - return token = 52; - case 64: - pos++; - return token = 57; - case 92: - var cookedChar = peekUnicodeEscape(); - if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { - pos += 6; - tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); - return token = getIdentifierToken(); - } - error(ts.Diagnostics.Invalid_character); - pos++; - return token = 0; - default: - if (isIdentifierStart(ch, languageVersion)) { - pos++; - while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) - pos++; - tokenValue = text.substring(tokenPos, pos); - if (ch === 92) { - tokenValue += scanIdentifierParts(); - } - return token = getIdentifierToken(); - } - else if (isWhiteSpaceSingleLine(ch)) { - pos++; - continue; - } - else if (isLineBreak(ch)) { - precedingLineBreak = true; - pos++; - continue; - } - error(ts.Diagnostics.Invalid_character); - pos++; - return token = 0; - } - } - } - function reScanGreaterToken() { - if (token === 29) { - if (text.charCodeAt(pos) === 62) { - if (text.charCodeAt(pos + 1) === 62) { - if (text.charCodeAt(pos + 2) === 61) { - return pos += 3, token = 67; - } - return pos += 2, token = 47; - } - if (text.charCodeAt(pos + 1) === 61) { - return pos += 2, token = 66; - } - pos++; - return token = 46; - } - if (text.charCodeAt(pos) === 61) { - pos++; - return token = 31; - } - } - return token; - } - function reScanSlashToken() { - if (token === 41 || token === 63) { - var p = tokenPos + 1; - var inEscape = false; - var inCharacterClass = false; - while (true) { - if (p >= end) { - tokenIsUnterminated = true; - error(ts.Diagnostics.Unterminated_regular_expression_literal); - break; - } - var ch = text.charCodeAt(p); - if (isLineBreak(ch)) { - tokenIsUnterminated = true; - error(ts.Diagnostics.Unterminated_regular_expression_literal); - break; - } - if (inEscape) { - inEscape = false; - } - else if (ch === 47 && !inCharacterClass) { - p++; - break; - } - else if (ch === 91) { - inCharacterClass = true; - } - else if (ch === 92) { - inEscape = true; - } - else if (ch === 93) { - inCharacterClass = false; - } - p++; - } - while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { - p++; - } - pos = p; - tokenValue = text.substring(tokenPos, pos); - token = 12; - } - return token; - } - function reScanTemplateToken() { - ts.Debug.assert(token === 18, "'reScanTemplateToken' should only be called on a '}'"); - pos = tokenPos; - return token = scanTemplateAndSetTokenValue(); - } - function reScanJsxToken() { - pos = tokenPos = startPos; - return token = scanJsxToken(); - } - function scanJsxToken() { - startPos = tokenPos = pos; - if (pos >= end) { - return token = 1; - } - var char = text.charCodeAt(pos); - if (char === 60) { - if (text.charCodeAt(pos + 1) === 47) { - pos += 2; - return token = 28; - } - pos++; - return token = 27; - } - if (char === 123) { - pos++; - return token = 17; - } - var firstNonWhitespace = 0; - while (pos < end) { - char = text.charCodeAt(pos); - if (char === 123) { - break; - } - if (char === 60) { - if (isConflictMarkerTrivia(text, pos)) { - pos = scanConflictMarkerTrivia(text, pos, error); - return token = 7; - } - break; - } - if (isLineBreak(char) && firstNonWhitespace === 0) { - firstNonWhitespace = -1; - } - else if (!isWhiteSpaceLike(char)) { - firstNonWhitespace = pos; - } - pos++; - } - return firstNonWhitespace === -1 ? 11 : 10; - } - function scanJsxIdentifier() { - if (tokenIsIdentifierOrKeyword(token)) { - var firstCharPosition = pos; - while (pos < end) { - var ch = text.charCodeAt(pos); - if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) { - pos++; - } - else { - break; - } - } - tokenValue += text.substr(firstCharPosition, pos - firstCharPosition); - } - return token; - } - function scanJsxAttributeValue() { - startPos = pos; - switch (text.charCodeAt(pos)) { - case 34: - case 39: - tokenValue = scanString(false); - return token = 9; - default: - return scan(); - } - } - function scanJSDocToken() { - if (pos >= end) { - return token = 1; - } - startPos = pos; - tokenPos = pos; - var ch = text.charCodeAt(pos); - switch (ch) { - case 9: - case 11: - case 12: - case 32: - while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) { - pos++; - } - return token = 5; - case 64: - pos++; - return token = 57; - case 10: - case 13: - pos++; - return token = 4; - case 42: - pos++; - return token = 39; - case 123: - pos++; - return token = 17; - case 125: - pos++; - return token = 18; - case 91: - pos++; - return token = 21; - case 93: - pos++; - return token = 22; - case 61: - pos++; - return token = 58; - case 44: - pos++; - return token = 26; - case 46: - pos++; - return token = 23; - } - if (isIdentifierStart(ch, 5)) { - pos++; - while (isIdentifierPart(text.charCodeAt(pos), 5) && pos < end) { - pos++; - } - return token = 71; - } - else { - return pos += 1, token = 0; - } - } - function speculationHelper(callback, isLookahead) { - var savePos = pos; - var saveStartPos = startPos; - var saveTokenPos = tokenPos; - var saveToken = token; - var saveTokenValue = tokenValue; - var savePrecedingLineBreak = precedingLineBreak; - var result = callback(); - if (!result || isLookahead) { - pos = savePos; - startPos = saveStartPos; - tokenPos = saveTokenPos; - token = saveToken; - tokenValue = saveTokenValue; - precedingLineBreak = savePrecedingLineBreak; - } - return result; - } - function scanRange(start, length, callback) { - var saveEnd = end; - var savePos = pos; - var saveStartPos = startPos; - var saveTokenPos = tokenPos; - var saveToken = token; - var savePrecedingLineBreak = precedingLineBreak; - var saveTokenValue = tokenValue; - var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape; - var saveTokenIsUnterminated = tokenIsUnterminated; - setText(text, start, length); - var result = callback(); - end = saveEnd; - pos = savePos; - startPos = saveStartPos; - tokenPos = saveTokenPos; - token = saveToken; - precedingLineBreak = savePrecedingLineBreak; - tokenValue = saveTokenValue; - hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape; - tokenIsUnterminated = saveTokenIsUnterminated; - return result; - } - function lookAhead(callback) { - return speculationHelper(callback, true); - } - function tryScan(callback) { - return speculationHelper(callback, false); - } - function getText() { - return text; - } - function setText(newText, start, length) { - text = newText || ""; - end = length === undefined ? text.length : start + length; - setTextPos(start || 0); - } - function setOnError(errorCallback) { - onError = errorCallback; - } - function setScriptTarget(scriptTarget) { - languageVersion = scriptTarget; - } - function setLanguageVariant(variant) { - languageVariant = variant; - } - function setTextPos(textPos) { - ts.Debug.assert(textPos >= 0); - pos = textPos; - startPos = textPos; - tokenPos = textPos; - token = 0; - precedingLineBreak = false; - tokenValue = undefined; - hasExtendedUnicodeEscape = false; - tokenIsUnterminated = false; - } - } - ts.createScanner = createScanner; -})(ts || (ts = {})); -var ts; -(function (ts) { - ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" }; - ts.optionDeclarations = [ - { - name: "help", - shortName: "h", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Command_line_Options, - description: ts.Diagnostics.Print_this_message, - }, - { - name: "help", - shortName: "?", - type: "boolean" - }, - { - name: "all", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Command_line_Options, - description: ts.Diagnostics.Show_all_compiler_options, - }, - { - name: "version", - shortName: "v", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Command_line_Options, - description: ts.Diagnostics.Print_the_compiler_s_version, - }, - { - name: "init", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Command_line_Options, - description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, - }, - { - name: "project", - shortName: "p", - type: "string", - isFilePath: true, - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Command_line_Options, - paramType: ts.Diagnostics.FILE_OR_DIRECTORY, - description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, - }, - { - name: "pretty", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Command_line_Options, - description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental - }, - { - name: "watch", - shortName: "w", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Command_line_Options, - description: ts.Diagnostics.Watch_input_files, - }, - { - name: "target", - shortName: "t", - type: ts.createMapFromTemplate({ - "es3": 0, - "es5": 1, - "es6": 2, - "es2015": 2, - "es2016": 3, - "es2017": 4, - "esnext": 5, - }), - paramType: ts.Diagnostics.VERSION, - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, - }, - { - name: "module", - shortName: "m", - type: ts.createMapFromTemplate({ - "none": ts.ModuleKind.None, - "commonjs": ts.ModuleKind.CommonJS, - "amd": ts.ModuleKind.AMD, - "system": ts.ModuleKind.System, - "umd": ts.ModuleKind.UMD, - "es6": ts.ModuleKind.ES2015, - "es2015": ts.ModuleKind.ES2015, - "esnext": ts.ModuleKind.ESNext - }), - paramType: ts.Diagnostics.KIND, - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Specify_module_code_generation_Colon_commonjs_amd_system_umd_es2015_or_ESNext, - }, - { - name: "lib", - type: "list", - element: { - name: "lib", - type: ts.createMapFromTemplate({ - "es5": "lib.es5.d.ts", - "es6": "lib.es2015.d.ts", - "es2015": "lib.es2015.d.ts", - "es7": "lib.es2016.d.ts", - "es2016": "lib.es2016.d.ts", - "es2017": "lib.es2017.d.ts", - "esnext": "lib.esnext.d.ts", - "dom": "lib.dom.d.ts", - "dom.iterable": "lib.dom.iterable.d.ts", - "webworker": "lib.webworker.d.ts", - "scripthost": "lib.scripthost.d.ts", - "es2015.core": "lib.es2015.core.d.ts", - "es2015.collection": "lib.es2015.collection.d.ts", - "es2015.generator": "lib.es2015.generator.d.ts", - "es2015.iterable": "lib.es2015.iterable.d.ts", - "es2015.promise": "lib.es2015.promise.d.ts", - "es2015.proxy": "lib.es2015.proxy.d.ts", - "es2015.reflect": "lib.es2015.reflect.d.ts", - "es2015.symbol": "lib.es2015.symbol.d.ts", - "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", - "es2016.array.include": "lib.es2016.array.include.d.ts", - "es2017.object": "lib.es2017.object.d.ts", - "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", - "es2017.string": "lib.es2017.string.d.ts", - "es2017.intl": "lib.es2017.intl.d.ts", - "esnext.asynciterable": "lib.esnext.asynciterable.d.ts", - }), - }, - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon - }, - { - name: "allowJs", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Allow_javascript_files_to_be_compiled - }, - { - name: "checkJs", - type: "boolean", - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Report_errors_in_js_files - }, - { - name: "jsx", - type: ts.createMapFromTemplate({ - "preserve": 1, - "react-native": 3, - "react": 2 - }), - paramType: ts.Diagnostics.KIND, - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, - }, - { - name: "declaration", - shortName: "d", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Generates_corresponding_d_ts_file, - }, - { - name: "sourceMap", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Generates_corresponding_map_file, - }, - { - name: "outFile", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.FILE, - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, - }, - { - name: "outDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.DIRECTORY, - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Redirect_output_structure_to_the_directory, - }, - { - name: "rootDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.LOCATION, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, - }, - { - name: "removeComments", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Do_not_emit_comments_to_output, - }, - { - name: "noEmit", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Do_not_emit_outputs, - }, - { - name: "importHelpers", - type: "boolean", - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Import_emit_helpers_from_tslib - }, - { - name: "downlevelIteration", - type: "boolean", - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 - }, - { - name: "isolatedModules", - type: "boolean", - category: ts.Diagnostics.Basic_Options, - description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule - }, - { - name: "strict", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Strict_Type_Checking_Options, - description: ts.Diagnostics.Enable_all_strict_type_checking_options - }, - { - name: "noImplicitAny", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Strict_Type_Checking_Options, - description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, - }, - { - name: "strictNullChecks", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Strict_Type_Checking_Options, - description: ts.Diagnostics.Enable_strict_null_checks - }, - { - name: "noImplicitThis", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Strict_Type_Checking_Options, - description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, - }, - { - name: "alwaysStrict", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Strict_Type_Checking_Options, - description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file - }, - { - name: "noUnusedLocals", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Additional_Checks, - description: ts.Diagnostics.Report_errors_on_unused_locals, - }, - { - name: "noUnusedParameters", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Additional_Checks, - description: ts.Diagnostics.Report_errors_on_unused_parameters, - }, - { - name: "noImplicitReturns", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Additional_Checks, - description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value - }, - { - name: "noFallthroughCasesInSwitch", - type: "boolean", - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Additional_Checks, - description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement - }, - { - name: "moduleResolution", - type: ts.createMapFromTemplate({ - "node": ts.ModuleResolutionKind.NodeJs, - "classic": ts.ModuleResolutionKind.Classic, - }), - paramType: ts.Diagnostics.STRATEGY, - category: ts.Diagnostics.Module_Resolution_Options, - description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, - }, - { - name: "baseUrl", - type: "string", - isFilePath: true, - category: ts.Diagnostics.Module_Resolution_Options, - description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names - }, - { - name: "paths", - type: "object", - isTSConfigOnly: true, - category: ts.Diagnostics.Module_Resolution_Options, - description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl - }, - { - name: "rootDirs", - type: "list", - isTSConfigOnly: true, - element: { - name: "rootDirs", - type: "string", - isFilePath: true - }, - category: ts.Diagnostics.Module_Resolution_Options, - description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime - }, - { - name: "typeRoots", - type: "list", - element: { - name: "typeRoots", - type: "string", - isFilePath: true - }, - category: ts.Diagnostics.Module_Resolution_Options, - description: ts.Diagnostics.List_of_folders_to_include_type_definitions_from - }, - { - name: "types", - type: "list", - element: { - name: "types", - type: "string" - }, - showInSimplifiedHelpView: true, - category: ts.Diagnostics.Module_Resolution_Options, - description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation - }, - { - name: "allowSyntheticDefaultImports", - type: "boolean", - category: ts.Diagnostics.Module_Resolution_Options, - description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking - }, - { - name: "sourceRoot", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.LOCATION, - category: ts.Diagnostics.Source_Map_Options, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, - }, - { - name: "mapRoot", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.LOCATION, - category: ts.Diagnostics.Source_Map_Options, - description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, - }, - { - name: "inlineSourceMap", - type: "boolean", - category: ts.Diagnostics.Source_Map_Options, - description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file - }, - { - name: "inlineSources", - type: "boolean", - category: ts.Diagnostics.Source_Map_Options, - description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set - }, - { - name: "experimentalDecorators", - type: "boolean", - category: ts.Diagnostics.Experimental_Options, - description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators - }, - { - name: "emitDecoratorMetadata", - type: "boolean", - category: ts.Diagnostics.Experimental_Options, - description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators - }, - { - name: "jsxFactory", - type: "string", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h - }, - { - name: "diagnostics", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Show_diagnostic_information - }, - { - name: "extendedDiagnostics", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Show_verbose_diagnostic_information - }, - { - name: "traceResolution", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process - }, - { - name: "listFiles", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Print_names_of_files_part_of_the_compilation - }, - { - name: "listEmittedFiles", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Print_names_of_generated_files_part_of_the_compilation - }, - { - name: "out", - type: "string", - isFilePath: false, - category: ts.Diagnostics.Advanced_Options, - paramType: ts.Diagnostics.FILE, - description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file, - }, - { - name: "reactNamespace", - type: "string", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit - }, - { - name: "skipDefaultLibCheck", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files - }, - { - name: "charset", - type: "string", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.The_character_set_of_the_input_files - }, - { - name: "emitBOM", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files - }, - { - name: "locale", - type: "string", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us - }, - { - name: "newLine", - type: ts.createMapFromTemplate({ - "crlf": 0, - "lf": 1 - }), - paramType: ts.Diagnostics.NEWLINE, - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, - }, - { - name: "noErrorTruncation", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Do_not_truncate_error_messages - }, - { - name: "noLib", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts - }, - { - name: "noResolve", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files - }, - { - name: "stripInternal", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, - }, - { - name: "disableSizeLimit", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Disable_size_limitations_on_JavaScript_projects - }, - { - name: "noImplicitUseStrict", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output - }, - { - name: "noEmitHelpers", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output - }, - { - name: "noEmitOnError", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, - }, - { - name: "preserveConstEnums", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code - }, - { - name: "declarationDir", - type: "string", - isFilePath: true, - paramType: ts.Diagnostics.DIRECTORY, - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Output_directory_for_generated_declaration_files - }, - { - name: "skipLibCheck", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Skip_type_checking_of_declaration_files, - }, - { - name: "allowUnusedLabels", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Do_not_report_errors_on_unused_labels - }, - { - name: "allowUnreachableCode", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code - }, - { - name: "suppressExcessPropertyErrors", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, - }, - { - name: "suppressImplicitAnyIndexErrors", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, - }, - { - name: "forceConsistentCasingInFileNames", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file - }, - { - name: "maxNodeModuleJsDepth", - type: "number", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files - }, - { - name: "noStrictGenericChecks", - type: "boolean", - category: ts.Diagnostics.Advanced_Options, - description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types, - }, - { - name: "plugins", - type: "list", - isTSConfigOnly: true, - element: { - name: "plugin", - type: "object" - }, - description: ts.Diagnostics.List_of_language_service_plugins - } - ]; - ts.typeAcquisitionDeclarations = [ - { - name: "enableAutoDiscovery", - type: "boolean", - }, - { - name: "enable", - type: "boolean", - }, - { - name: "include", - type: "list", - element: { - name: "include", - type: "string" - } - }, - { - name: "exclude", - type: "list", - element: { - name: "exclude", - type: "string" - } - } - ]; - ts.defaultInitCompilerOptions = { - module: ts.ModuleKind.CommonJS, - target: 1, - strict: true + ts.Diagnostics = { + Unterminated_string_literal: diag(1002, ts.DiagnosticCategory.Error, "Unterminated_string_literal_1002", "Unterminated string literal."), + Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."), + _0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."), + A_file_cannot_have_a_reference_to_itself: diag(1006, ts.DiagnosticCategory.Error, "A_file_cannot_have_a_reference_to_itself_1006", "A file cannot have a reference to itself."), + Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."), + Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."), + Unexpected_token: diag(1012, ts.DiagnosticCategory.Error, "Unexpected_token_1012", "Unexpected token."), + A_rest_parameter_must_be_last_in_a_parameter_list: diag(1014, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_last_in_a_parameter_list_1014", "A rest parameter must be last in a parameter list."), + Parameter_cannot_have_question_mark_and_initializer: diag(1015, ts.DiagnosticCategory.Error, "Parameter_cannot_have_question_mark_and_initializer_1015", "Parameter cannot have question mark and initializer."), + A_required_parameter_cannot_follow_an_optional_parameter: diag(1016, ts.DiagnosticCategory.Error, "A_required_parameter_cannot_follow_an_optional_parameter_1016", "A required parameter cannot follow an optional parameter."), + An_index_signature_cannot_have_a_rest_parameter: diag(1017, ts.DiagnosticCategory.Error, "An_index_signature_cannot_have_a_rest_parameter_1017", "An index signature cannot have a rest parameter."), + An_index_signature_parameter_cannot_have_an_accessibility_modifier: diag(1018, ts.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_an_accessibility_modifier_1018", "An index signature parameter cannot have an accessibility modifier."), + An_index_signature_parameter_cannot_have_a_question_mark: diag(1019, ts.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_a_question_mark_1019", "An index signature parameter cannot have a question mark."), + An_index_signature_parameter_cannot_have_an_initializer: diag(1020, ts.DiagnosticCategory.Error, "An_index_signature_parameter_cannot_have_an_initializer_1020", "An index signature parameter cannot have an initializer."), + An_index_signature_must_have_a_type_annotation: diag(1021, ts.DiagnosticCategory.Error, "An_index_signature_must_have_a_type_annotation_1021", "An index signature must have a type annotation."), + An_index_signature_parameter_must_have_a_type_annotation: diag(1022, ts.DiagnosticCategory.Error, "An_index_signature_parameter_must_have_a_type_annotation_1022", "An index signature parameter must have a type annotation."), + An_index_signature_parameter_type_must_be_string_or_number: diag(1023, ts.DiagnosticCategory.Error, "An_index_signature_parameter_type_must_be_string_or_number_1023", "An index signature parameter type must be 'string' or 'number'."), + readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature: diag(1024, ts.DiagnosticCategory.Error, "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024", "'readonly' modifier can only appear on a property declaration or index signature."), + Accessibility_modifier_already_seen: diag(1028, ts.DiagnosticCategory.Error, "Accessibility_modifier_already_seen_1028", "Accessibility modifier already seen."), + _0_modifier_must_precede_1_modifier: diag(1029, ts.DiagnosticCategory.Error, "_0_modifier_must_precede_1_modifier_1029", "'{0}' modifier must precede '{1}' modifier."), + _0_modifier_already_seen: diag(1030, ts.DiagnosticCategory.Error, "_0_modifier_already_seen_1030", "'{0}' modifier already seen."), + _0_modifier_cannot_appear_on_a_class_element: diag(1031, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_class_element_1031", "'{0}' modifier cannot appear on a class element."), + super_must_be_followed_by_an_argument_list_or_member_access: diag(1034, ts.DiagnosticCategory.Error, "super_must_be_followed_by_an_argument_list_or_member_access_1034", "'super' must be followed by an argument list or member access."), + Only_ambient_modules_can_use_quoted_names: diag(1035, ts.DiagnosticCategory.Error, "Only_ambient_modules_can_use_quoted_names_1035", "Only ambient modules can use quoted names."), + Statements_are_not_allowed_in_ambient_contexts: diag(1036, ts.DiagnosticCategory.Error, "Statements_are_not_allowed_in_ambient_contexts_1036", "Statements are not allowed in ambient contexts."), + A_declare_modifier_cannot_be_used_in_an_already_ambient_context: diag(1038, ts.DiagnosticCategory.Error, "A_declare_modifier_cannot_be_used_in_an_already_ambient_context_1038", "A 'declare' modifier cannot be used in an already ambient context."), + Initializers_are_not_allowed_in_ambient_contexts: diag(1039, ts.DiagnosticCategory.Error, "Initializers_are_not_allowed_in_ambient_contexts_1039", "Initializers are not allowed in ambient contexts."), + _0_modifier_cannot_be_used_in_an_ambient_context: diag(1040, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_in_an_ambient_context_1040", "'{0}' modifier cannot be used in an ambient context."), + _0_modifier_cannot_be_used_with_a_class_declaration: diag(1041, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_with_a_class_declaration_1041", "'{0}' modifier cannot be used with a class declaration."), + _0_modifier_cannot_be_used_here: diag(1042, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_here_1042", "'{0}' modifier cannot be used here."), + _0_modifier_cannot_appear_on_a_data_property: diag(1043, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_data_property_1043", "'{0}' modifier cannot appear on a data property."), + _0_modifier_cannot_appear_on_a_module_or_namespace_element: diag(1044, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."), + A_0_modifier_cannot_be_used_with_an_interface_declaration: diag(1045, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", "A '{0}' modifier cannot be used with an interface declaration."), + A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: diag(1046, ts.DiagnosticCategory.Error, "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", "A 'declare' modifier is required for a top level declaration in a .d.ts file."), + A_rest_parameter_cannot_be_optional: diag(1047, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."), + A_rest_parameter_cannot_have_an_initializer: diag(1048, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."), + A_set_accessor_must_have_exactly_one_parameter: diag(1049, ts.DiagnosticCategory.Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."), + A_set_accessor_cannot_have_an_optional_parameter: diag(1051, ts.DiagnosticCategory.Error, "A_set_accessor_cannot_have_an_optional_parameter_1051", "A 'set' accessor cannot have an optional parameter."), + A_set_accessor_parameter_cannot_have_an_initializer: diag(1052, ts.DiagnosticCategory.Error, "A_set_accessor_parameter_cannot_have_an_initializer_1052", "A 'set' accessor parameter cannot have an initializer."), + A_set_accessor_cannot_have_rest_parameter: diag(1053, ts.DiagnosticCategory.Error, "A_set_accessor_cannot_have_rest_parameter_1053", "A 'set' accessor cannot have rest parameter."), + A_get_accessor_cannot_have_parameters: diag(1054, ts.DiagnosticCategory.Error, "A_get_accessor_cannot_have_parameters_1054", "A 'get' accessor cannot have parameters."), + Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Promise_compatible_constructor_value: diag(1055, ts.DiagnosticCategory.Error, "Type_0_is_not_a_valid_async_function_return_type_in_ES5_SlashES3_because_it_does_not_refer_to_a_Prom_1055", "Type '{0}' is not a valid async function return type in ES5/ES3 because it does not refer to a Promise-compatible constructor value."), + Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: diag(1056, ts.DiagnosticCategory.Error, "Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher_1056", "Accessors are only available when targeting ECMAScript 5 and higher."), + An_async_function_or_method_must_have_a_valid_awaitable_return_type: diag(1057, ts.DiagnosticCategory.Error, "An_async_function_or_method_must_have_a_valid_awaitable_return_type_1057", "An async function or method must have a valid awaitable return type."), + The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1058, ts.DiagnosticCategory.Error, "The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_t_1058", "The return type of an async function must either be a valid promise or must not contain a callable 'then' member."), + A_promise_must_have_a_then_method: diag(1059, ts.DiagnosticCategory.Error, "A_promise_must_have_a_then_method_1059", "A promise must have a 'then' method."), + The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback: diag(1060, ts.DiagnosticCategory.Error, "The_first_parameter_of_the_then_method_of_a_promise_must_be_a_callback_1060", "The first parameter of the 'then' method of a promise must be a callback."), + Enum_member_must_have_initializer: diag(1061, ts.DiagnosticCategory.Error, "Enum_member_must_have_initializer_1061", "Enum member must have initializer."), + Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method: diag(1062, ts.DiagnosticCategory.Error, "Type_is_referenced_directly_or_indirectly_in_the_fulfillment_callback_of_its_own_then_method_1062", "Type is referenced directly or indirectly in the fulfillment callback of its own 'then' method."), + An_export_assignment_cannot_be_used_in_a_namespace: diag(1063, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_be_used_in_a_namespace_1063", "An export assignment cannot be used in a namespace."), + The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type: diag(1064, ts.DiagnosticCategory.Error, "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_1064", "The return type of an async function or method must be the global Promise<T> type."), + In_ambient_enum_declarations_member_initializer_must_be_constant_expression: diag(1066, ts.DiagnosticCategory.Error, "In_ambient_enum_declarations_member_initializer_must_be_constant_expression_1066", "In ambient enum declarations member initializer must be constant expression."), + Unexpected_token_A_constructor_method_accessor_or_property_was_expected: diag(1068, ts.DiagnosticCategory.Error, "Unexpected_token_A_constructor_method_accessor_or_property_was_expected_1068", "Unexpected token. A constructor, method, accessor, or property was expected."), + _0_modifier_cannot_appear_on_a_type_member: diag(1070, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_member_1070", "'{0}' modifier cannot appear on a type member."), + _0_modifier_cannot_appear_on_an_index_signature: diag(1071, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_an_index_signature_1071", "'{0}' modifier cannot appear on an index signature."), + A_0_modifier_cannot_be_used_with_an_import_declaration: diag(1079, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_import_declaration_1079", "A '{0}' modifier cannot be used with an import declaration."), + Invalid_reference_directive_syntax: diag(1084, ts.DiagnosticCategory.Error, "Invalid_reference_directive_syntax_1084", "Invalid 'reference' directive syntax."), + Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0: diag(1085, ts.DiagnosticCategory.Error, "Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0_1085", "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'."), + An_accessor_cannot_be_declared_in_an_ambient_context: diag(1086, ts.DiagnosticCategory.Error, "An_accessor_cannot_be_declared_in_an_ambient_context_1086", "An accessor cannot be declared in an ambient context."), + _0_modifier_cannot_appear_on_a_constructor_declaration: diag(1089, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_constructor_declaration_1089", "'{0}' modifier cannot appear on a constructor declaration."), + _0_modifier_cannot_appear_on_a_parameter: diag(1090, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_parameter_1090", "'{0}' modifier cannot appear on a parameter."), + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: diag(1091, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement_1091", "Only a single variable declaration is allowed in a 'for...in' statement."), + Type_parameters_cannot_appear_on_a_constructor_declaration: diag(1092, ts.DiagnosticCategory.Error, "Type_parameters_cannot_appear_on_a_constructor_declaration_1092", "Type parameters cannot appear on a constructor declaration."), + Type_annotation_cannot_appear_on_a_constructor_declaration: diag(1093, ts.DiagnosticCategory.Error, "Type_annotation_cannot_appear_on_a_constructor_declaration_1093", "Type annotation cannot appear on a constructor declaration."), + An_accessor_cannot_have_type_parameters: diag(1094, ts.DiagnosticCategory.Error, "An_accessor_cannot_have_type_parameters_1094", "An accessor cannot have type parameters."), + A_set_accessor_cannot_have_a_return_type_annotation: diag(1095, ts.DiagnosticCategory.Error, "A_set_accessor_cannot_have_a_return_type_annotation_1095", "A 'set' accessor cannot have a return type annotation."), + An_index_signature_must_have_exactly_one_parameter: diag(1096, ts.DiagnosticCategory.Error, "An_index_signature_must_have_exactly_one_parameter_1096", "An index signature must have exactly one parameter."), + _0_list_cannot_be_empty: diag(1097, ts.DiagnosticCategory.Error, "_0_list_cannot_be_empty_1097", "'{0}' list cannot be empty."), + Type_parameter_list_cannot_be_empty: diag(1098, ts.DiagnosticCategory.Error, "Type_parameter_list_cannot_be_empty_1098", "Type parameter list cannot be empty."), + Type_argument_list_cannot_be_empty: diag(1099, ts.DiagnosticCategory.Error, "Type_argument_list_cannot_be_empty_1099", "Type argument list cannot be empty."), + Invalid_use_of_0_in_strict_mode: diag(1100, ts.DiagnosticCategory.Error, "Invalid_use_of_0_in_strict_mode_1100", "Invalid use of '{0}' in strict mode."), + with_statements_are_not_allowed_in_strict_mode: diag(1101, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_strict_mode_1101", "'with' statements are not allowed in strict mode."), + delete_cannot_be_called_on_an_identifier_in_strict_mode: diag(1102, ts.DiagnosticCategory.Error, "delete_cannot_be_called_on_an_identifier_in_strict_mode_1102", "'delete' cannot be called on an identifier in strict mode."), + A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator: diag(1103, ts.DiagnosticCategory.Error, "A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator_1103", "A 'for-await-of' statement is only allowed within an async function or async generator."), + A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement: diag(1104, ts.DiagnosticCategory.Error, "A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement_1104", "A 'continue' statement can only be used within an enclosing iteration statement."), + A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement: diag(1105, ts.DiagnosticCategory.Error, "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105", "A 'break' statement can only be used within an enclosing iteration or switch statement."), + Jump_target_cannot_cross_function_boundary: diag(1107, ts.DiagnosticCategory.Error, "Jump_target_cannot_cross_function_boundary_1107", "Jump target cannot cross function boundary."), + A_return_statement_can_only_be_used_within_a_function_body: diag(1108, ts.DiagnosticCategory.Error, "A_return_statement_can_only_be_used_within_a_function_body_1108", "A 'return' statement can only be used within a function body."), + Expression_expected: diag(1109, ts.DiagnosticCategory.Error, "Expression_expected_1109", "Expression expected."), + Type_expected: diag(1110, ts.DiagnosticCategory.Error, "Type_expected_1110", "Type expected."), + A_default_clause_cannot_appear_more_than_once_in_a_switch_statement: diag(1113, ts.DiagnosticCategory.Error, "A_default_clause_cannot_appear_more_than_once_in_a_switch_statement_1113", "A 'default' clause cannot appear more than once in a 'switch' statement."), + Duplicate_label_0: diag(1114, ts.DiagnosticCategory.Error, "Duplicate_label_0_1114", "Duplicate label '{0}'."), + A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement: diag(1115, ts.DiagnosticCategory.Error, "A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement_1115", "A 'continue' statement can only jump to a label of an enclosing iteration statement."), + A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement: diag(1116, ts.DiagnosticCategory.Error, "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116", "A 'break' statement can only jump to a label of an enclosing statement."), + An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode: diag(1117, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_properties_with_the_same_name_in_strict_mode_1117", "An object literal cannot have multiple properties with the same name in strict mode."), + An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name: diag(1118, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_multiple_get_Slashset_accessors_with_the_same_name_1118", "An object literal cannot have multiple get/set accessors with the same name."), + An_object_literal_cannot_have_property_and_accessor_with_the_same_name: diag(1119, ts.DiagnosticCategory.Error, "An_object_literal_cannot_have_property_and_accessor_with_the_same_name_1119", "An object literal cannot have property and accessor with the same name."), + An_export_assignment_cannot_have_modifiers: diag(1120, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_have_modifiers_1120", "An export assignment cannot have modifiers."), + Octal_literals_are_not_allowed_in_strict_mode: diag(1121, ts.DiagnosticCategory.Error, "Octal_literals_are_not_allowed_in_strict_mode_1121", "Octal literals are not allowed in strict mode."), + A_tuple_type_element_list_cannot_be_empty: diag(1122, ts.DiagnosticCategory.Error, "A_tuple_type_element_list_cannot_be_empty_1122", "A tuple type element list cannot be empty."), + Variable_declaration_list_cannot_be_empty: diag(1123, ts.DiagnosticCategory.Error, "Variable_declaration_list_cannot_be_empty_1123", "Variable declaration list cannot be empty."), + Digit_expected: diag(1124, ts.DiagnosticCategory.Error, "Digit_expected_1124", "Digit expected."), + Hexadecimal_digit_expected: diag(1125, ts.DiagnosticCategory.Error, "Hexadecimal_digit_expected_1125", "Hexadecimal digit expected."), + Unexpected_end_of_text: diag(1126, ts.DiagnosticCategory.Error, "Unexpected_end_of_text_1126", "Unexpected end of text."), + Invalid_character: diag(1127, ts.DiagnosticCategory.Error, "Invalid_character_1127", "Invalid character."), + Declaration_or_statement_expected: diag(1128, ts.DiagnosticCategory.Error, "Declaration_or_statement_expected_1128", "Declaration or statement expected."), + Statement_expected: diag(1129, ts.DiagnosticCategory.Error, "Statement_expected_1129", "Statement expected."), + case_or_default_expected: diag(1130, ts.DiagnosticCategory.Error, "case_or_default_expected_1130", "'case' or 'default' expected."), + Property_or_signature_expected: diag(1131, ts.DiagnosticCategory.Error, "Property_or_signature_expected_1131", "Property or signature expected."), + Enum_member_expected: diag(1132, ts.DiagnosticCategory.Error, "Enum_member_expected_1132", "Enum member expected."), + Variable_declaration_expected: diag(1134, ts.DiagnosticCategory.Error, "Variable_declaration_expected_1134", "Variable declaration expected."), + Argument_expression_expected: diag(1135, ts.DiagnosticCategory.Error, "Argument_expression_expected_1135", "Argument expression expected."), + Property_assignment_expected: diag(1136, ts.DiagnosticCategory.Error, "Property_assignment_expected_1136", "Property assignment expected."), + Expression_or_comma_expected: diag(1137, ts.DiagnosticCategory.Error, "Expression_or_comma_expected_1137", "Expression or comma expected."), + Parameter_declaration_expected: diag(1138, ts.DiagnosticCategory.Error, "Parameter_declaration_expected_1138", "Parameter declaration expected."), + Type_parameter_declaration_expected: diag(1139, ts.DiagnosticCategory.Error, "Type_parameter_declaration_expected_1139", "Type parameter declaration expected."), + Type_argument_expected: diag(1140, ts.DiagnosticCategory.Error, "Type_argument_expected_1140", "Type argument expected."), + String_literal_expected: diag(1141, ts.DiagnosticCategory.Error, "String_literal_expected_1141", "String literal expected."), + Line_break_not_permitted_here: diag(1142, ts.DiagnosticCategory.Error, "Line_break_not_permitted_here_1142", "Line break not permitted here."), + or_expected: diag(1144, ts.DiagnosticCategory.Error, "or_expected_1144", "'{' or ';' expected."), + Declaration_expected: diag(1146, ts.DiagnosticCategory.Error, "Declaration_expected_1146", "Declaration expected."), + Import_declarations_in_a_namespace_cannot_reference_a_module: diag(1147, ts.DiagnosticCategory.Error, "Import_declarations_in_a_namespace_cannot_reference_a_module_1147", "Import declarations in a namespace cannot reference a module."), + Cannot_use_imports_exports_or_module_augmentations_when_module_is_none: diag(1148, ts.DiagnosticCategory.Error, "Cannot_use_imports_exports_or_module_augmentations_when_module_is_none_1148", "Cannot use imports, exports, or module augmentations when '--module' is 'none'."), + File_name_0_differs_from_already_included_file_name_1_only_in_casing: diag(1149, ts.DiagnosticCategory.Error, "File_name_0_differs_from_already_included_file_name_1_only_in_casing_1149", "File name '{0}' differs from already included file name '{1}' only in casing."), + new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: diag(1150, ts.DiagnosticCategory.Error, "new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead_1150", "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead."), + const_declarations_must_be_initialized: diag(1155, ts.DiagnosticCategory.Error, "const_declarations_must_be_initialized_1155", "'const' declarations must be initialized."), + const_declarations_can_only_be_declared_inside_a_block: diag(1156, ts.DiagnosticCategory.Error, "const_declarations_can_only_be_declared_inside_a_block_1156", "'const' declarations can only be declared inside a block."), + let_declarations_can_only_be_declared_inside_a_block: diag(1157, ts.DiagnosticCategory.Error, "let_declarations_can_only_be_declared_inside_a_block_1157", "'let' declarations can only be declared inside a block."), + Unterminated_template_literal: diag(1160, ts.DiagnosticCategory.Error, "Unterminated_template_literal_1160", "Unterminated template literal."), + Unterminated_regular_expression_literal: diag(1161, ts.DiagnosticCategory.Error, "Unterminated_regular_expression_literal_1161", "Unterminated regular expression literal."), + An_object_member_cannot_be_declared_optional: diag(1162, ts.DiagnosticCategory.Error, "An_object_member_cannot_be_declared_optional_1162", "An object member cannot be declared optional."), + A_yield_expression_is_only_allowed_in_a_generator_body: diag(1163, ts.DiagnosticCategory.Error, "A_yield_expression_is_only_allowed_in_a_generator_body_1163", "A 'yield' expression is only allowed in a generator body."), + Computed_property_names_are_not_allowed_in_enums: diag(1164, ts.DiagnosticCategory.Error, "Computed_property_names_are_not_allowed_in_enums_1164", "Computed property names are not allowed in enums."), + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: diag(1165, ts.DiagnosticCategory.Error, "A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol_1165", "A computed property name in an ambient context must directly refer to a built-in symbol."), + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: diag(1166, ts.DiagnosticCategory.Error, "A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol_1166", "A computed property name in a class property declaration must directly refer to a built-in symbol."), + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: diag(1168, ts.DiagnosticCategory.Error, "A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol_1168", "A computed property name in a method overload must directly refer to a built-in symbol."), + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: diag(1169, ts.DiagnosticCategory.Error, "A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol_1169", "A computed property name in an interface must directly refer to a built-in symbol."), + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: diag(1170, ts.DiagnosticCategory.Error, "A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol_1170", "A computed property name in a type literal must directly refer to a built-in symbol."), + A_comma_expression_is_not_allowed_in_a_computed_property_name: diag(1171, ts.DiagnosticCategory.Error, "A_comma_expression_is_not_allowed_in_a_computed_property_name_1171", "A comma expression is not allowed in a computed property name."), + extends_clause_already_seen: diag(1172, ts.DiagnosticCategory.Error, "extends_clause_already_seen_1172", "'extends' clause already seen."), + extends_clause_must_precede_implements_clause: diag(1173, ts.DiagnosticCategory.Error, "extends_clause_must_precede_implements_clause_1173", "'extends' clause must precede 'implements' clause."), + Classes_can_only_extend_a_single_class: diag(1174, ts.DiagnosticCategory.Error, "Classes_can_only_extend_a_single_class_1174", "Classes can only extend a single class."), + implements_clause_already_seen: diag(1175, ts.DiagnosticCategory.Error, "implements_clause_already_seen_1175", "'implements' clause already seen."), + Interface_declaration_cannot_have_implements_clause: diag(1176, ts.DiagnosticCategory.Error, "Interface_declaration_cannot_have_implements_clause_1176", "Interface declaration cannot have 'implements' clause."), + Binary_digit_expected: diag(1177, ts.DiagnosticCategory.Error, "Binary_digit_expected_1177", "Binary digit expected."), + Octal_digit_expected: diag(1178, ts.DiagnosticCategory.Error, "Octal_digit_expected_1178", "Octal digit expected."), + Unexpected_token_expected: diag(1179, ts.DiagnosticCategory.Error, "Unexpected_token_expected_1179", "Unexpected token. '{' expected."), + Property_destructuring_pattern_expected: diag(1180, ts.DiagnosticCategory.Error, "Property_destructuring_pattern_expected_1180", "Property destructuring pattern expected."), + Array_element_destructuring_pattern_expected: diag(1181, ts.DiagnosticCategory.Error, "Array_element_destructuring_pattern_expected_1181", "Array element destructuring pattern expected."), + A_destructuring_declaration_must_have_an_initializer: diag(1182, ts.DiagnosticCategory.Error, "A_destructuring_declaration_must_have_an_initializer_1182", "A destructuring declaration must have an initializer."), + An_implementation_cannot_be_declared_in_ambient_contexts: diag(1183, ts.DiagnosticCategory.Error, "An_implementation_cannot_be_declared_in_ambient_contexts_1183", "An implementation cannot be declared in ambient contexts."), + Modifiers_cannot_appear_here: diag(1184, ts.DiagnosticCategory.Error, "Modifiers_cannot_appear_here_1184", "Modifiers cannot appear here."), + Merge_conflict_marker_encountered: diag(1185, ts.DiagnosticCategory.Error, "Merge_conflict_marker_encountered_1185", "Merge conflict marker encountered."), + A_rest_element_cannot_have_an_initializer: diag(1186, ts.DiagnosticCategory.Error, "A_rest_element_cannot_have_an_initializer_1186", "A rest element cannot have an initializer."), + A_parameter_property_may_not_be_declared_using_a_binding_pattern: diag(1187, ts.DiagnosticCategory.Error, "A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187", "A parameter property may not be declared using a binding pattern."), + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: diag(1188, ts.DiagnosticCategory.Error, "Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement_1188", "Only a single variable declaration is allowed in a 'for...of' statement."), + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: diag(1189, ts.DiagnosticCategory.Error, "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189", "The variable declaration of a 'for...in' statement cannot have an initializer."), + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: diag(1190, ts.DiagnosticCategory.Error, "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190", "The variable declaration of a 'for...of' statement cannot have an initializer."), + An_import_declaration_cannot_have_modifiers: diag(1191, ts.DiagnosticCategory.Error, "An_import_declaration_cannot_have_modifiers_1191", "An import declaration cannot have modifiers."), + Module_0_has_no_default_export: diag(1192, ts.DiagnosticCategory.Error, "Module_0_has_no_default_export_1192", "Module '{0}' has no default export."), + An_export_declaration_cannot_have_modifiers: diag(1193, ts.DiagnosticCategory.Error, "An_export_declaration_cannot_have_modifiers_1193", "An export declaration cannot have modifiers."), + Export_declarations_are_not_permitted_in_a_namespace: diag(1194, ts.DiagnosticCategory.Error, "Export_declarations_are_not_permitted_in_a_namespace_1194", "Export declarations are not permitted in a namespace."), + Catch_clause_variable_cannot_have_a_type_annotation: diag(1196, ts.DiagnosticCategory.Error, "Catch_clause_variable_cannot_have_a_type_annotation_1196", "Catch clause variable cannot have a type annotation."), + Catch_clause_variable_cannot_have_an_initializer: diag(1197, ts.DiagnosticCategory.Error, "Catch_clause_variable_cannot_have_an_initializer_1197", "Catch clause variable cannot have an initializer."), + An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive: diag(1198, ts.DiagnosticCategory.Error, "An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198", "An extended Unicode escape value must be between 0x0 and 0x10FFFF inclusive."), + Unterminated_Unicode_escape_sequence: diag(1199, ts.DiagnosticCategory.Error, "Unterminated_Unicode_escape_sequence_1199", "Unterminated Unicode escape sequence."), + Line_terminator_not_permitted_before_arrow: diag(1200, ts.DiagnosticCategory.Error, "Line_terminator_not_permitted_before_arrow_1200", "Line terminator not permitted before arrow."), + Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_import_d_from_mod_or_another_module_format_instead: diag(1202, ts.DiagnosticCategory.Error, "Import_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_import_Asteri_1202", "Import assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"', 'import d from \"mod\"', or another module format instead."), + Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_default_or_another_module_format_instead: diag(1203, ts.DiagnosticCategory.Error, "Export_assignment_cannot_be_used_when_targeting_ECMAScript_2015_modules_Consider_using_export_defaul_1203", "Export assignment cannot be used when targeting ECMAScript 2015 modules. Consider using 'export default' or another module format instead."), + Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided: diag(1205, ts.DiagnosticCategory.Error, "Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided_1205", "Cannot re-export a type when the '--isolatedModules' flag is provided."), + Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."), + Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."), + Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", "Cannot compile namespaces when the '--isolatedModules' flag is provided."), + Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided: diag(1209, ts.DiagnosticCategory.Error, "Ambient_const_enums_are_not_allowed_when_the_isolatedModules_flag_is_provided_1209", "Ambient const enums are not allowed when the '--isolatedModules' flag is provided."), + Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: diag(1210, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", "Invalid use of '{0}'. Class definitions are automatically in strict mode."), + A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."), + Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."), + Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: diag(1213, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_stric_1213", "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode."), + Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode: diag(1214, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode_1214", "Identifier expected. '{0}' is a reserved word in strict mode. Modules are automatically in strict mode."), + Invalid_use_of_0_Modules_are_automatically_in_strict_mode: diag(1215, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."), + Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: diag(1216, ts.DiagnosticCategory.Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."), + Export_assignment_is_not_supported_when_module_flag_is_system: diag(1218, ts.DiagnosticCategory.Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."), + Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning."), + Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: diag(1220, ts.DiagnosticCategory.Error, "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", "Generators are only available when targeting ECMAScript 2015 or higher."), + Generators_are_not_allowed_in_an_ambient_context: diag(1221, ts.DiagnosticCategory.Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."), + An_overload_signature_cannot_be_declared_as_a_generator: diag(1222, ts.DiagnosticCategory.Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."), + _0_tag_already_specified: diag(1223, ts.DiagnosticCategory.Error, "_0_tag_already_specified_1223", "'{0}' tag already specified."), + Signature_0_must_be_a_type_predicate: diag(1224, ts.DiagnosticCategory.Error, "Signature_0_must_be_a_type_predicate_1224", "Signature '{0}' must be a type predicate."), + Cannot_find_parameter_0: diag(1225, ts.DiagnosticCategory.Error, "Cannot_find_parameter_0_1225", "Cannot find parameter '{0}'."), + Type_predicate_0_is_not_assignable_to_1: diag(1226, ts.DiagnosticCategory.Error, "Type_predicate_0_is_not_assignable_to_1_1226", "Type predicate '{0}' is not assignable to '{1}'."), + Parameter_0_is_not_in_the_same_position_as_parameter_1: diag(1227, ts.DiagnosticCategory.Error, "Parameter_0_is_not_in_the_same_position_as_parameter_1_1227", "Parameter '{0}' is not in the same position as parameter '{1}'."), + A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods: diag(1228, ts.DiagnosticCategory.Error, "A_type_predicate_is_only_allowed_in_return_type_position_for_functions_and_methods_1228", "A type predicate is only allowed in return type position for functions and methods."), + A_type_predicate_cannot_reference_a_rest_parameter: diag(1229, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_a_rest_parameter_1229", "A type predicate cannot reference a rest parameter."), + A_type_predicate_cannot_reference_element_0_in_a_binding_pattern: diag(1230, ts.DiagnosticCategory.Error, "A_type_predicate_cannot_reference_element_0_in_a_binding_pattern_1230", "A type predicate cannot reference element '{0}' in a binding pattern."), + An_export_assignment_can_only_be_used_in_a_module: diag(1231, ts.DiagnosticCategory.Error, "An_export_assignment_can_only_be_used_in_a_module_1231", "An export assignment can only be used in a module."), + An_import_declaration_can_only_be_used_in_a_namespace_or_module: diag(1232, ts.DiagnosticCategory.Error, "An_import_declaration_can_only_be_used_in_a_namespace_or_module_1232", "An import declaration can only be used in a namespace or module."), + An_export_declaration_can_only_be_used_in_a_module: diag(1233, ts.DiagnosticCategory.Error, "An_export_declaration_can_only_be_used_in_a_module_1233", "An export declaration can only be used in a module."), + An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file: diag(1234, ts.DiagnosticCategory.Error, "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234", "An ambient module declaration is only allowed at the top level in a file."), + A_namespace_declaration_is_only_allowed_in_a_namespace_or_module: diag(1235, ts.DiagnosticCategory.Error, "A_namespace_declaration_is_only_allowed_in_a_namespace_or_module_1235", "A namespace declaration is only allowed in a namespace or module."), + The_return_type_of_a_property_decorator_function_must_be_either_void_or_any: diag(1236, ts.DiagnosticCategory.Error, "The_return_type_of_a_property_decorator_function_must_be_either_void_or_any_1236", "The return type of a property decorator function must be either 'void' or 'any'."), + The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any: diag(1237, ts.DiagnosticCategory.Error, "The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any_1237", "The return type of a parameter decorator function must be either 'void' or 'any'."), + Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression: diag(1238, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression_1238", "Unable to resolve signature of class decorator when called as an expression."), + Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression: diag(1239, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression_1239", "Unable to resolve signature of parameter decorator when called as an expression."), + Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression: diag(1240, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression_1240", "Unable to resolve signature of property decorator when called as an expression."), + Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression: diag(1241, ts.DiagnosticCategory.Error, "Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression_1241", "Unable to resolve signature of method decorator when called as an expression."), + abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration: diag(1242, ts.DiagnosticCategory.Error, "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242", "'abstract' modifier can only appear on a class, method, or property declaration."), + _0_modifier_cannot_be_used_with_1_modifier: diag(1243, ts.DiagnosticCategory.Error, "_0_modifier_cannot_be_used_with_1_modifier_1243", "'{0}' modifier cannot be used with '{1}' modifier."), + Abstract_methods_can_only_appear_within_an_abstract_class: diag(1244, ts.DiagnosticCategory.Error, "Abstract_methods_can_only_appear_within_an_abstract_class_1244", "Abstract methods can only appear within an abstract class."), + Method_0_cannot_have_an_implementation_because_it_is_marked_abstract: diag(1245, ts.DiagnosticCategory.Error, "Method_0_cannot_have_an_implementation_because_it_is_marked_abstract_1245", "Method '{0}' cannot have an implementation because it is marked abstract."), + An_interface_property_cannot_have_an_initializer: diag(1246, ts.DiagnosticCategory.Error, "An_interface_property_cannot_have_an_initializer_1246", "An interface property cannot have an initializer."), + A_type_literal_property_cannot_have_an_initializer: diag(1247, ts.DiagnosticCategory.Error, "A_type_literal_property_cannot_have_an_initializer_1247", "A type literal property cannot have an initializer."), + A_class_member_cannot_have_the_0_keyword: diag(1248, ts.DiagnosticCategory.Error, "A_class_member_cannot_have_the_0_keyword_1248", "A class member cannot have the '{0}' keyword."), + A_decorator_can_only_decorate_a_method_implementation_not_an_overload: diag(1249, ts.DiagnosticCategory.Error, "A_decorator_can_only_decorate_a_method_implementation_not_an_overload_1249", "A decorator can only decorate a method implementation, not an overload."), + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5: diag(1250, ts.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_1250", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'."), + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_definitions_are_automatically_in_strict_mode: diag(1251, ts.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Class_d_1251", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Class definitions are automatically in strict mode."), + Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_are_automatically_in_strict_mode: diag(1252, ts.DiagnosticCategory.Error, "Function_declarations_are_not_allowed_inside_blocks_in_strict_mode_when_targeting_ES3_or_ES5_Modules_1252", "Function declarations are not allowed inside blocks in strict mode when targeting 'ES3' or 'ES5'. Modules are automatically in strict mode."), + _0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag: diag(1253, ts.DiagnosticCategory.Error, "_0_tag_cannot_be_used_independently_as_a_top_level_JSDoc_tag_1253", "'{0}' tag cannot be used independently as a top level JSDoc tag."), + A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal: diag(1254, ts.DiagnosticCategory.Error, "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_1254", "A 'const' initializer in an ambient context must be a string or numeric literal."), + with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), + await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."), + can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."), + The_body_of_an_if_statement_cannot_be_the_empty_statement: diag(1313, ts.DiagnosticCategory.Error, "The_body_of_an_if_statement_cannot_be_the_empty_statement_1313", "The body of an 'if' statement cannot be the empty statement."), + Global_module_exports_may_only_appear_in_module_files: diag(1314, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_module_files_1314", "Global module exports may only appear in module files."), + Global_module_exports_may_only_appear_in_declaration_files: diag(1315, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_in_declaration_files_1315", "Global module exports may only appear in declaration files."), + Global_module_exports_may_only_appear_at_top_level: diag(1316, ts.DiagnosticCategory.Error, "Global_module_exports_may_only_appear_at_top_level_1316", "Global module exports may only appear at top level."), + A_parameter_property_cannot_be_declared_using_a_rest_parameter: diag(1317, ts.DiagnosticCategory.Error, "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317", "A parameter property cannot be declared using a rest parameter."), + An_abstract_accessor_cannot_have_an_implementation: diag(1318, ts.DiagnosticCategory.Error, "An_abstract_accessor_cannot_have_an_implementation_1318", "An abstract accessor cannot have an implementation."), + A_default_export_can_only_be_used_in_an_ECMAScript_style_module: diag(1319, ts.DiagnosticCategory.Error, "A_default_export_can_only_be_used_in_an_ECMAScript_style_module_1319", "A default export can only be used in an ECMAScript-style module."), + Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1320, ts.DiagnosticCategory.Error, "Type_of_await_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member_1320", "Type of 'await' operand must either be a valid promise or must not contain a callable 'then' member."), + Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1321, ts.DiagnosticCategory.Error, "Type_of_yield_operand_in_an_async_generator_must_either_be_a_valid_promise_or_must_not_contain_a_cal_1321", "Type of 'yield' operand in an async generator must either be a valid promise or must not contain a callable 'then' member."), + Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member: diag(1322, ts.DiagnosticCategory.Error, "Type_of_iterated_elements_of_a_yield_Asterisk_operand_must_either_be_a_valid_promise_or_must_not_con_1322", "Type of iterated elements of a 'yield*' operand must either be a valid promise or must not contain a callable 'then' member."), + Dynamic_import_cannot_be_used_when_targeting_ECMAScript_2015_modules: diag(1323, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_be_used_when_targeting_ECMAScript_2015_modules_1323", "Dynamic import cannot be used when targeting ECMAScript 2015 modules."), + Dynamic_import_must_have_one_specifier_as_an_argument: diag(1324, ts.DiagnosticCategory.Error, "Dynamic_import_must_have_one_specifier_as_an_argument_1324", "Dynamic import must have one specifier as an argument."), + Specifier_of_dynamic_import_cannot_be_spread_element: diag(1325, ts.DiagnosticCategory.Error, "Specifier_of_dynamic_import_cannot_be_spread_element_1325", "Specifier of dynamic import cannot be spread element."), + Dynamic_import_cannot_have_type_arguments: diag(1326, ts.DiagnosticCategory.Error, "Dynamic_import_cannot_have_type_arguments_1326", "Dynamic import cannot have type arguments"), + String_literal_with_double_quotes_expected: diag(1327, ts.DiagnosticCategory.Error, "String_literal_with_double_quotes_expected_1327", "String literal with double quotes expected."), + Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal: diag(1328, ts.DiagnosticCategory.Error, "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328", "Property value can only be string literal, numeric literal, 'true', 'false', 'null', object literal or array literal."), + Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."), + Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."), + Circular_definition_of_import_alias_0: diag(2303, ts.DiagnosticCategory.Error, "Circular_definition_of_import_alias_0_2303", "Circular definition of import alias '{0}'."), + Cannot_find_name_0: diag(2304, ts.DiagnosticCategory.Error, "Cannot_find_name_0_2304", "Cannot find name '{0}'."), + Module_0_has_no_exported_member_1: diag(2305, ts.DiagnosticCategory.Error, "Module_0_has_no_exported_member_1_2305", "Module '{0}' has no exported member '{1}'."), + File_0_is_not_a_module: diag(2306, ts.DiagnosticCategory.Error, "File_0_is_not_a_module_2306", "File '{0}' is not a module."), + Cannot_find_module_0: diag(2307, ts.DiagnosticCategory.Error, "Cannot_find_module_0_2307", "Cannot find module '{0}'."), + Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity: diag(2308, ts.DiagnosticCategory.Error, "Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambig_2308", "Module {0} has already exported a member named '{1}'. Consider explicitly re-exporting to resolve the ambiguity."), + An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: diag(2309, ts.DiagnosticCategory.Error, "An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements_2309", "An export assignment cannot be used in a module with other exported elements."), + Type_0_recursively_references_itself_as_a_base_type: diag(2310, ts.DiagnosticCategory.Error, "Type_0_recursively_references_itself_as_a_base_type_2310", "Type '{0}' recursively references itself as a base type."), + A_class_may_only_extend_another_class: diag(2311, ts.DiagnosticCategory.Error, "A_class_may_only_extend_another_class_2311", "A class may only extend another class."), + An_interface_may_only_extend_a_class_or_another_interface: diag(2312, ts.DiagnosticCategory.Error, "An_interface_may_only_extend_a_class_or_another_interface_2312", "An interface may only extend a class or another interface."), + Type_parameter_0_has_a_circular_constraint: diag(2313, ts.DiagnosticCategory.Error, "Type_parameter_0_has_a_circular_constraint_2313", "Type parameter '{0}' has a circular constraint."), + Generic_type_0_requires_1_type_argument_s: diag(2314, ts.DiagnosticCategory.Error, "Generic_type_0_requires_1_type_argument_s_2314", "Generic type '{0}' requires {1} type argument(s)."), + Type_0_is_not_generic: diag(2315, ts.DiagnosticCategory.Error, "Type_0_is_not_generic_2315", "Type '{0}' is not generic."), + Global_type_0_must_be_a_class_or_interface_type: diag(2316, ts.DiagnosticCategory.Error, "Global_type_0_must_be_a_class_or_interface_type_2316", "Global type '{0}' must be a class or interface type."), + Global_type_0_must_have_1_type_parameter_s: diag(2317, ts.DiagnosticCategory.Error, "Global_type_0_must_have_1_type_parameter_s_2317", "Global type '{0}' must have {1} type parameter(s)."), + Cannot_find_global_type_0: diag(2318, ts.DiagnosticCategory.Error, "Cannot_find_global_type_0_2318", "Cannot find global type '{0}'."), + Named_property_0_of_types_1_and_2_are_not_identical: diag(2319, ts.DiagnosticCategory.Error, "Named_property_0_of_types_1_and_2_are_not_identical_2319", "Named property '{0}' of types '{1}' and '{2}' are not identical."), + Interface_0_cannot_simultaneously_extend_types_1_and_2: diag(2320, ts.DiagnosticCategory.Error, "Interface_0_cannot_simultaneously_extend_types_1_and_2_2320", "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'."), + Excessive_stack_depth_comparing_types_0_and_1: diag(2321, ts.DiagnosticCategory.Error, "Excessive_stack_depth_comparing_types_0_and_1_2321", "Excessive stack depth comparing types '{0}' and '{1}'."), + Type_0_is_not_assignable_to_type_1: diag(2322, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_2322", "Type '{0}' is not assignable to type '{1}'."), + Cannot_redeclare_exported_variable_0: diag(2323, ts.DiagnosticCategory.Error, "Cannot_redeclare_exported_variable_0_2323", "Cannot redeclare exported variable '{0}'."), + Property_0_is_missing_in_type_1: diag(2324, ts.DiagnosticCategory.Error, "Property_0_is_missing_in_type_1_2324", "Property '{0}' is missing in type '{1}'."), + Property_0_is_private_in_type_1_but_not_in_type_2: diag(2325, ts.DiagnosticCategory.Error, "Property_0_is_private_in_type_1_but_not_in_type_2_2325", "Property '{0}' is private in type '{1}' but not in type '{2}'."), + Types_of_property_0_are_incompatible: diag(2326, ts.DiagnosticCategory.Error, "Types_of_property_0_are_incompatible_2326", "Types of property '{0}' are incompatible."), + Property_0_is_optional_in_type_1_but_required_in_type_2: diag(2327, ts.DiagnosticCategory.Error, "Property_0_is_optional_in_type_1_but_required_in_type_2_2327", "Property '{0}' is optional in type '{1}' but required in type '{2}'."), + Types_of_parameters_0_and_1_are_incompatible: diag(2328, ts.DiagnosticCategory.Error, "Types_of_parameters_0_and_1_are_incompatible_2328", "Types of parameters '{0}' and '{1}' are incompatible."), + Index_signature_is_missing_in_type_0: diag(2329, ts.DiagnosticCategory.Error, "Index_signature_is_missing_in_type_0_2329", "Index signature is missing in type '{0}'."), + Index_signatures_are_incompatible: diag(2330, ts.DiagnosticCategory.Error, "Index_signatures_are_incompatible_2330", "Index signatures are incompatible."), + this_cannot_be_referenced_in_a_module_or_namespace_body: diag(2331, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_module_or_namespace_body_2331", "'this' cannot be referenced in a module or namespace body."), + this_cannot_be_referenced_in_current_location: diag(2332, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_current_location_2332", "'this' cannot be referenced in current location."), + this_cannot_be_referenced_in_constructor_arguments: diag(2333, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_constructor_arguments_2333", "'this' cannot be referenced in constructor arguments."), + this_cannot_be_referenced_in_a_static_property_initializer: diag(2334, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_static_property_initializer_2334", "'this' cannot be referenced in a static property initializer."), + super_can_only_be_referenced_in_a_derived_class: diag(2335, ts.DiagnosticCategory.Error, "super_can_only_be_referenced_in_a_derived_class_2335", "'super' can only be referenced in a derived class."), + super_cannot_be_referenced_in_constructor_arguments: diag(2336, ts.DiagnosticCategory.Error, "super_cannot_be_referenced_in_constructor_arguments_2336", "'super' cannot be referenced in constructor arguments."), + Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors: diag(2337, ts.DiagnosticCategory.Error, "Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337", "Super calls are not permitted outside constructors or in nested functions inside constructors."), + super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_derived_class: diag(2338, ts.DiagnosticCategory.Error, "super_property_access_is_permitted_only_in_a_constructor_member_function_or_member_accessor_of_a_der_2338", "'super' property access is permitted only in a constructor, member function, or member accessor of a derived class."), + Property_0_does_not_exist_on_type_1: diag(2339, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_2339", "Property '{0}' does not exist on type '{1}'."), + Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: diag(2340, ts.DiagnosticCategory.Error, "Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword_2340", "Only public and protected methods of the base class are accessible via the 'super' keyword."), + Property_0_is_private_and_only_accessible_within_class_1: diag(2341, ts.DiagnosticCategory.Error, "Property_0_is_private_and_only_accessible_within_class_1_2341", "Property '{0}' is private and only accessible within class '{1}'."), + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: diag(2342, ts.DiagnosticCategory.Error, "An_index_expression_argument_must_be_of_type_string_number_symbol_or_any_2342", "An index expression argument must be of type 'string', 'number', 'symbol', or 'any'."), + This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1: diag(2343, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1_2343", "This syntax requires an imported helper named '{1}', but module '{0}' has no exported member '{1}'."), + Type_0_does_not_satisfy_the_constraint_1: diag(2344, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_constraint_1_2344", "Type '{0}' does not satisfy the constraint '{1}'."), + Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: diag(2345, ts.DiagnosticCategory.Error, "Argument_of_type_0_is_not_assignable_to_parameter_of_type_1_2345", "Argument of type '{0}' is not assignable to parameter of type '{1}'."), + Call_target_does_not_contain_any_signatures: diag(2346, ts.DiagnosticCategory.Error, "Call_target_does_not_contain_any_signatures_2346", "Call target does not contain any signatures."), + Untyped_function_calls_may_not_accept_type_arguments: diag(2347, ts.DiagnosticCategory.Error, "Untyped_function_calls_may_not_accept_type_arguments_2347", "Untyped function calls may not accept type arguments."), + Value_of_type_0_is_not_callable_Did_you_mean_to_include_new: diag(2348, ts.DiagnosticCategory.Error, "Value_of_type_0_is_not_callable_Did_you_mean_to_include_new_2348", "Value of type '{0}' is not callable. Did you mean to include 'new'?"), + Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures: diag(2349, ts.DiagnosticCategory.Error, "Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatur_2349", "Cannot invoke an expression whose type lacks a call signature. Type '{0}' has no compatible call signatures."), + Only_a_void_function_can_be_called_with_the_new_keyword: diag(2350, ts.DiagnosticCategory.Error, "Only_a_void_function_can_be_called_with_the_new_keyword_2350", "Only a void function can be called with the 'new' keyword."), + Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature: diag(2351, ts.DiagnosticCategory.Error, "Cannot_use_new_with_an_expression_whose_type_lacks_a_call_or_construct_signature_2351", "Cannot use 'new' with an expression whose type lacks a call or construct signature."), + Type_0_cannot_be_converted_to_type_1: diag(2352, ts.DiagnosticCategory.Error, "Type_0_cannot_be_converted_to_type_1_2352", "Type '{0}' cannot be converted to type '{1}'."), + Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1: diag(2353, ts.DiagnosticCategory.Error, "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353", "Object literal may only specify known properties, and '{0}' does not exist in type '{1}'."), + This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found: diag(2354, ts.DiagnosticCategory.Error, "This_syntax_requires_an_imported_helper_but_module_0_cannot_be_found_2354", "This syntax requires an imported helper but module '{0}' cannot be found."), + A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value: diag(2355, ts.DiagnosticCategory.Error, "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355", "A function whose declared type is neither 'void' nor 'any' must return a value."), + An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type: diag(2356, ts.DiagnosticCategory.Error, "An_arithmetic_operand_must_be_of_type_any_number_or_an_enum_type_2356", "An arithmetic operand must be of type 'any', 'number' or an enum type."), + The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), + The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), + The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol_2360", "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'."), + The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter_2361", "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter."), + The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type."), + The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type."), + The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), + Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), + Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), + Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), + A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), + A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), + A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation: diag(2371, ts.DiagnosticCategory.Error, "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371", "A parameter initializer is only allowed in a function or constructor implementation."), + Parameter_0_cannot_be_referenced_in_its_initializer: diag(2372, ts.DiagnosticCategory.Error, "Parameter_0_cannot_be_referenced_in_its_initializer_2372", "Parameter '{0}' cannot be referenced in its initializer."), + Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it: diag(2373, ts.DiagnosticCategory.Error, "Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it_2373", "Initializer of parameter '{0}' cannot reference identifier '{1}' declared after it."), + Duplicate_string_index_signature: diag(2374, ts.DiagnosticCategory.Error, "Duplicate_string_index_signature_2374", "Duplicate string index signature."), + Duplicate_number_index_signature: diag(2375, ts.DiagnosticCategory.Error, "Duplicate_number_index_signature_2375", "Duplicate number index signature."), + A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_properties_or_has_parameter_properties: diag(2376, ts.DiagnosticCategory.Error, "A_super_call_must_be_the_first_statement_in_the_constructor_when_a_class_contains_initialized_proper_2376", "A 'super' call must be the first statement in the constructor when a class contains initialized properties or has parameter properties."), + Constructors_for_derived_classes_must_contain_a_super_call: diag(2377, ts.DiagnosticCategory.Error, "Constructors_for_derived_classes_must_contain_a_super_call_2377", "Constructors for derived classes must contain a 'super' call."), + A_get_accessor_must_return_a_value: diag(2378, ts.DiagnosticCategory.Error, "A_get_accessor_must_return_a_value_2378", "A 'get' accessor must return a value."), + Getter_and_setter_accessors_do_not_agree_in_visibility: diag(2379, ts.DiagnosticCategory.Error, "Getter_and_setter_accessors_do_not_agree_in_visibility_2379", "Getter and setter accessors do not agree in visibility."), + get_and_set_accessor_must_have_the_same_type: diag(2380, ts.DiagnosticCategory.Error, "get_and_set_accessor_must_have_the_same_type_2380", "'get' and 'set' accessor must have the same type."), + A_signature_with_an_implementation_cannot_use_a_string_literal_type: diag(2381, ts.DiagnosticCategory.Error, "A_signature_with_an_implementation_cannot_use_a_string_literal_type_2381", "A signature with an implementation cannot use a string literal type."), + Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature: diag(2382, ts.DiagnosticCategory.Error, "Specialized_overload_signature_is_not_assignable_to_any_non_specialized_signature_2382", "Specialized overload signature is not assignable to any non-specialized signature."), + Overload_signatures_must_all_be_exported_or_non_exported: diag(2383, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_exported_or_non_exported_2383", "Overload signatures must all be exported or non-exported."), + Overload_signatures_must_all_be_ambient_or_non_ambient: diag(2384, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_ambient_or_non_ambient_2384", "Overload signatures must all be ambient or non-ambient."), + Overload_signatures_must_all_be_public_private_or_protected: diag(2385, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_public_private_or_protected_2385", "Overload signatures must all be public, private or protected."), + Overload_signatures_must_all_be_optional_or_required: diag(2386, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_optional_or_required_2386", "Overload signatures must all be optional or required."), + Function_overload_must_be_static: diag(2387, ts.DiagnosticCategory.Error, "Function_overload_must_be_static_2387", "Function overload must be static."), + Function_overload_must_not_be_static: diag(2388, ts.DiagnosticCategory.Error, "Function_overload_must_not_be_static_2388", "Function overload must not be static."), + Function_implementation_name_must_be_0: diag(2389, ts.DiagnosticCategory.Error, "Function_implementation_name_must_be_0_2389", "Function implementation name must be '{0}'."), + Constructor_implementation_is_missing: diag(2390, ts.DiagnosticCategory.Error, "Constructor_implementation_is_missing_2390", "Constructor implementation is missing."), + Function_implementation_is_missing_or_not_immediately_following_the_declaration: diag(2391, ts.DiagnosticCategory.Error, "Function_implementation_is_missing_or_not_immediately_following_the_declaration_2391", "Function implementation is missing or not immediately following the declaration."), + Multiple_constructor_implementations_are_not_allowed: diag(2392, ts.DiagnosticCategory.Error, "Multiple_constructor_implementations_are_not_allowed_2392", "Multiple constructor implementations are not allowed."), + Duplicate_function_implementation: diag(2393, ts.DiagnosticCategory.Error, "Duplicate_function_implementation_2393", "Duplicate function implementation."), + Overload_signature_is_not_compatible_with_function_implementation: diag(2394, ts.DiagnosticCategory.Error, "Overload_signature_is_not_compatible_with_function_implementation_2394", "Overload signature is not compatible with function implementation."), + Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local: diag(2395, ts.DiagnosticCategory.Error, "Individual_declarations_in_merged_declaration_0_must_be_all_exported_or_all_local_2395", "Individual declarations in merged declaration '{0}' must be all exported or all local."), + Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters: diag(2396, ts.DiagnosticCategory.Error, "Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters_2396", "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters."), + Declaration_name_conflicts_with_built_in_global_identifier_0: diag(2397, ts.DiagnosticCategory.Error, "Declaration_name_conflicts_with_built_in_global_identifier_0_2397", "Declaration name conflicts with built-in global identifier '{0}'."), + Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference: diag(2399, ts.DiagnosticCategory.Error, "Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference_2399", "Duplicate identifier '_this'. Compiler uses variable declaration '_this' to capture 'this' reference."), + Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference: diag(2400, ts.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_this_that_compiler_uses_to_capture_this_reference_2400", "Expression resolves to variable declaration '_this' that compiler uses to capture 'this' reference."), + Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference: diag(2401, ts.DiagnosticCategory.Error, "Duplicate_identifier_super_Compiler_uses_super_to_capture_base_class_reference_2401", "Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference."), + Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference: diag(2402, ts.DiagnosticCategory.Error, "Expression_resolves_to_super_that_compiler_uses_to_capture_base_class_reference_2402", "Expression resolves to '_super' that compiler uses to capture base class reference."), + Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2: diag(2403, ts.DiagnosticCategory.Error, "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403", "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'."), + The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation: diag(2404, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation_2404", "The left-hand side of a 'for...in' statement cannot use a type annotation."), + The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any: diag(2405, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any_2405", "The left-hand side of a 'for...in' statement must be of type 'string' or 'any'."), + The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access: diag(2406, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access_2406", "The left-hand side of a 'for...in' statement must be a variable or a property access."), + The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2407, ts.DiagnosticCategory.Error, "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_2407", "The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter."), + Setters_cannot_return_a_value: diag(2408, ts.DiagnosticCategory.Error, "Setters_cannot_return_a_value_2408", "Setters cannot return a value."), + Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class: diag(2409, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class_2409", "Return type of constructor signature must be assignable to the instance type of the class."), + The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any: diag(2410, ts.DiagnosticCategory.Error, "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410", "The 'with' statement is not supported. All symbols in a 'with' block will have type 'any'."), + Property_0_of_type_1_is_not_assignable_to_string_index_type_2: diag(2411, ts.DiagnosticCategory.Error, "Property_0_of_type_1_is_not_assignable_to_string_index_type_2_2411", "Property '{0}' of type '{1}' is not assignable to string index type '{2}'."), + Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2: diag(2412, ts.DiagnosticCategory.Error, "Property_0_of_type_1_is_not_assignable_to_numeric_index_type_2_2412", "Property '{0}' of type '{1}' is not assignable to numeric index type '{2}'."), + Numeric_index_type_0_is_not_assignable_to_string_index_type_1: diag(2413, ts.DiagnosticCategory.Error, "Numeric_index_type_0_is_not_assignable_to_string_index_type_1_2413", "Numeric index type '{0}' is not assignable to string index type '{1}'."), + Class_name_cannot_be_0: diag(2414, ts.DiagnosticCategory.Error, "Class_name_cannot_be_0_2414", "Class name cannot be '{0}'."), + Class_0_incorrectly_extends_base_class_1: diag(2415, ts.DiagnosticCategory.Error, "Class_0_incorrectly_extends_base_class_1_2415", "Class '{0}' incorrectly extends base class '{1}'."), + Class_static_side_0_incorrectly_extends_base_class_static_side_1: diag(2417, ts.DiagnosticCategory.Error, "Class_static_side_0_incorrectly_extends_base_class_static_side_1_2417", "Class static side '{0}' incorrectly extends base class static side '{1}'."), + Class_0_incorrectly_implements_interface_1: diag(2420, ts.DiagnosticCategory.Error, "Class_0_incorrectly_implements_interface_1_2420", "Class '{0}' incorrectly implements interface '{1}'."), + A_class_may_only_implement_another_class_or_interface: diag(2422, ts.DiagnosticCategory.Error, "A_class_may_only_implement_another_class_or_interface_2422", "A class may only implement another class or interface."), + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_accessor: diag(2423, ts.DiagnosticCategory.Error, "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_access_2423", "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor."), + Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_property: diag(2424, ts.DiagnosticCategory.Error, "Class_0_defines_instance_member_function_1_but_extended_class_2_defines_it_as_instance_member_proper_2424", "Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property."), + Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_function: diag(2425, ts.DiagnosticCategory.Error, "Class_0_defines_instance_member_property_1_but_extended_class_2_defines_it_as_instance_member_functi_2425", "Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function."), + Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_function: diag(2426, ts.DiagnosticCategory.Error, "Class_0_defines_instance_member_accessor_1_but_extended_class_2_defines_it_as_instance_member_functi_2426", "Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function."), + Interface_name_cannot_be_0: diag(2427, ts.DiagnosticCategory.Error, "Interface_name_cannot_be_0_2427", "Interface name cannot be '{0}'."), + All_declarations_of_0_must_have_identical_type_parameters: diag(2428, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_type_parameters_2428", "All declarations of '{0}' must have identical type parameters."), + Interface_0_incorrectly_extends_interface_1: diag(2430, ts.DiagnosticCategory.Error, "Interface_0_incorrectly_extends_interface_1_2430", "Interface '{0}' incorrectly extends interface '{1}'."), + Enum_name_cannot_be_0: diag(2431, ts.DiagnosticCategory.Error, "Enum_name_cannot_be_0_2431", "Enum name cannot be '{0}'."), + In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: diag(2432, ts.DiagnosticCategory.Error, "In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enu_2432", "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element."), + A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: diag(2433, ts.DiagnosticCategory.Error, "A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merg_2433", "A namespace declaration cannot be in a different file from a class or function with which it is merged."), + A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: diag(2434, ts.DiagnosticCategory.Error, "A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged_2434", "A namespace declaration cannot be located prior to a class or function with which it is merged."), + Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces: diag(2435, ts.DiagnosticCategory.Error, "Ambient_modules_cannot_be_nested_in_other_modules_or_namespaces_2435", "Ambient modules cannot be nested in other modules or namespaces."), + Ambient_module_declaration_cannot_specify_relative_module_name: diag(2436, ts.DiagnosticCategory.Error, "Ambient_module_declaration_cannot_specify_relative_module_name_2436", "Ambient module declaration cannot specify relative module name."), + Module_0_is_hidden_by_a_local_declaration_with_the_same_name: diag(2437, ts.DiagnosticCategory.Error, "Module_0_is_hidden_by_a_local_declaration_with_the_same_name_2437", "Module '{0}' is hidden by a local declaration with the same name."), + Import_name_cannot_be_0: diag(2438, ts.DiagnosticCategory.Error, "Import_name_cannot_be_0_2438", "Import name cannot be '{0}'."), + Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: diag(2439, ts.DiagnosticCategory.Error, "Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relati_2439", "Import or export declaration in an ambient module declaration cannot reference module through relative module name."), + Import_declaration_conflicts_with_local_declaration_of_0: diag(2440, ts.DiagnosticCategory.Error, "Import_declaration_conflicts_with_local_declaration_of_0_2440", "Import declaration conflicts with local declaration of '{0}'."), + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: diag(2441, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_2441", "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module."), + Types_have_separate_declarations_of_a_private_property_0: diag(2442, ts.DiagnosticCategory.Error, "Types_have_separate_declarations_of_a_private_property_0_2442", "Types have separate declarations of a private property '{0}'."), + Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: diag(2443, ts.DiagnosticCategory.Error, "Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2_2443", "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'."), + Property_0_is_protected_in_type_1_but_public_in_type_2: diag(2444, ts.DiagnosticCategory.Error, "Property_0_is_protected_in_type_1_but_public_in_type_2_2444", "Property '{0}' is protected in type '{1}' but public in type '{2}'."), + Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses: diag(2445, ts.DiagnosticCategory.Error, "Property_0_is_protected_and_only_accessible_within_class_1_and_its_subclasses_2445", "Property '{0}' is protected and only accessible within class '{1}' and its subclasses."), + Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1: diag(2446, ts.DiagnosticCategory.Error, "Property_0_is_protected_and_only_accessible_through_an_instance_of_class_1_2446", "Property '{0}' is protected and only accessible through an instance of class '{1}'."), + The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead: diag(2447, ts.DiagnosticCategory.Error, "The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead_2447", "The '{0}' operator is not allowed for boolean types. Consider using '{1}' instead."), + Block_scoped_variable_0_used_before_its_declaration: diag(2448, ts.DiagnosticCategory.Error, "Block_scoped_variable_0_used_before_its_declaration_2448", "Block-scoped variable '{0}' used before its declaration."), + Class_0_used_before_its_declaration: diag(2449, ts.DiagnosticCategory.Error, "Class_0_used_before_its_declaration_2449", "Class '{0}' used before its declaration."), + Enum_0_used_before_its_declaration: diag(2450, ts.DiagnosticCategory.Error, "Enum_0_used_before_its_declaration_2450", "Enum '{0}' used before its declaration."), + Cannot_redeclare_block_scoped_variable_0: diag(2451, ts.DiagnosticCategory.Error, "Cannot_redeclare_block_scoped_variable_0_2451", "Cannot redeclare block-scoped variable '{0}'."), + An_enum_member_cannot_have_a_numeric_name: diag(2452, ts.DiagnosticCategory.Error, "An_enum_member_cannot_have_a_numeric_name_2452", "An enum member cannot have a numeric name."), + The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_type_arguments_explicitly: diag(2453, ts.DiagnosticCategory.Error, "The_type_argument_for_type_parameter_0_cannot_be_inferred_from_the_usage_Consider_specifying_the_typ_2453", "The type argument for type parameter '{0}' cannot be inferred from the usage. Consider specifying the type arguments explicitly."), + Variable_0_is_used_before_being_assigned: diag(2454, ts.DiagnosticCategory.Error, "Variable_0_is_used_before_being_assigned_2454", "Variable '{0}' is used before being assigned."), + Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0: diag(2455, ts.DiagnosticCategory.Error, "Type_argument_candidate_1_is_not_a_valid_type_argument_because_it_is_not_a_supertype_of_candidate_0_2455", "Type argument candidate '{1}' is not a valid type argument because it is not a supertype of candidate '{0}'."), + Type_alias_0_circularly_references_itself: diag(2456, ts.DiagnosticCategory.Error, "Type_alias_0_circularly_references_itself_2456", "Type alias '{0}' circularly references itself."), + Type_alias_name_cannot_be_0: diag(2457, ts.DiagnosticCategory.Error, "Type_alias_name_cannot_be_0_2457", "Type alias name cannot be '{0}'."), + An_AMD_module_cannot_have_multiple_name_assignments: diag(2458, ts.DiagnosticCategory.Error, "An_AMD_module_cannot_have_multiple_name_assignments_2458", "An AMD module cannot have multiple name assignments."), + Type_0_has_no_property_1_and_no_string_index_signature: diag(2459, ts.DiagnosticCategory.Error, "Type_0_has_no_property_1_and_no_string_index_signature_2459", "Type '{0}' has no property '{1}' and no string index signature."), + Type_0_has_no_property_1: diag(2460, ts.DiagnosticCategory.Error, "Type_0_has_no_property_1_2460", "Type '{0}' has no property '{1}'."), + Type_0_is_not_an_array_type: diag(2461, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_2461", "Type '{0}' is not an array type."), + A_rest_element_must_be_last_in_a_destructuring_pattern: diag(2462, ts.DiagnosticCategory.Error, "A_rest_element_must_be_last_in_a_destructuring_pattern_2462", "A rest element must be last in a destructuring pattern."), + A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: diag(2463, ts.DiagnosticCategory.Error, "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463", "A binding pattern parameter cannot be optional in an implementation signature."), + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: diag(2464, ts.DiagnosticCategory.Error, "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464", "A computed property name must be of type 'string', 'number', 'symbol', or 'any'."), + this_cannot_be_referenced_in_a_computed_property_name: diag(2465, ts.DiagnosticCategory.Error, "this_cannot_be_referenced_in_a_computed_property_name_2465", "'this' cannot be referenced in a computed property name."), + super_cannot_be_referenced_in_a_computed_property_name: diag(2466, ts.DiagnosticCategory.Error, "super_cannot_be_referenced_in_a_computed_property_name_2466", "'super' cannot be referenced in a computed property name."), + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: diag(2467, ts.DiagnosticCategory.Error, "A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type_2467", "A computed property name cannot reference a type parameter from its containing type."), + Cannot_find_global_value_0: diag(2468, ts.DiagnosticCategory.Error, "Cannot_find_global_value_0_2468", "Cannot find global value '{0}'."), + The_0_operator_cannot_be_applied_to_type_symbol: diag(2469, ts.DiagnosticCategory.Error, "The_0_operator_cannot_be_applied_to_type_symbol_2469", "The '{0}' operator cannot be applied to type 'symbol'."), + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: diag(2470, ts.DiagnosticCategory.Error, "Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object_2470", "'Symbol' reference does not refer to the global Symbol constructor object."), + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: diag(2471, ts.DiagnosticCategory.Error, "A_computed_property_name_of_the_form_0_must_be_of_type_symbol_2471", "A computed property name of the form '{0}' must be of type 'symbol'."), + Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher: diag(2472, ts.DiagnosticCategory.Error, "Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_5_and_higher_2472", "Spread operator in 'new' expressions is only available when targeting ECMAScript 5 and higher."), + Enum_declarations_must_all_be_const_or_non_const: diag(2473, ts.DiagnosticCategory.Error, "Enum_declarations_must_all_be_const_or_non_const_2473", "Enum declarations must all be const or non-const."), + In_const_enum_declarations_member_initializer_must_be_constant_expression: diag(2474, ts.DiagnosticCategory.Error, "In_const_enum_declarations_member_initializer_must_be_constant_expression_2474", "In 'const' enum declarations member initializer must be constant expression."), + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: diag(2475, ts.DiagnosticCategory.Error, "const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475", "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment."), + A_const_enum_member_can_only_be_accessed_using_a_string_literal: diag(2476, ts.DiagnosticCategory.Error, "A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476", "A const enum member can only be accessed using a string literal."), + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: diag(2477, ts.DiagnosticCategory.Error, "const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477", "'const' enum member initializer was evaluated to a non-finite value."), + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: diag(2478, ts.DiagnosticCategory.Error, "const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478", "'const' enum member initializer was evaluated to disallowed value 'NaN'."), + Property_0_does_not_exist_on_const_enum_1: diag(2479, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_const_enum_1_2479", "Property '{0}' does not exist on 'const' enum '{1}'."), + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: diag(2480, ts.DiagnosticCategory.Error, "let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations_2480", "'let' is not allowed to be used as a name in 'let' or 'const' declarations."), + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: diag(2481, ts.DiagnosticCategory.Error, "Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1_2481", "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'."), + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: diag(2483, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation_2483", "The left-hand side of a 'for...of' statement cannot use a type annotation."), + Export_declaration_conflicts_with_exported_declaration_of_0: diag(2484, ts.DiagnosticCategory.Error, "Export_declaration_conflicts_with_exported_declaration_of_0_2484", "Export declaration conflicts with exported declaration of '{0}'."), + The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access: diag(2487, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_of_statement_must_be_a_variable_or_a_property_access_2487", "The left-hand side of a 'for...of' statement must be a variable or a property access."), + Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2488, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488", "Type must have a '[Symbol.iterator]()' method that returns an iterator."), + An_iterator_must_have_a_next_method: diag(2489, ts.DiagnosticCategory.Error, "An_iterator_must_have_a_next_method_2489", "An iterator must have a 'next()' method."), + The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: diag(2490, ts.DiagnosticCategory.Error, "The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property_2490", "The type returned by the 'next()' method of an iterator must have a 'value' property."), + The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: diag(2491, ts.DiagnosticCategory.Error, "The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern_2491", "The left-hand side of a 'for...in' statement cannot be a destructuring pattern."), + Cannot_redeclare_identifier_0_in_catch_clause: diag(2492, ts.DiagnosticCategory.Error, "Cannot_redeclare_identifier_0_in_catch_clause_2492", "Cannot redeclare identifier '{0}' in catch clause."), + Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2: diag(2493, ts.DiagnosticCategory.Error, "Tuple_type_0_with_length_1_cannot_be_assigned_to_tuple_with_length_2_2493", "Tuple type '{0}' with length '{1}' cannot be assigned to tuple with length '{2}'."), + Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: diag(2494, ts.DiagnosticCategory.Error, "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494", "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher."), + Type_0_is_not_an_array_type_or_a_string_type: diag(2495, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_2495", "Type '{0}' is not an array type or a string type."), + The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: diag(2496, ts.DiagnosticCategory.Error, "The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_stand_2496", "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression."), + Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: diag(2497, ts.DiagnosticCategory.Error, "Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct_2497", "Module '{0}' resolves to a non-module entity and cannot be imported using this construct."), + Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: diag(2498, ts.DiagnosticCategory.Error, "Module_0_uses_export_and_cannot_be_used_with_export_Asterisk_2498", "Module '{0}' uses 'export =' and cannot be used with 'export *'."), + An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: diag(2499, ts.DiagnosticCategory.Error, "An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments_2499", "An interface can only extend an identifier/qualified-name with optional type arguments."), + A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: diag(2500, ts.DiagnosticCategory.Error, "A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments_2500", "A class can only implement an identifier/qualified-name with optional type arguments."), + A_rest_element_cannot_contain_a_binding_pattern: diag(2501, ts.DiagnosticCategory.Error, "A_rest_element_cannot_contain_a_binding_pattern_2501", "A rest element cannot contain a binding pattern."), + _0_is_referenced_directly_or_indirectly_in_its_own_type_annotation: diag(2502, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502", "'{0}' is referenced directly or indirectly in its own type annotation."), + Cannot_find_namespace_0: diag(2503, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_2503", "Cannot find namespace '{0}'."), + Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator: diag(2504, ts.DiagnosticCategory.Error, "Type_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504", "Type must have a '[Symbol.asyncIterator]()' method that returns an async iterator."), + A_generator_cannot_have_a_void_type_annotation: diag(2505, ts.DiagnosticCategory.Error, "A_generator_cannot_have_a_void_type_annotation_2505", "A generator cannot have a 'void' type annotation."), + _0_is_referenced_directly_or_indirectly_in_its_own_base_expression: diag(2506, ts.DiagnosticCategory.Error, "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506", "'{0}' is referenced directly or indirectly in its own base expression."), + Type_0_is_not_a_constructor_function_type: diag(2507, ts.DiagnosticCategory.Error, "Type_0_is_not_a_constructor_function_type_2507", "Type '{0}' is not a constructor function type."), + No_base_constructor_has_the_specified_number_of_type_arguments: diag(2508, ts.DiagnosticCategory.Error, "No_base_constructor_has_the_specified_number_of_type_arguments_2508", "No base constructor has the specified number of type arguments."), + Base_constructor_return_type_0_is_not_a_class_or_interface_type: diag(2509, ts.DiagnosticCategory.Error, "Base_constructor_return_type_0_is_not_a_class_or_interface_type_2509", "Base constructor return type '{0}' is not a class or interface type."), + Base_constructors_must_all_have_the_same_return_type: diag(2510, ts.DiagnosticCategory.Error, "Base_constructors_must_all_have_the_same_return_type_2510", "Base constructors must all have the same return type."), + Cannot_create_an_instance_of_the_abstract_class_0: diag(2511, ts.DiagnosticCategory.Error, "Cannot_create_an_instance_of_the_abstract_class_0_2511", "Cannot create an instance of the abstract class '{0}'."), + Overload_signatures_must_all_be_abstract_or_non_abstract: diag(2512, ts.DiagnosticCategory.Error, "Overload_signatures_must_all_be_abstract_or_non_abstract_2512", "Overload signatures must all be abstract or non-abstract."), + Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression: diag(2513, ts.DiagnosticCategory.Error, "Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression_2513", "Abstract method '{0}' in class '{1}' cannot be accessed via super expression."), + Classes_containing_abstract_methods_must_be_marked_abstract: diag(2514, ts.DiagnosticCategory.Error, "Classes_containing_abstract_methods_must_be_marked_abstract_2514", "Classes containing abstract methods must be marked abstract."), + Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2: diag(2515, ts.DiagnosticCategory.Error, "Non_abstract_class_0_does_not_implement_inherited_abstract_member_1_from_class_2_2515", "Non-abstract class '{0}' does not implement inherited abstract member '{1}' from class '{2}'."), + All_declarations_of_an_abstract_method_must_be_consecutive: diag(2516, ts.DiagnosticCategory.Error, "All_declarations_of_an_abstract_method_must_be_consecutive_2516", "All declarations of an abstract method must be consecutive."), + Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type: diag(2517, ts.DiagnosticCategory.Error, "Cannot_assign_an_abstract_constructor_type_to_a_non_abstract_constructor_type_2517", "Cannot assign an abstract constructor type to a non-abstract constructor type."), + A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard: diag(2518, ts.DiagnosticCategory.Error, "A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard_2518", "A 'this'-based type guard is not compatible with a parameter-based type guard."), + An_async_iterator_must_have_a_next_method: diag(2519, ts.DiagnosticCategory.Error, "An_async_iterator_must_have_a_next_method_2519", "An async iterator must have a 'next()' method."), + Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions: diag(2520, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions_2520", "Duplicate identifier '{0}'. Compiler uses declaration '{1}' to support async functions."), + Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions: diag(2521, ts.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_0_that_compiler_uses_to_support_async_functions_2521", "Expression resolves to variable declaration '{0}' that compiler uses to support async functions."), + The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method: diag(2522, ts.DiagnosticCategory.Error, "The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_usi_2522", "The 'arguments' object cannot be referenced in an async function or method in ES3 and ES5. Consider using a standard function or method."), + yield_expressions_cannot_be_used_in_a_parameter_initializer: diag(2523, ts.DiagnosticCategory.Error, "yield_expressions_cannot_be_used_in_a_parameter_initializer_2523", "'yield' expressions cannot be used in a parameter initializer."), + await_expressions_cannot_be_used_in_a_parameter_initializer: diag(2524, ts.DiagnosticCategory.Error, "await_expressions_cannot_be_used_in_a_parameter_initializer_2524", "'await' expressions cannot be used in a parameter initializer."), + Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value: diag(2525, ts.DiagnosticCategory.Error, "Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value_2525", "Initializer provides no value for this binding element and the binding element has no default value."), + A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface: diag(2526, ts.DiagnosticCategory.Error, "A_this_type_is_available_only_in_a_non_static_member_of_a_class_or_interface_2526", "A 'this' type is available only in a non-static member of a class or interface."), + The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary: diag(2527, ts.DiagnosticCategory.Error, "The_inferred_type_of_0_references_an_inaccessible_this_type_A_type_annotation_is_necessary_2527", "The inferred type of '{0}' references an inaccessible 'this' type. A type annotation is necessary."), + A_module_cannot_have_multiple_default_exports: diag(2528, ts.DiagnosticCategory.Error, "A_module_cannot_have_multiple_default_exports_2528", "A module cannot have multiple default exports."), + Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions: diag(2529, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_func_2529", "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module containing async functions."), + Property_0_is_incompatible_with_index_signature: diag(2530, ts.DiagnosticCategory.Error, "Property_0_is_incompatible_with_index_signature_2530", "Property '{0}' is incompatible with index signature."), + Object_is_possibly_null: diag(2531, ts.DiagnosticCategory.Error, "Object_is_possibly_null_2531", "Object is possibly 'null'."), + Object_is_possibly_undefined: diag(2532, ts.DiagnosticCategory.Error, "Object_is_possibly_undefined_2532", "Object is possibly 'undefined'."), + Object_is_possibly_null_or_undefined: diag(2533, ts.DiagnosticCategory.Error, "Object_is_possibly_null_or_undefined_2533", "Object is possibly 'null' or 'undefined'."), + A_function_returning_never_cannot_have_a_reachable_end_point: diag(2534, ts.DiagnosticCategory.Error, "A_function_returning_never_cannot_have_a_reachable_end_point_2534", "A function returning 'never' cannot have a reachable end point."), + Enum_type_0_has_members_with_initializers_that_are_not_literals: diag(2535, ts.DiagnosticCategory.Error, "Enum_type_0_has_members_with_initializers_that_are_not_literals_2535", "Enum type '{0}' has members with initializers that are not literals."), + Type_0_cannot_be_used_to_index_type_1: diag(2536, ts.DiagnosticCategory.Error, "Type_0_cannot_be_used_to_index_type_1_2536", "Type '{0}' cannot be used to index type '{1}'."), + Type_0_has_no_matching_index_signature_for_type_1: diag(2537, ts.DiagnosticCategory.Error, "Type_0_has_no_matching_index_signature_for_type_1_2537", "Type '{0}' has no matching index signature for type '{1}'."), + Type_0_cannot_be_used_as_an_index_type: diag(2538, ts.DiagnosticCategory.Error, "Type_0_cannot_be_used_as_an_index_type_2538", "Type '{0}' cannot be used as an index type."), + Cannot_assign_to_0_because_it_is_not_a_variable: diag(2539, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_not_a_variable_2539", "Cannot assign to '{0}' because it is not a variable."), + Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property: diag(2540, ts.DiagnosticCategory.Error, "Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property_2540", "Cannot assign to '{0}' because it is a constant or a read-only property."), + The_target_of_an_assignment_must_be_a_variable_or_a_property_access: diag(2541, ts.DiagnosticCategory.Error, "The_target_of_an_assignment_must_be_a_variable_or_a_property_access_2541", "The target of an assignment must be a variable or a property access."), + Index_signature_in_type_0_only_permits_reading: diag(2542, ts.DiagnosticCategory.Error, "Index_signature_in_type_0_only_permits_reading_2542", "Index signature in type '{0}' only permits reading."), + Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference: diag(2543, ts.DiagnosticCategory.Error, "Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_me_2543", "Duplicate identifier '_newTarget'. Compiler uses variable declaration '_newTarget' to capture 'new.target' meta-property reference."), + Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta_property_reference: diag(2544, ts.DiagnosticCategory.Error, "Expression_resolves_to_variable_declaration_newTarget_that_compiler_uses_to_capture_new_target_meta__2544", "Expression resolves to variable declaration '_newTarget' that compiler uses to capture 'new.target' meta-property reference."), + A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any: diag(2545, ts.DiagnosticCategory.Error, "A_mixin_class_must_have_a_constructor_with_a_single_rest_parameter_of_type_any_2545", "A mixin class must have a constructor with a single rest parameter of type 'any[]'."), + Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1: diag(2546, ts.DiagnosticCategory.Error, "Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1_2546", "Property '{0}' has conflicting declarations and is inaccessible in type '{1}'."), + The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value_property: diag(2547, ts.DiagnosticCategory.Error, "The_type_returned_by_the_next_method_of_an_async_iterator_must_be_a_promise_for_a_type_with_a_value__2547", "The type returned by the 'next()' method of an async iterator must be a promise for a type with a 'value' property."), + Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2548, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator_2548", "Type '{0}' is not an array type or does not have a '[Symbol.iterator]()' method that returns an iterator."), + Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator: diag(2549, ts.DiagnosticCategory.Error, "Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns__2549", "Type '{0}' is not an array type or a string type or does not have a '[Symbol.iterator]()' method that returns an iterator."), + Generic_type_instantiation_is_excessively_deep_and_possibly_infinite: diag(2550, ts.DiagnosticCategory.Error, "Generic_type_instantiation_is_excessively_deep_and_possibly_infinite_2550", "Generic type instantiation is excessively deep and possibly infinite."), + Property_0_does_not_exist_on_type_1_Did_you_mean_2: diag(2551, ts.DiagnosticCategory.Error, "Property_0_does_not_exist_on_type_1_Did_you_mean_2_2551", "Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?"), + Cannot_find_name_0_Did_you_mean_1: diag(2552, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_1_2552", "Cannot find name '{0}'. Did you mean '{1}'?"), + Computed_values_are_not_permitted_in_an_enum_with_string_valued_members: diag(2553, ts.DiagnosticCategory.Error, "Computed_values_are_not_permitted_in_an_enum_with_string_valued_members_2553", "Computed values are not permitted in an enum with string valued members."), + Expected_0_arguments_but_got_1: diag(2554, ts.DiagnosticCategory.Error, "Expected_0_arguments_but_got_1_2554", "Expected {0} arguments, but got {1}."), + Expected_at_least_0_arguments_but_got_1: diag(2555, ts.DiagnosticCategory.Error, "Expected_at_least_0_arguments_but_got_1_2555", "Expected at least {0} arguments, but got {1}."), + Expected_0_arguments_but_got_a_minimum_of_1: diag(2556, ts.DiagnosticCategory.Error, "Expected_0_arguments_but_got_a_minimum_of_1_2556", "Expected {0} arguments, but got a minimum of {1}."), + Expected_at_least_0_arguments_but_got_a_minimum_of_1: diag(2557, ts.DiagnosticCategory.Error, "Expected_at_least_0_arguments_but_got_a_minimum_of_1_2557", "Expected at least {0} arguments, but got a minimum of {1}."), + Expected_0_type_arguments_but_got_1: diag(2558, ts.DiagnosticCategory.Error, "Expected_0_type_arguments_but_got_1_2558", "Expected {0} type arguments, but got {1}."), + Type_0_has_no_properties_in_common_with_type_1: diag(2559, ts.DiagnosticCategory.Error, "Type_0_has_no_properties_in_common_with_type_1_2559", "Type '{0}' has no properties in common with type '{1}'."), + Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it: diag(2560, ts.DiagnosticCategory.Error, "Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it_2560", "Value of type '{0}' has no properties in common with type '{1}'. Did you mean to call it?"), + JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."), + The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."), + JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."), + Property_0_in_type_1_is_not_assignable_to_type_2: diag(2603, ts.DiagnosticCategory.Error, "Property_0_in_type_1_is_not_assignable_to_type_2_2603", "Property '{0}' in type '{1}' is not assignable to type '{2}'."), + JSX_element_type_0_does_not_have_any_construct_or_call_signatures: diag(2604, ts.DiagnosticCategory.Error, "JSX_element_type_0_does_not_have_any_construct_or_call_signatures_2604", "JSX element type '{0}' does not have any construct or call signatures."), + JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: diag(2605, ts.DiagnosticCategory.Error, "JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements_2605", "JSX element type '{0}' is not a constructor function for JSX elements."), + Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property: diag(2606, ts.DiagnosticCategory.Error, "Property_0_of_JSX_spread_attribute_is_not_assignable_to_target_property_2606", "Property '{0}' of JSX spread attribute is not assignable to target property."), + JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property: diag(2607, ts.DiagnosticCategory.Error, "JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property_2607", "JSX element class does not support attributes because it does not have a '{0}' property."), + The_global_type_JSX_0_may_not_have_more_than_one_property: diag(2608, ts.DiagnosticCategory.Error, "The_global_type_JSX_0_may_not_have_more_than_one_property_2608", "The global type 'JSX.{0}' may not have more than one property."), + JSX_spread_child_must_be_an_array_type: diag(2609, ts.DiagnosticCategory.Error, "JSX_spread_child_must_be_an_array_type_2609", "JSX spread child must be an array type."), + Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), + A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), + Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), + Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1: diag(2653, ts.DiagnosticCategory.Error, "Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1_2653", "Non-abstract class expression does not implement inherited abstract member '{0}' from class '{1}'."), + Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_package_author_to_update_the_package_definition: diag(2654, ts.DiagnosticCategory.Error, "Exported_external_package_typings_file_cannot_contain_tripleslash_references_Please_contact_the_pack_2654", "Exported external package typings file cannot contain tripleslash references. Please contact the package author to update the package definition."), + Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_the_package_definition: diag(2656, ts.DiagnosticCategory.Error, "Exported_external_package_typings_file_0_is_not_a_module_Please_contact_the_package_author_to_update_2656", "Exported external package typings file '{0}' is not a module. Please contact the package author to update the package definition."), + JSX_expressions_must_have_one_parent_element: diag(2657, ts.DiagnosticCategory.Error, "JSX_expressions_must_have_one_parent_element_2657", "JSX expressions must have one parent element."), + Type_0_provides_no_match_for_the_signature_1: diag(2658, ts.DiagnosticCategory.Error, "Type_0_provides_no_match_for_the_signature_1_2658", "Type '{0}' provides no match for the signature '{1}'."), + super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher: diag(2659, ts.DiagnosticCategory.Error, "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659", "'super' is only allowed in members of object literal expressions when option 'target' is 'ES2015' or higher."), + super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions: diag(2660, ts.DiagnosticCategory.Error, "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660", "'super' can only be referenced in members of derived classes or object literal expressions."), + Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module: diag(2661, ts.DiagnosticCategory.Error, "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661", "Cannot export '{0}'. Only local declarations can be exported from a module."), + Cannot_find_name_0_Did_you_mean_the_static_member_1_0: diag(2662, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_the_static_member_1_0_2662", "Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?"), + Cannot_find_name_0_Did_you_mean_the_instance_member_this_0: diag(2663, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Did_you_mean_the_instance_member_this_0_2663", "Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?"), + Invalid_module_name_in_augmentation_module_0_cannot_be_found: diag(2664, ts.DiagnosticCategory.Error, "Invalid_module_name_in_augmentation_module_0_cannot_be_found_2664", "Invalid module name in augmentation, module '{0}' cannot be found."), + Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augmented: diag(2665, ts.DiagnosticCategory.Error, "Invalid_module_name_in_augmentation_Module_0_resolves_to_an_untyped_module_at_1_which_cannot_be_augm_2665", "Invalid module name in augmentation. Module '{0}' resolves to an untyped module at '{1}', which cannot be augmented."), + Exports_and_export_assignments_are_not_permitted_in_module_augmentations: diag(2666, ts.DiagnosticCategory.Error, "Exports_and_export_assignments_are_not_permitted_in_module_augmentations_2666", "Exports and export assignments are not permitted in module augmentations."), + Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module: diag(2667, ts.DiagnosticCategory.Error, "Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_mod_2667", "Imports are not permitted in module augmentations. Consider moving them to the enclosing external module."), + export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always_visible: diag(2668, ts.DiagnosticCategory.Error, "export_modifier_cannot_be_applied_to_ambient_modules_and_module_augmentations_since_they_are_always__2668", "'export' modifier cannot be applied to ambient modules and module augmentations since they are always visible."), + Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations: diag(2669, ts.DiagnosticCategory.Error, "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669", "Augmentations for the global scope can only be directly nested in external modules or ambient module declarations."), + Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambient_context: diag(2670, ts.DiagnosticCategory.Error, "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670", "Augmentations for the global scope should have 'declare' modifier unless they appear in already ambient context."), + Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity: diag(2671, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671", "Cannot augment module '{0}' because it resolves to a non-module entity."), + Cannot_assign_a_0_constructor_type_to_a_1_constructor_type: diag(2672, ts.DiagnosticCategory.Error, "Cannot_assign_a_0_constructor_type_to_a_1_constructor_type_2672", "Cannot assign a '{0}' constructor type to a '{1}' constructor type."), + Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration: diag(2673, ts.DiagnosticCategory.Error, "Constructor_of_class_0_is_private_and_only_accessible_within_the_class_declaration_2673", "Constructor of class '{0}' is private and only accessible within the class declaration."), + Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration: diag(2674, ts.DiagnosticCategory.Error, "Constructor_of_class_0_is_protected_and_only_accessible_within_the_class_declaration_2674", "Constructor of class '{0}' is protected and only accessible within the class declaration."), + Cannot_extend_a_class_0_Class_constructor_is_marked_as_private: diag(2675, ts.DiagnosticCategory.Error, "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675", "Cannot extend a class '{0}'. Class constructor is marked as private."), + Accessors_must_both_be_abstract_or_non_abstract: diag(2676, ts.DiagnosticCategory.Error, "Accessors_must_both_be_abstract_or_non_abstract_2676", "Accessors must both be abstract or non-abstract."), + A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type: diag(2677, ts.DiagnosticCategory.Error, "A_type_predicate_s_type_must_be_assignable_to_its_parameter_s_type_2677", "A type predicate's type must be assignable to its parameter's type."), + Type_0_is_not_comparable_to_type_1: diag(2678, ts.DiagnosticCategory.Error, "Type_0_is_not_comparable_to_type_1_2678", "Type '{0}' is not comparable to type '{1}'."), + A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void: diag(2679, ts.DiagnosticCategory.Error, "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679", "A function that is called with the 'new' keyword cannot have a 'this' type that is 'void'."), + A_0_parameter_must_be_the_first_parameter: diag(2680, ts.DiagnosticCategory.Error, "A_0_parameter_must_be_the_first_parameter_2680", "A '{0}' parameter must be the first parameter."), + A_constructor_cannot_have_a_this_parameter: diag(2681, ts.DiagnosticCategory.Error, "A_constructor_cannot_have_a_this_parameter_2681", "A constructor cannot have a 'this' parameter."), + get_and_set_accessor_must_have_the_same_this_type: diag(2682, ts.DiagnosticCategory.Error, "get_and_set_accessor_must_have_the_same_this_type_2682", "'get' and 'set' accessor must have the same 'this' type."), + this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation: diag(2683, ts.DiagnosticCategory.Error, "this_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_2683", "'this' implicitly has type 'any' because it does not have a type annotation."), + The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1: diag(2684, ts.DiagnosticCategory.Error, "The_this_context_of_type_0_is_not_assignable_to_method_s_this_of_type_1_2684", "The 'this' context of type '{0}' is not assignable to method's 'this' of type '{1}'."), + The_this_types_of_each_signature_are_incompatible: diag(2685, ts.DiagnosticCategory.Error, "The_this_types_of_each_signature_are_incompatible_2685", "The 'this' types of each signature are incompatible."), + _0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead: diag(2686, ts.DiagnosticCategory.Error, "_0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead_2686", "'{0}' refers to a UMD global, but the current file is a module. Consider adding an import instead."), + All_declarations_of_0_must_have_identical_modifiers: diag(2687, ts.DiagnosticCategory.Error, "All_declarations_of_0_must_have_identical_modifiers_2687", "All declarations of '{0}' must have identical modifiers."), + Cannot_find_type_definition_file_for_0: diag(2688, ts.DiagnosticCategory.Error, "Cannot_find_type_definition_file_for_0_2688", "Cannot find type definition file for '{0}'."), + Cannot_extend_an_interface_0_Did_you_mean_implements: diag(2689, ts.DiagnosticCategory.Error, "Cannot_extend_an_interface_0_Did_you_mean_implements_2689", "Cannot extend an interface '{0}'. Did you mean 'implements'?"), + An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead: diag(2691, ts.DiagnosticCategory.Error, "An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead_2691", "An import path cannot end with a '{0}' extension. Consider importing '{1}' instead."), + _0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible: diag(2692, ts.DiagnosticCategory.Error, "_0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible_2692", "'{0}' is a primitive, but '{1}' is a wrapper object. Prefer using '{0}' when possible."), + _0_only_refers_to_a_type_but_is_being_used_as_a_value_here: diag(2693, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_value_here_2693", "'{0}' only refers to a type, but is being used as a value here."), + Namespace_0_has_no_exported_member_1: diag(2694, ts.DiagnosticCategory.Error, "Namespace_0_has_no_exported_member_1_2694", "Namespace '{0}' has no exported member '{1}'."), + Left_side_of_comma_operator_is_unused_and_has_no_side_effects: diag(2695, ts.DiagnosticCategory.Error, "Left_side_of_comma_operator_is_unused_and_has_no_side_effects_2695", "Left side of comma operator is unused and has no side effects."), + The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead: diag(2696, ts.DiagnosticCategory.Error, "The_Object_type_is_assignable_to_very_few_other_types_Did_you_mean_to_use_the_any_type_instead_2696", "The 'Object' type is assignable to very few other types. Did you mean to use the 'any' type instead?"), + An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: diag(2697, ts.DiagnosticCategory.Error, "An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_in_2697", "An async function or method must return a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option."), + Spread_types_may_only_be_created_from_object_types: diag(2698, ts.DiagnosticCategory.Error, "Spread_types_may_only_be_created_from_object_types_2698", "Spread types may only be created from object types."), + Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1: diag(2699, ts.DiagnosticCategory.Error, "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699", "Static property '{0}' conflicts with built-in property 'Function.{0}' of constructor function '{1}'."), + Rest_types_may_only_be_created_from_object_types: diag(2700, ts.DiagnosticCategory.Error, "Rest_types_may_only_be_created_from_object_types_2700", "Rest types may only be created from object types."), + The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access: diag(2701, ts.DiagnosticCategory.Error, "The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access_2701", "The target of an object rest assignment must be a variable or a property access."), + _0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here: diag(2702, ts.DiagnosticCategory.Error, "_0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here_2702", "'{0}' only refers to a type, but is being used as a namespace here."), + The_operand_of_a_delete_operator_must_be_a_property_reference: diag(2703, ts.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_must_be_a_property_reference_2703", "The operand of a delete operator must be a property reference."), + The_operand_of_a_delete_operator_cannot_be_a_read_only_property: diag(2704, ts.DiagnosticCategory.Error, "The_operand_of_a_delete_operator_cannot_be_a_read_only_property_2704", "The operand of a delete operator cannot be a read-only property."), + An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: diag(2705, ts.DiagnosticCategory.Error, "An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_de_2705", "An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option."), + Required_type_parameters_may_not_follow_optional_type_parameters: diag(2706, ts.DiagnosticCategory.Error, "Required_type_parameters_may_not_follow_optional_type_parameters_2706", "Required type parameters may not follow optional type parameters."), + Generic_type_0_requires_between_1_and_2_type_arguments: diag(2707, ts.DiagnosticCategory.Error, "Generic_type_0_requires_between_1_and_2_type_arguments_2707", "Generic type '{0}' requires between {1} and {2} type arguments."), + Cannot_use_namespace_0_as_a_value: diag(2708, ts.DiagnosticCategory.Error, "Cannot_use_namespace_0_as_a_value_2708", "Cannot use namespace '{0}' as a value."), + Cannot_use_namespace_0_as_a_type: diag(2709, ts.DiagnosticCategory.Error, "Cannot_use_namespace_0_as_a_type_2709", "Cannot use namespace '{0}' as a type."), + _0_are_specified_twice_The_attribute_named_0_will_be_overwritten: diag(2710, ts.DiagnosticCategory.Error, "_0_are_specified_twice_The_attribute_named_0_will_be_overwritten_2710", "'{0}' are specified twice. The attribute named '{0}' will be overwritten."), + A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option: diag(2711, ts.DiagnosticCategory.Error, "A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711", "A dynamic import call returns a 'Promise'. Make sure you have a declaration for 'Promise' or include 'ES2015' in your `--lib` option."), + A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option: diag(2712, ts.DiagnosticCategory.Error, "A_dynamic_import_call_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declarat_2712", "A dynamic import call in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option."), + Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1: diag(2713, ts.DiagnosticCategory.Error, "Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_p_2713", "Cannot access '{0}.{1}' because '{0}' is a type, but not a namespace. Did you mean to retrieve the type of the property '{1}' in '{0}' with '{0}[\"{1}\"]'?"), + Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), + Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), + Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), + Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4006, ts.DiagnosticCategory.Error, "Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4006", "Type parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."), + Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4008, ts.DiagnosticCategory.Error, "Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4008", "Type parameter '{0}' of call signature from exported interface has or is using private name '{1}'."), + Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: diag(4010, ts.DiagnosticCategory.Error, "Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4010", "Type parameter '{0}' of public static method from exported class has or is using private name '{1}'."), + Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: diag(4012, ts.DiagnosticCategory.Error, "Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4012", "Type parameter '{0}' of public method from exported class has or is using private name '{1}'."), + Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: diag(4014, ts.DiagnosticCategory.Error, "Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4014", "Type parameter '{0}' of method from exported interface has or is using private name '{1}'."), + Type_parameter_0_of_exported_function_has_or_is_using_private_name_1: diag(4016, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_function_has_or_is_using_private_name_1_4016", "Type parameter '{0}' of exported function has or is using private name '{1}'."), + Implements_clause_of_exported_class_0_has_or_is_using_private_name_1: diag(4019, ts.DiagnosticCategory.Error, "Implements_clause_of_exported_class_0_has_or_is_using_private_name_1_4019", "Implements clause of exported class '{0}' has or is using private name '{1}'."), + extends_clause_of_exported_class_0_has_or_is_using_private_name_1: diag(4020, ts.DiagnosticCategory.Error, "extends_clause_of_exported_class_0_has_or_is_using_private_name_1_4020", "'extends' clause of exported class '{0}' has or is using private name '{1}'."), + extends_clause_of_exported_interface_0_has_or_is_using_private_name_1: diag(4022, ts.DiagnosticCategory.Error, "extends_clause_of_exported_interface_0_has_or_is_using_private_name_1_4022", "'extends' clause of exported interface '{0}' has or is using private name '{1}'."), + Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4023, ts.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4023", "Exported variable '{0}' has or is using name '{1}' from external module {2} but cannot be named."), + Exported_variable_0_has_or_is_using_name_1_from_private_module_2: diag(4024, ts.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_name_1_from_private_module_2_4024", "Exported variable '{0}' has or is using name '{1}' from private module '{2}'."), + Exported_variable_0_has_or_is_using_private_name_1: diag(4025, ts.DiagnosticCategory.Error, "Exported_variable_0_has_or_is_using_private_name_1_4025", "Exported variable '{0}' has or is using private name '{1}'."), + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4026, ts.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot__4026", "Public static property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."), + Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4027, ts.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4027", "Public static property '{0}' of exported class has or is using name '{1}' from private module '{2}'."), + Public_static_property_0_of_exported_class_has_or_is_using_private_name_1: diag(4028, ts.DiagnosticCategory.Error, "Public_static_property_0_of_exported_class_has_or_is_using_private_name_1_4028", "Public static property '{0}' of exported class has or is using private name '{1}'."), + Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4029, ts.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_name_4029", "Public property '{0}' of exported class has or is using name '{1}' from external module {2} but cannot be named."), + Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4030, ts.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4030", "Public property '{0}' of exported class has or is using name '{1}' from private module '{2}'."), + Public_property_0_of_exported_class_has_or_is_using_private_name_1: diag(4031, ts.DiagnosticCategory.Error, "Public_property_0_of_exported_class_has_or_is_using_private_name_1_4031", "Public property '{0}' of exported class has or is using private name '{1}'."), + Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4032, ts.DiagnosticCategory.Error, "Property_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4032", "Property '{0}' of exported interface has or is using name '{1}' from private module '{2}'."), + Property_0_of_exported_interface_has_or_is_using_private_name_1: diag(4033, ts.DiagnosticCategory.Error, "Property_0_of_exported_interface_has_or_is_using_private_name_1_4033", "Property '{0}' of exported interface has or is using private name '{1}'."), + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4034, ts.DiagnosticCategory.Error, "Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_name_1_from_private_4034", "Parameter '{0}' of public static property setter from exported class has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1: diag(4035, ts.DiagnosticCategory.Error, "Parameter_0_of_public_static_property_setter_from_exported_class_has_or_is_using_private_name_1_4035", "Parameter '{0}' of public static property setter from exported class has or is using private name '{1}'."), + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4036, ts.DiagnosticCategory.Error, "Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_name_1_from_private_module_4036", "Parameter '{0}' of public property setter from exported class has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1: diag(4037, ts.DiagnosticCategory.Error, "Parameter_0_of_public_property_setter_from_exported_class_has_or_is_using_private_name_1_4037", "Parameter '{0}' of public property setter from exported class has or is using private name '{1}'."), + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4038, ts.DiagnosticCategory.Error, "Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_externa_4038", "Return type of public static property getter from exported class has or is using name '{0}' from external module {1} but cannot be named."), + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: diag(4039, ts.DiagnosticCategory.Error, "Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_name_0_from_private_4039", "Return type of public static property getter from exported class has or is using name '{0}' from private module '{1}'."), + Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0: diag(4040, ts.DiagnosticCategory.Error, "Return_type_of_public_static_property_getter_from_exported_class_has_or_is_using_private_name_0_4040", "Return type of public static property getter from exported class has or is using private name '{0}'."), + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4041, ts.DiagnosticCategory.Error, "Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_external_modul_4041", "Return type of public property getter from exported class has or is using name '{0}' from external module {1} but cannot be named."), + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_1: diag(4042, ts.DiagnosticCategory.Error, "Return_type_of_public_property_getter_from_exported_class_has_or_is_using_name_0_from_private_module_4042", "Return type of public property getter from exported class has or is using name '{0}' from private module '{1}'."), + Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0: diag(4043, ts.DiagnosticCategory.Error, "Return_type_of_public_property_getter_from_exported_class_has_or_is_using_private_name_0_4043", "Return type of public property getter from exported class has or is using private name '{0}'."), + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4044, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_mod_4044", "Return type of constructor signature from exported interface has or is using name '{0}' from private module '{1}'."), + Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4045, ts.DiagnosticCategory.Error, "Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0_4045", "Return type of constructor signature from exported interface has or is using private name '{0}'."), + Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4046, ts.DiagnosticCategory.Error, "Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4046", "Return type of call signature from exported interface has or is using name '{0}' from private module '{1}'."), + Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4047, ts.DiagnosticCategory.Error, "Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0_4047", "Return type of call signature from exported interface has or is using private name '{0}'."), + Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4048, ts.DiagnosticCategory.Error, "Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4048", "Return type of index signature from exported interface has or is using name '{0}' from private module '{1}'."), + Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0: diag(4049, ts.DiagnosticCategory.Error, "Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0_4049", "Return type of index signature from exported interface has or is using private name '{0}'."), + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4050, ts.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_external_module__4050", "Return type of public static method from exported class has or is using name '{0}' from external module {1} but cannot be named."), + Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: diag(4051, ts.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4051", "Return type of public static method from exported class has or is using name '{0}' from private module '{1}'."), + Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0: diag(4052, ts.DiagnosticCategory.Error, "Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0_4052", "Return type of public static method from exported class has or is using private name '{0}'."), + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4053, ts.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_c_4053", "Return type of public method from exported class has or is using name '{0}' from external module {1} but cannot be named."), + Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1: diag(4054, ts.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_private_module_1_4054", "Return type of public method from exported class has or is using name '{0}' from private module '{1}'."), + Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0: diag(4055, ts.DiagnosticCategory.Error, "Return_type_of_public_method_from_exported_class_has_or_is_using_private_name_0_4055", "Return type of public method from exported class has or is using private name '{0}'."), + Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1: diag(4056, ts.DiagnosticCategory.Error, "Return_type_of_method_from_exported_interface_has_or_is_using_name_0_from_private_module_1_4056", "Return type of method from exported interface has or is using name '{0}' from private module '{1}'."), + Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0: diag(4057, ts.DiagnosticCategory.Error, "Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0_4057", "Return type of method from exported interface has or is using private name '{0}'."), + Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named: diag(4058, ts.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named_4058", "Return type of exported function has or is using name '{0}' from external module {1} but cannot be named."), + Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1: diag(4059, ts.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_name_0_from_private_module_1_4059", "Return type of exported function has or is using name '{0}' from private module '{1}'."), + Return_type_of_exported_function_has_or_is_using_private_name_0: diag(4060, ts.DiagnosticCategory.Error, "Return_type_of_exported_function_has_or_is_using_private_name_0_4060", "Return type of exported function has or is using private name '{0}'."), + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4061, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_can_4061", "Parameter '{0}' of constructor from exported class has or is using name '{1}' from external module {2} but cannot be named."), + Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4062, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2_4062", "Parameter '{0}' of constructor from exported class has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1: diag(4063, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1_4063", "Parameter '{0}' of constructor from exported class has or is using private name '{1}'."), + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4064, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_mod_4064", "Parameter '{0}' of constructor signature from exported interface has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4065, ts.DiagnosticCategory.Error, "Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1_4065", "Parameter '{0}' of constructor signature from exported interface has or is using private name '{1}'."), + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4066, ts.DiagnosticCategory.Error, "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4066", "Parameter '{0}' of call signature from exported interface has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4067, ts.DiagnosticCategory.Error, "Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1_4067", "Parameter '{0}' of call signature from exported interface has or is using private name '{1}'."), + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4068, ts.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_external_module__4068", "Parameter '{0}' of public static method from exported class has or is using name '{1}' from external module {2} but cannot be named."), + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4069, ts.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4069", "Parameter '{0}' of public static method from exported class has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1: diag(4070, ts.DiagnosticCategory.Error, "Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1_4070", "Parameter '{0}' of public static method from exported class has or is using private name '{1}'."), + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4071, ts.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_c_4071", "Parameter '{0}' of public method from exported class has or is using name '{1}' from external module {2} but cannot be named."), + Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2: diag(4072, ts.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_private_module_2_4072", "Parameter '{0}' of public method from exported class has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1: diag(4073, ts.DiagnosticCategory.Error, "Parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1_4073", "Parameter '{0}' of public method from exported class has or is using private name '{1}'."), + Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4074, ts.DiagnosticCategory.Error, "Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4074", "Parameter '{0}' of method from exported interface has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1: diag(4075, ts.DiagnosticCategory.Error, "Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1_4075", "Parameter '{0}' of method from exported interface has or is using private name '{1}'."), + Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named: diag(4076, ts.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4076", "Parameter '{0}' of exported function has or is using name '{1}' from external module {2} but cannot be named."), + Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: diag(4077, ts.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2_4077", "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_exported_function_has_or_is_using_private_name_1: diag(4078, ts.DiagnosticCategory.Error, "Parameter_0_of_exported_function_has_or_is_using_private_name_1_4078", "Parameter '{0}' of exported function has or is using private name '{1}'."), + Exported_type_alias_0_has_or_is_using_private_name_1: diag(4081, ts.DiagnosticCategory.Error, "Exported_type_alias_0_has_or_is_using_private_name_1_4081", "Exported type alias '{0}' has or is using private name '{1}'."), + Default_export_of_the_module_has_or_is_using_private_name_0: diag(4082, ts.DiagnosticCategory.Error, "Default_export_of_the_module_has_or_is_using_private_name_0_4082", "Default export of the module has or is using private name '{0}'."), + Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1: diag(4083, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1_4083", "Type parameter '{0}' of exported type alias has or is using private name '{1}'."), + Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_library_to_resolve_the_conflict: diag(4090, ts.DiagnosticCategory.Message, "Conflicting_definitions_for_0_found_at_1_and_2_Consider_installing_a_specific_version_of_this_librar_4090", "Conflicting definitions for '{0}' found at '{1}' and '{2}'. Consider installing a specific version of this library to resolve the conflict."), + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4091, ts.DiagnosticCategory.Error, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2_4091", "Parameter '{0}' of index signature from exported interface has or is using name '{1}' from private module '{2}'."), + Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1: diag(4092, ts.DiagnosticCategory.Error, "Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1_4092", "Parameter '{0}' of index signature from exported interface has or is using private name '{1}'."), + Property_0_of_exported_class_expression_may_not_be_private_or_protected: diag(4094, ts.DiagnosticCategory.Error, "Property_0_of_exported_class_expression_may_not_be_private_or_protected_4094", "Property '{0}' of exported class expression may not be private or protected."), + 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}'."), + File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0: diag(5011, ts.DiagnosticCategory.Error, "File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0_5011", "File specification cannot contain multiple recursive directory wildcards ('**'): '{0}'."), + Cannot_read_file_0_Colon_1: diag(5012, ts.DiagnosticCategory.Error, "Cannot_read_file_0_Colon_1_5012", "Cannot read file '{0}': {1}."), + Failed_to_parse_file_0_Colon_1: diag(5014, ts.DiagnosticCategory.Error, "Failed_to_parse_file_0_Colon_1_5014", "Failed to parse file '{0}': {1}."), + Unknown_compiler_option_0: diag(5023, ts.DiagnosticCategory.Error, "Unknown_compiler_option_0_5023", "Unknown compiler option '{0}'."), + Compiler_option_0_requires_a_value_of_type_1: diag(5024, ts.DiagnosticCategory.Error, "Compiler_option_0_requires_a_value_of_type_1_5024", "Compiler option '{0}' requires a value of type {1}."), + Could_not_write_file_0_Colon_1: diag(5033, ts.DiagnosticCategory.Error, "Could_not_write_file_0_Colon_1_5033", "Could not write file '{0}': {1}."), + Option_project_cannot_be_mixed_with_source_files_on_a_command_line: diag(5042, ts.DiagnosticCategory.Error, "Option_project_cannot_be_mixed_with_source_files_on_a_command_line_5042", "Option 'project' cannot be mixed with source files on a command line."), + Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher: diag(5047, ts.DiagnosticCategory.Error, "Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES_5047", "Option 'isolatedModules' can only be used when either option '--module' is provided or option 'target' is 'ES2015' or higher."), + Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided: diag(5051, ts.DiagnosticCategory.Error, "Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided_5051", "Option '{0} can only be used when either option '--inlineSourceMap' or option '--sourceMap' is provided."), + Option_0_cannot_be_specified_without_specifying_option_1: diag(5052, ts.DiagnosticCategory.Error, "Option_0_cannot_be_specified_without_specifying_option_1_5052", "Option '{0}' cannot be specified without specifying option '{1}'."), + Option_0_cannot_be_specified_with_option_1: diag(5053, ts.DiagnosticCategory.Error, "Option_0_cannot_be_specified_with_option_1_5053", "Option '{0}' cannot be specified with option '{1}'."), + A_tsconfig_json_file_is_already_defined_at_Colon_0: diag(5054, ts.DiagnosticCategory.Error, "A_tsconfig_json_file_is_already_defined_at_Colon_0_5054", "A 'tsconfig.json' file is already defined at: '{0}'."), + Cannot_write_file_0_because_it_would_overwrite_input_file: diag(5055, ts.DiagnosticCategory.Error, "Cannot_write_file_0_because_it_would_overwrite_input_file_5055", "Cannot write file '{0}' because it would overwrite input file."), + Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files: diag(5056, ts.DiagnosticCategory.Error, "Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files_5056", "Cannot write file '{0}' because it would be overwritten by multiple input files."), + Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0: diag(5057, ts.DiagnosticCategory.Error, "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057", "Cannot find a tsconfig.json file at the specified directory: '{0}'."), + The_specified_path_does_not_exist_Colon_0: diag(5058, ts.DiagnosticCategory.Error, "The_specified_path_does_not_exist_Colon_0_5058", "The specified path does not exist: '{0}'."), + Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier: diag(5059, ts.DiagnosticCategory.Error, "Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier_5059", "Invalid value for '--reactNamespace'. '{0}' is not a valid identifier."), + Option_paths_cannot_be_used_without_specifying_baseUrl_option: diag(5060, ts.DiagnosticCategory.Error, "Option_paths_cannot_be_used_without_specifying_baseUrl_option_5060", "Option 'paths' cannot be used without specifying '--baseUrl' option."), + Pattern_0_can_have_at_most_one_Asterisk_character: diag(5061, ts.DiagnosticCategory.Error, "Pattern_0_can_have_at_most_one_Asterisk_character_5061", "Pattern '{0}' can have at most one '*' character."), + Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character: diag(5062, ts.DiagnosticCategory.Error, "Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character_5062", "Substitution '{0}' in pattern '{1}' in can have at most one '*' character."), + Substitutions_for_pattern_0_should_be_an_array: diag(5063, ts.DiagnosticCategory.Error, "Substitutions_for_pattern_0_should_be_an_array_5063", "Substitutions for pattern '{0}' should be an array."), + Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2: diag(5064, ts.DiagnosticCategory.Error, "Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2_5064", "Substitution '{0}' for pattern '{1}' has incorrect type, expected 'string', got '{2}'."), + File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5065, ts.DiagnosticCategory.Error, "File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildca_5065", "File specification cannot contain a parent directory ('..') that appears after a recursive directory wildcard ('**'): '{0}'."), + Substitutions_for_pattern_0_shouldn_t_be_an_empty_array: diag(5066, ts.DiagnosticCategory.Error, "Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066", "Substitutions for pattern '{0}' shouldn't be an empty array."), + Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name: diag(5067, ts.DiagnosticCategory.Error, "Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name_5067", "Invalid value for 'jsxFactory'. '{0}' is not a valid identifier or qualified-name."), + Concatenate_and_emit_output_to_single_file: diag(6001, ts.DiagnosticCategory.Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."), + Generates_corresponding_d_ts_file: diag(6002, ts.DiagnosticCategory.Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."), + Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations: diag(6003, ts.DiagnosticCategory.Message, "Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations_6003", "Specify the location where debugger should locate map files instead of generated locations."), + Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations: diag(6004, ts.DiagnosticCategory.Message, "Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations_6004", "Specify the location where debugger should locate TypeScript files instead of source locations."), + Watch_input_files: diag(6005, ts.DiagnosticCategory.Message, "Watch_input_files_6005", "Watch input files."), + Redirect_output_structure_to_the_directory: diag(6006, ts.DiagnosticCategory.Message, "Redirect_output_structure_to_the_directory_6006", "Redirect output structure to the directory."), + Do_not_erase_const_enum_declarations_in_generated_code: diag(6007, ts.DiagnosticCategory.Message, "Do_not_erase_const_enum_declarations_in_generated_code_6007", "Do not erase const enum declarations in generated code."), + Do_not_emit_outputs_if_any_errors_were_reported: diag(6008, ts.DiagnosticCategory.Message, "Do_not_emit_outputs_if_any_errors_were_reported_6008", "Do not emit outputs if any errors were reported."), + Do_not_emit_comments_to_output: diag(6009, ts.DiagnosticCategory.Message, "Do_not_emit_comments_to_output_6009", "Do not emit comments to output."), + Do_not_emit_outputs: diag(6010, ts.DiagnosticCategory.Message, "Do_not_emit_outputs_6010", "Do not emit outputs."), + Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking: diag(6011, ts.DiagnosticCategory.Message, "Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typech_6011", "Allow default imports from modules with no default export. This does not affect code emit, just typechecking."), + Skip_type_checking_of_declaration_files: diag(6012, ts.DiagnosticCategory.Message, "Skip_type_checking_of_declaration_files_6012", "Skip type checking of declaration files."), + Do_not_resolve_the_real_path_of_symlinks: diag(6013, ts.DiagnosticCategory.Message, "Do_not_resolve_the_real_path_of_symlinks_6013", "Do not resolve the real path of symlinks."), + Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT: diag(6015, ts.DiagnosticCategory.Message, "Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT_6015", "Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'."), + Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext: diag(6016, ts.DiagnosticCategory.Message, "Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext_6016", "Specify module code generation: 'none', commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'."), + Print_this_message: diag(6017, ts.DiagnosticCategory.Message, "Print_this_message_6017", "Print this message."), + Print_the_compiler_s_version: diag(6019, ts.DiagnosticCategory.Message, "Print_the_compiler_s_version_6019", "Print the compiler's version."), + Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json: diag(6020, ts.DiagnosticCategory.Message, "Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json_6020", "Compile the project given the path to its configuration file, or to a folder with a 'tsconfig.json'."), + Syntax_Colon_0: diag(6023, ts.DiagnosticCategory.Message, "Syntax_Colon_0_6023", "Syntax: {0}"), + options: diag(6024, ts.DiagnosticCategory.Message, "options_6024", "options"), + file: diag(6025, ts.DiagnosticCategory.Message, "file_6025", "file"), + Examples_Colon_0: diag(6026, ts.DiagnosticCategory.Message, "Examples_Colon_0_6026", "Examples: {0}"), + Options_Colon: diag(6027, ts.DiagnosticCategory.Message, "Options_Colon_6027", "Options:"), + Version_0: diag(6029, ts.DiagnosticCategory.Message, "Version_0_6029", "Version {0}"), + Insert_command_line_options_and_files_from_a_file: diag(6030, ts.DiagnosticCategory.Message, "Insert_command_line_options_and_files_from_a_file_6030", "Insert command line options and files from a file."), + File_change_detected_Starting_incremental_compilation: diag(6032, ts.DiagnosticCategory.Message, "File_change_detected_Starting_incremental_compilation_6032", "File change detected. Starting incremental compilation..."), + KIND: diag(6034, ts.DiagnosticCategory.Message, "KIND_6034", "KIND"), + FILE: diag(6035, ts.DiagnosticCategory.Message, "FILE_6035", "FILE"), + VERSION: diag(6036, ts.DiagnosticCategory.Message, "VERSION_6036", "VERSION"), + LOCATION: diag(6037, ts.DiagnosticCategory.Message, "LOCATION_6037", "LOCATION"), + DIRECTORY: diag(6038, ts.DiagnosticCategory.Message, "DIRECTORY_6038", "DIRECTORY"), + STRATEGY: diag(6039, ts.DiagnosticCategory.Message, "STRATEGY_6039", "STRATEGY"), + FILE_OR_DIRECTORY: diag(6040, ts.DiagnosticCategory.Message, "FILE_OR_DIRECTORY_6040", "FILE OR DIRECTORY"), + Compilation_complete_Watching_for_file_changes: diag(6042, ts.DiagnosticCategory.Message, "Compilation_complete_Watching_for_file_changes_6042", "Compilation complete. Watching for file changes."), + Generates_corresponding_map_file: diag(6043, ts.DiagnosticCategory.Message, "Generates_corresponding_map_file_6043", "Generates corresponding '.map' file."), + Compiler_option_0_expects_an_argument: diag(6044, ts.DiagnosticCategory.Error, "Compiler_option_0_expects_an_argument_6044", "Compiler option '{0}' expects an argument."), + Unterminated_quoted_string_in_response_file_0: diag(6045, ts.DiagnosticCategory.Error, "Unterminated_quoted_string_in_response_file_0_6045", "Unterminated quoted string in response file '{0}'."), + Argument_for_0_option_must_be_Colon_1: diag(6046, ts.DiagnosticCategory.Error, "Argument_for_0_option_must_be_Colon_1_6046", "Argument for '{0}' option must be: {1}."), + Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1: diag(6048, ts.DiagnosticCategory.Error, "Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1_6048", "Locale must be of the form <language> or <language>-<territory>. For example '{0}' or '{1}'."), + Unsupported_locale_0: diag(6049, ts.DiagnosticCategory.Error, "Unsupported_locale_0_6049", "Unsupported locale '{0}'."), + Unable_to_open_file_0: diag(6050, ts.DiagnosticCategory.Error, "Unable_to_open_file_0_6050", "Unable to open file '{0}'."), + Corrupted_locale_file_0: diag(6051, ts.DiagnosticCategory.Error, "Corrupted_locale_file_0_6051", "Corrupted locale file {0}."), + Raise_error_on_expressions_and_declarations_with_an_implied_any_type: diag(6052, ts.DiagnosticCategory.Message, "Raise_error_on_expressions_and_declarations_with_an_implied_any_type_6052", "Raise error on expressions and declarations with an implied 'any' type."), + File_0_not_found: diag(6053, ts.DiagnosticCategory.Error, "File_0_not_found_6053", "File '{0}' not found."), + File_0_has_unsupported_extension_The_only_supported_extensions_are_1: diag(6054, ts.DiagnosticCategory.Error, "File_0_has_unsupported_extension_The_only_supported_extensions_are_1_6054", "File '{0}' has unsupported extension. The only supported extensions are {1}."), + Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures: diag(6055, ts.DiagnosticCategory.Message, "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055", "Suppress noImplicitAny errors for indexing objects lacking index signatures."), + Do_not_emit_declarations_for_code_that_has_an_internal_annotation: diag(6056, ts.DiagnosticCategory.Message, "Do_not_emit_declarations_for_code_that_has_an_internal_annotation_6056", "Do not emit declarations for code that has an '@internal' annotation."), + Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir: diag(6058, ts.DiagnosticCategory.Message, "Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir_6058", "Specify the root directory of input files. Use to control the output directory structure with --outDir."), + File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files: diag(6059, ts.DiagnosticCategory.Error, "File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files_6059", "File '{0}' is not under 'rootDir' '{1}'. 'rootDir' is expected to contain all source files."), + Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix: diag(6060, ts.DiagnosticCategory.Message, "Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix_6060", "Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix)."), + NEWLINE: diag(6061, ts.DiagnosticCategory.Message, "NEWLINE_6061", "NEWLINE"), + Option_0_can_only_be_specified_in_tsconfig_json_file: diag(6064, ts.DiagnosticCategory.Error, "Option_0_can_only_be_specified_in_tsconfig_json_file_6064", "Option '{0}' can only be specified in 'tsconfig.json' file."), + Enables_experimental_support_for_ES7_decorators: diag(6065, ts.DiagnosticCategory.Message, "Enables_experimental_support_for_ES7_decorators_6065", "Enables experimental support for ES7 decorators."), + Enables_experimental_support_for_emitting_type_metadata_for_decorators: diag(6066, ts.DiagnosticCategory.Message, "Enables_experimental_support_for_emitting_type_metadata_for_decorators_6066", "Enables experimental support for emitting type metadata for decorators."), + Enables_experimental_support_for_ES7_async_functions: diag(6068, ts.DiagnosticCategory.Message, "Enables_experimental_support_for_ES7_async_functions_6068", "Enables experimental support for ES7 async functions."), + Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6: diag(6069, ts.DiagnosticCategory.Message, "Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6_6069", "Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6)."), + Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file: diag(6070, ts.DiagnosticCategory.Message, "Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file_6070", "Initializes a TypeScript project and creates a tsconfig.json file."), + Successfully_created_a_tsconfig_json_file: diag(6071, ts.DiagnosticCategory.Message, "Successfully_created_a_tsconfig_json_file_6071", "Successfully created a tsconfig.json file."), + Suppress_excess_property_checks_for_object_literals: diag(6072, ts.DiagnosticCategory.Message, "Suppress_excess_property_checks_for_object_literals_6072", "Suppress excess property checks for object literals."), + Stylize_errors_and_messages_using_color_and_context_experimental: diag(6073, ts.DiagnosticCategory.Message, "Stylize_errors_and_messages_using_color_and_context_experimental_6073", "Stylize errors and messages using color and context (experimental)."), + Do_not_report_errors_on_unused_labels: diag(6074, ts.DiagnosticCategory.Message, "Do_not_report_errors_on_unused_labels_6074", "Do not report errors on unused labels."), + Report_error_when_not_all_code_paths_in_function_return_a_value: diag(6075, ts.DiagnosticCategory.Message, "Report_error_when_not_all_code_paths_in_function_return_a_value_6075", "Report error when not all code paths in function return a value."), + Report_errors_for_fallthrough_cases_in_switch_statement: diag(6076, ts.DiagnosticCategory.Message, "Report_errors_for_fallthrough_cases_in_switch_statement_6076", "Report errors for fallthrough cases in switch statement."), + Do_not_report_errors_on_unreachable_code: diag(6077, ts.DiagnosticCategory.Message, "Do_not_report_errors_on_unreachable_code_6077", "Do not report errors on unreachable code."), + Disallow_inconsistently_cased_references_to_the_same_file: diag(6078, ts.DiagnosticCategory.Message, "Disallow_inconsistently_cased_references_to_the_same_file_6078", "Disallow inconsistently-cased references to the same file."), + Specify_library_files_to_be_included_in_the_compilation_Colon: diag(6079, ts.DiagnosticCategory.Message, "Specify_library_files_to_be_included_in_the_compilation_Colon_6079", "Specify library files to be included in the compilation: "), + Specify_JSX_code_generation_Colon_preserve_react_native_or_react: diag(6080, ts.DiagnosticCategory.Message, "Specify_JSX_code_generation_Colon_preserve_react_native_or_react_6080", "Specify JSX code generation: 'preserve', 'react-native', or 'react'."), + File_0_has_an_unsupported_extension_so_skipping_it: diag(6081, ts.DiagnosticCategory.Message, "File_0_has_an_unsupported_extension_so_skipping_it_6081", "File '{0}' has an unsupported extension, so skipping it."), + Only_amd_and_system_modules_are_supported_alongside_0: diag(6082, ts.DiagnosticCategory.Error, "Only_amd_and_system_modules_are_supported_alongside_0_6082", "Only 'amd' and 'system' modules are supported alongside --{0}."), + Base_directory_to_resolve_non_absolute_module_names: diag(6083, ts.DiagnosticCategory.Message, "Base_directory_to_resolve_non_absolute_module_names_6083", "Base directory to resolve non-absolute module names."), + Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit: diag(6084, ts.DiagnosticCategory.Message, "Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react__6084", "[Deprecated] Use '--jsxFactory' instead. Specify the object invoked for createElement when targeting 'react' JSX emit"), + Enable_tracing_of_the_name_resolution_process: diag(6085, ts.DiagnosticCategory.Message, "Enable_tracing_of_the_name_resolution_process_6085", "Enable tracing of the name resolution process."), + Resolving_module_0_from_1: diag(6086, ts.DiagnosticCategory.Message, "Resolving_module_0_from_1_6086", "======== Resolving module '{0}' from '{1}'. ========"), + Explicitly_specified_module_resolution_kind_Colon_0: diag(6087, ts.DiagnosticCategory.Message, "Explicitly_specified_module_resolution_kind_Colon_0_6087", "Explicitly specified module resolution kind: '{0}'."), + Module_resolution_kind_is_not_specified_using_0: diag(6088, ts.DiagnosticCategory.Message, "Module_resolution_kind_is_not_specified_using_0_6088", "Module resolution kind is not specified, using '{0}'."), + Module_name_0_was_successfully_resolved_to_1: diag(6089, ts.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_6089", "======== Module name '{0}' was successfully resolved to '{1}'. ========"), + Module_name_0_was_not_resolved: diag(6090, ts.DiagnosticCategory.Message, "Module_name_0_was_not_resolved_6090", "======== Module name '{0}' was not resolved. ========"), + paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0: diag(6091, ts.DiagnosticCategory.Message, "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091", "'paths' option is specified, looking for a pattern to match module name '{0}'."), + Module_name_0_matched_pattern_1: diag(6092, ts.DiagnosticCategory.Message, "Module_name_0_matched_pattern_1_6092", "Module name '{0}', matched pattern '{1}'."), + Trying_substitution_0_candidate_module_location_Colon_1: diag(6093, ts.DiagnosticCategory.Message, "Trying_substitution_0_candidate_module_location_Colon_1_6093", "Trying substitution '{0}', candidate module location: '{1}'."), + Resolving_module_name_0_relative_to_base_url_1_2: diag(6094, ts.DiagnosticCategory.Message, "Resolving_module_name_0_relative_to_base_url_1_2_6094", "Resolving module name '{0}' relative to base url '{1}' - '{2}'."), + Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1: diag(6095, ts.DiagnosticCategory.Message, "Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1_6095", "Loading module as file / folder, candidate module location '{0}', target file type '{1}'."), + File_0_does_not_exist: diag(6096, ts.DiagnosticCategory.Message, "File_0_does_not_exist_6096", "File '{0}' does not exist."), + File_0_exist_use_it_as_a_name_resolution_result: diag(6097, ts.DiagnosticCategory.Message, "File_0_exist_use_it_as_a_name_resolution_result_6097", "File '{0}' exist - use it as a name resolution result."), + Loading_module_0_from_node_modules_folder_target_file_type_1: diag(6098, ts.DiagnosticCategory.Message, "Loading_module_0_from_node_modules_folder_target_file_type_1_6098", "Loading module '{0}' from 'node_modules' folder, target file type '{1}'."), + Found_package_json_at_0: diag(6099, ts.DiagnosticCategory.Message, "Found_package_json_at_0_6099", "Found 'package.json' at '{0}'."), + package_json_does_not_have_a_0_field: diag(6100, ts.DiagnosticCategory.Message, "package_json_does_not_have_a_0_field_6100", "'package.json' does not have a '{0}' field."), + package_json_has_0_field_1_that_references_2: diag(6101, ts.DiagnosticCategory.Message, "package_json_has_0_field_1_that_references_2_6101", "'package.json' has '{0}' field '{1}' that references '{2}'."), + Allow_javascript_files_to_be_compiled: diag(6102, ts.DiagnosticCategory.Message, "Allow_javascript_files_to_be_compiled_6102", "Allow javascript files to be compiled."), + Option_0_should_have_array_of_strings_as_a_value: diag(6103, ts.DiagnosticCategory.Error, "Option_0_should_have_array_of_strings_as_a_value_6103", "Option '{0}' should have array of strings as a value."), + Checking_if_0_is_the_longest_matching_prefix_for_1_2: diag(6104, ts.DiagnosticCategory.Message, "Checking_if_0_is_the_longest_matching_prefix_for_1_2_6104", "Checking if '{0}' is the longest matching prefix for '{1}' - '{2}'."), + Expected_type_of_0_field_in_package_json_to_be_string_got_1: diag(6105, ts.DiagnosticCategory.Message, "Expected_type_of_0_field_in_package_json_to_be_string_got_1_6105", "Expected type of '{0}' field in 'package.json' to be 'string', got '{1}'."), + baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1: diag(6106, ts.DiagnosticCategory.Message, "baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1_6106", "'baseUrl' option is set to '{0}', using this value to resolve non-relative module name '{1}'."), + rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0: diag(6107, ts.DiagnosticCategory.Message, "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107", "'rootDirs' option is set, using it to resolve relative module name '{0}'."), + Longest_matching_prefix_for_0_is_1: diag(6108, ts.DiagnosticCategory.Message, "Longest_matching_prefix_for_0_is_1_6108", "Longest matching prefix for '{0}' is '{1}'."), + Loading_0_from_the_root_dir_1_candidate_location_2: diag(6109, ts.DiagnosticCategory.Message, "Loading_0_from_the_root_dir_1_candidate_location_2_6109", "Loading '{0}' from the root dir '{1}', candidate location '{2}'."), + Trying_other_entries_in_rootDirs: diag(6110, ts.DiagnosticCategory.Message, "Trying_other_entries_in_rootDirs_6110", "Trying other entries in 'rootDirs'."), + Module_resolution_using_rootDirs_has_failed: diag(6111, ts.DiagnosticCategory.Message, "Module_resolution_using_rootDirs_has_failed_6111", "Module resolution using 'rootDirs' has failed."), + Do_not_emit_use_strict_directives_in_module_output: diag(6112, ts.DiagnosticCategory.Message, "Do_not_emit_use_strict_directives_in_module_output_6112", "Do not emit 'use strict' directives in module output."), + Enable_strict_null_checks: diag(6113, ts.DiagnosticCategory.Message, "Enable_strict_null_checks_6113", "Enable strict null checks."), + Unknown_option_excludes_Did_you_mean_exclude: diag(6114, ts.DiagnosticCategory.Error, "Unknown_option_excludes_Did_you_mean_exclude_6114", "Unknown option 'excludes'. Did you mean 'exclude'?"), + Raise_error_on_this_expressions_with_an_implied_any_type: diag(6115, ts.DiagnosticCategory.Message, "Raise_error_on_this_expressions_with_an_implied_any_type_6115", "Raise error on 'this' expressions with an implied 'any' type."), + Resolving_type_reference_directive_0_containing_file_1_root_directory_2: diag(6116, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_1_root_directory_2_6116", "======== Resolving type reference directive '{0}', containing file '{1}', root directory '{2}'. ========"), + Resolving_using_primary_search_paths: diag(6117, ts.DiagnosticCategory.Message, "Resolving_using_primary_search_paths_6117", "Resolving using primary search paths..."), + Resolving_from_node_modules_folder: diag(6118, ts.DiagnosticCategory.Message, "Resolving_from_node_modules_folder_6118", "Resolving from node_modules folder..."), + Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2: diag(6119, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119", "======== Type reference directive '{0}' was successfully resolved to '{1}', primary: {2}. ========"), + Type_reference_directive_0_was_not_resolved: diag(6120, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_not_resolved_6120", "======== Type reference directive '{0}' was not resolved. ========"), + Resolving_with_primary_search_path_0: diag(6121, ts.DiagnosticCategory.Message, "Resolving_with_primary_search_path_0_6121", "Resolving with primary search path '{0}'."), + Root_directory_cannot_be_determined_skipping_primary_search_paths: diag(6122, ts.DiagnosticCategory.Message, "Root_directory_cannot_be_determined_skipping_primary_search_paths_6122", "Root directory cannot be determined, skipping primary search paths."), + Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set: diag(6123, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set_6123", "======== Resolving type reference directive '{0}', containing file '{1}', root directory not set. ========"), + Type_declaration_files_to_be_included_in_compilation: diag(6124, ts.DiagnosticCategory.Message, "Type_declaration_files_to_be_included_in_compilation_6124", "Type declaration files to be included in compilation."), + Looking_up_in_node_modules_folder_initial_location_0: diag(6125, ts.DiagnosticCategory.Message, "Looking_up_in_node_modules_folder_initial_location_0_6125", "Looking up in 'node_modules' folder, initial location '{0}'."), + Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder: diag(6126, ts.DiagnosticCategory.Message, "Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_mod_6126", "Containing file is not specified and root directory cannot be determined, skipping lookup in 'node_modules' folder."), + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1: diag(6127, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1_6127", "======== Resolving type reference directive '{0}', containing file not set, root directory '{1}'. ========"), + Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set: diag(6128, ts.DiagnosticCategory.Message, "Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set_6128", "======== Resolving type reference directive '{0}', containing file not set, root directory not set. ========"), + The_config_file_0_found_doesn_t_contain_any_source_files: diag(6129, ts.DiagnosticCategory.Error, "The_config_file_0_found_doesn_t_contain_any_source_files_6129", "The config file '{0}' found doesn't contain any source files."), + Resolving_real_path_for_0_result_1: diag(6130, ts.DiagnosticCategory.Message, "Resolving_real_path_for_0_result_1_6130", "Resolving real path for '{0}', result '{1}'."), + Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system: diag(6131, ts.DiagnosticCategory.Error, "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131", "Cannot compile modules using option '{0}' unless the '--module' flag is 'amd' or 'system'."), + File_name_0_has_a_1_extension_stripping_it: diag(6132, ts.DiagnosticCategory.Message, "File_name_0_has_a_1_extension_stripping_it_6132", "File name '{0}' has a '{1}' extension - stripping it."), + _0_is_declared_but_never_used: diag(6133, ts.DiagnosticCategory.Error, "_0_is_declared_but_never_used_6133", "'{0}' is declared but never used."), + Report_errors_on_unused_locals: diag(6134, ts.DiagnosticCategory.Message, "Report_errors_on_unused_locals_6134", "Report errors on unused locals."), + Report_errors_on_unused_parameters: diag(6135, ts.DiagnosticCategory.Message, "Report_errors_on_unused_parameters_6135", "Report errors on unused parameters."), + The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files: diag(6136, ts.DiagnosticCategory.Message, "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136", "The maximum dependency depth to search under node_modules and load JavaScript files."), + Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1: diag(6137, ts.DiagnosticCategory.Error, "Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1_6137", "Cannot import type declaration files. Consider importing '{0}' instead of '{1}'."), + Property_0_is_declared_but_never_used: diag(6138, ts.DiagnosticCategory.Error, "Property_0_is_declared_but_never_used_6138", "Property '{0}' is declared but never used."), + Import_emit_helpers_from_tslib: diag(6139, ts.DiagnosticCategory.Message, "Import_emit_helpers_from_tslib_6139", "Import emit helpers from 'tslib'."), + Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2: diag(6140, ts.DiagnosticCategory.Error, "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140", "Auto discovery for typings is enabled in project '{0}'. Running extra resolution pass for module '{1}' using cache location '{2}'."), + Parse_in_strict_mode_and_emit_use_strict_for_each_source_file: diag(6141, ts.DiagnosticCategory.Message, "Parse_in_strict_mode_and_emit_use_strict_for_each_source_file_6141", "Parse in strict mode and emit \"use strict\" for each source file."), + Module_0_was_resolved_to_1_but_jsx_is_not_set: diag(6142, ts.DiagnosticCategory.Error, "Module_0_was_resolved_to_1_but_jsx_is_not_set_6142", "Module '{0}' was resolved to '{1}', but '--jsx' is not set."), + Module_0_was_resolved_to_1_but_allowJs_is_not_set: diag(6143, ts.DiagnosticCategory.Error, "Module_0_was_resolved_to_1_but_allowJs_is_not_set_6143", "Module '{0}' was resolved to '{1}', but '--allowJs' is not set."), + Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1: diag(6144, ts.DiagnosticCategory.Message, "Module_0_was_resolved_as_locally_declared_ambient_module_in_file_1_6144", "Module '{0}' was resolved as locally declared ambient module in file '{1}'."), + Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified: diag(6145, ts.DiagnosticCategory.Message, "Module_0_was_resolved_as_ambient_module_declared_in_1_since_this_file_was_not_modified_6145", "Module '{0}' was resolved as ambient module declared in '{1}' since this file was not modified."), + Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h: diag(6146, ts.DiagnosticCategory.Message, "Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h_6146", "Specify the JSX factory function to use when targeting 'react' JSX emit, e.g. 'React.createElement' or 'h'."), + Resolution_for_module_0_was_found_in_cache: diag(6147, ts.DiagnosticCategory.Message, "Resolution_for_module_0_was_found_in_cache_6147", "Resolution for module '{0}' was found in cache."), + Directory_0_does_not_exist_skipping_all_lookups_in_it: diag(6148, ts.DiagnosticCategory.Message, "Directory_0_does_not_exist_skipping_all_lookups_in_it_6148", "Directory '{0}' does not exist, skipping all lookups in it."), + Show_diagnostic_information: diag(6149, ts.DiagnosticCategory.Message, "Show_diagnostic_information_6149", "Show diagnostic information."), + Show_verbose_diagnostic_information: diag(6150, ts.DiagnosticCategory.Message, "Show_verbose_diagnostic_information_6150", "Show verbose diagnostic information."), + Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file: diag(6151, ts.DiagnosticCategory.Message, "Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file_6151", "Emit a single file with source maps instead of having a separate file."), + Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set: diag(6152, ts.DiagnosticCategory.Message, "Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap__6152", "Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set."), + Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule: diag(6153, ts.DiagnosticCategory.Message, "Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule_6153", "Transpile each file as a separate module (similar to 'ts.transpileModule')."), + Print_names_of_generated_files_part_of_the_compilation: diag(6154, ts.DiagnosticCategory.Message, "Print_names_of_generated_files_part_of_the_compilation_6154", "Print names of generated files part of the compilation."), + Print_names_of_files_part_of_the_compilation: diag(6155, ts.DiagnosticCategory.Message, "Print_names_of_files_part_of_the_compilation_6155", "Print names of files part of the compilation."), + The_locale_used_when_displaying_messages_to_the_user_e_g_en_us: diag(6156, ts.DiagnosticCategory.Message, "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156", "The locale used when displaying messages to the user (e.g. 'en-us')"), + Do_not_generate_custom_helper_functions_like_extends_in_compiled_output: diag(6157, ts.DiagnosticCategory.Message, "Do_not_generate_custom_helper_functions_like_extends_in_compiled_output_6157", "Do not generate custom helper functions like '__extends' in compiled output."), + Do_not_include_the_default_library_file_lib_d_ts: diag(6158, ts.DiagnosticCategory.Message, "Do_not_include_the_default_library_file_lib_d_ts_6158", "Do not include the default library file (lib.d.ts)."), + Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files: diag(6159, ts.DiagnosticCategory.Message, "Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files_6159", "Do not add triple-slash references or imported modules to the list of compiled files."), + Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files: diag(6160, ts.DiagnosticCategory.Message, "Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files_6160", "[Deprecated] Use '--skipLibCheck' instead. Skip type checking of default library declaration files."), + List_of_folders_to_include_type_definitions_from: diag(6161, ts.DiagnosticCategory.Message, "List_of_folders_to_include_type_definitions_from_6161", "List of folders to include type definitions from."), + Disable_size_limitations_on_JavaScript_projects: diag(6162, ts.DiagnosticCategory.Message, "Disable_size_limitations_on_JavaScript_projects_6162", "Disable size limitations on JavaScript projects."), + The_character_set_of_the_input_files: diag(6163, ts.DiagnosticCategory.Message, "The_character_set_of_the_input_files_6163", "The character set of the input files."), + Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files: diag(6164, ts.DiagnosticCategory.Message, "Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files_6164", "Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files."), + Do_not_truncate_error_messages: diag(6165, ts.DiagnosticCategory.Message, "Do_not_truncate_error_messages_6165", "Do not truncate error messages."), + Output_directory_for_generated_declaration_files: diag(6166, ts.DiagnosticCategory.Message, "Output_directory_for_generated_declaration_files_6166", "Output directory for generated declaration files."), + A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl: diag(6167, ts.DiagnosticCategory.Message, "A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl_6167", "A series of entries which re-map imports to lookup locations relative to the 'baseUrl'."), + List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime: diag(6168, ts.DiagnosticCategory.Message, "List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime_6168", "List of root folders whose combined content represents the structure of the project at runtime."), + Show_all_compiler_options: diag(6169, ts.DiagnosticCategory.Message, "Show_all_compiler_options_6169", "Show all compiler options."), + Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file: diag(6170, ts.DiagnosticCategory.Message, "Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file_6170", "[Deprecated] Use '--outFile' instead. Concatenate and emit output to single file"), + Command_line_Options: diag(6171, ts.DiagnosticCategory.Message, "Command_line_Options_6171", "Command-line Options"), + Basic_Options: diag(6172, ts.DiagnosticCategory.Message, "Basic_Options_6172", "Basic Options"), + Strict_Type_Checking_Options: diag(6173, ts.DiagnosticCategory.Message, "Strict_Type_Checking_Options_6173", "Strict Type-Checking Options"), + Module_Resolution_Options: diag(6174, ts.DiagnosticCategory.Message, "Module_Resolution_Options_6174", "Module Resolution Options"), + Source_Map_Options: diag(6175, ts.DiagnosticCategory.Message, "Source_Map_Options_6175", "Source Map Options"), + Additional_Checks: diag(6176, ts.DiagnosticCategory.Message, "Additional_Checks_6176", "Additional Checks"), + Experimental_Options: diag(6177, ts.DiagnosticCategory.Message, "Experimental_Options_6177", "Experimental Options"), + Advanced_Options: diag(6178, ts.DiagnosticCategory.Message, "Advanced_Options_6178", "Advanced Options"), + Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3: diag(6179, ts.DiagnosticCategory.Message, "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179", "Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'."), + Enable_all_strict_type_checking_options: diag(6180, ts.DiagnosticCategory.Message, "Enable_all_strict_type_checking_options_6180", "Enable all strict type-checking options."), + List_of_language_service_plugins: diag(6181, ts.DiagnosticCategory.Message, "List_of_language_service_plugins_6181", "List of language service plugins."), + Scoped_package_detected_looking_in_0: diag(6182, ts.DiagnosticCategory.Message, "Scoped_package_detected_looking_in_0_6182", "Scoped package detected, looking in '{0}'"), + Reusing_resolution_of_module_0_to_file_1_from_old_program: diag(6183, ts.DiagnosticCategory.Message, "Reusing_resolution_of_module_0_to_file_1_from_old_program_6183", "Reusing resolution of module '{0}' to file '{1}' from old program."), + Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program: diag(6184, ts.DiagnosticCategory.Message, "Reusing_module_resolutions_originating_in_0_since_resolutions_are_unchanged_from_old_program_6184", "Reusing module resolutions originating in '{0}' since resolutions are unchanged from old program."), + Disable_strict_checking_of_generic_signatures_in_function_types: diag(6185, ts.DiagnosticCategory.Message, "Disable_strict_checking_of_generic_signatures_in_function_types_6185", "Disable strict checking of generic signatures in function types."), + Variable_0_implicitly_has_an_1_type: diag(7005, ts.DiagnosticCategory.Error, "Variable_0_implicitly_has_an_1_type_7005", "Variable '{0}' implicitly has an '{1}' type."), + Parameter_0_implicitly_has_an_1_type: diag(7006, ts.DiagnosticCategory.Error, "Parameter_0_implicitly_has_an_1_type_7006", "Parameter '{0}' implicitly has an '{1}' type."), + Member_0_implicitly_has_an_1_type: diag(7008, ts.DiagnosticCategory.Error, "Member_0_implicitly_has_an_1_type_7008", "Member '{0}' implicitly has an '{1}' type."), + new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type: diag(7009, ts.DiagnosticCategory.Error, "new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type_7009", "'new' expression, whose target lacks a construct signature, implicitly has an 'any' type."), + _0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type: diag(7010, ts.DiagnosticCategory.Error, "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010", "'{0}', which lacks return-type annotation, implicitly has an '{1}' return type."), + Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type: diag(7011, ts.DiagnosticCategory.Error, "Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type_7011", "Function expression, which lacks return-type annotation, implicitly has an '{0}' return type."), + Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7013, ts.DiagnosticCategory.Error, "Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7013", "Construct signature, which lacks return-type annotation, implicitly has an 'any' return type."), + Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number: diag(7015, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_index_expression_is_not_of_type_number_7015", "Element implicitly has an 'any' type because index expression is not of type 'number'."), + Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type: diag(7016, ts.DiagnosticCategory.Error, "Could_not_find_a_declaration_file_for_module_0_1_implicitly_has_an_any_type_7016", "Could not find a declaration file for module '{0}'. '{1}' implicitly has an 'any' type."), + Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature: diag(7017, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_7017", "Element implicitly has an 'any' type because type '{0}' has no index signature."), + Object_literal_s_property_0_implicitly_has_an_1_type: diag(7018, ts.DiagnosticCategory.Error, "Object_literal_s_property_0_implicitly_has_an_1_type_7018", "Object literal's property '{0}' implicitly has an '{1}' type."), + Rest_parameter_0_implicitly_has_an_any_type: diag(7019, ts.DiagnosticCategory.Error, "Rest_parameter_0_implicitly_has_an_any_type_7019", "Rest parameter '{0}' implicitly has an 'any[]' type."), + Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type: diag(7020, ts.DiagnosticCategory.Error, "Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type_7020", "Call signature, which lacks return-type annotation, implicitly has an 'any' return type."), + _0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer: diag(7022, ts.DiagnosticCategory.Error, "_0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or__7022", "'{0}' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer."), + _0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: diag(7023, ts.DiagnosticCategory.Error, "_0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_reference_7023", "'{0}' implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."), + Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions: diag(7024, ts.DiagnosticCategory.Error, "Function_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_ref_7024", "Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions."), + Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type: diag(7025, ts.DiagnosticCategory.Error, "Generator_implicitly_has_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_typ_7025", "Generator implicitly has type '{0}' because it does not yield any values. Consider supplying a return type."), + JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists: diag(7026, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists_7026", "JSX element implicitly has type 'any' because no interface 'JSX.{0}' exists."), + Unreachable_code_detected: diag(7027, ts.DiagnosticCategory.Error, "Unreachable_code_detected_7027", "Unreachable code detected."), + Unused_label: diag(7028, ts.DiagnosticCategory.Error, "Unused_label_7028", "Unused label."), + Fallthrough_case_in_switch: diag(7029, ts.DiagnosticCategory.Error, "Fallthrough_case_in_switch_7029", "Fallthrough case in switch."), + Not_all_code_paths_return_a_value: diag(7030, ts.DiagnosticCategory.Error, "Not_all_code_paths_return_a_value_7030", "Not all code paths return a value."), + Binding_element_0_implicitly_has_an_1_type: diag(7031, ts.DiagnosticCategory.Error, "Binding_element_0_implicitly_has_an_1_type_7031", "Binding element '{0}' implicitly has an '{1}' type."), + Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation: diag(7032, ts.DiagnosticCategory.Error, "Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation_7032", "Property '{0}' implicitly has type 'any', because its set accessor lacks a parameter type annotation."), + Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation: diag(7033, ts.DiagnosticCategory.Error, "Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation_7033", "Property '{0}' implicitly has type 'any', because its get accessor lacks a return type annotation."), + Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined: diag(7034, ts.DiagnosticCategory.Error, "Variable_0_implicitly_has_type_1_in_some_locations_where_its_type_cannot_be_determined_7034", "Variable '{0}' implicitly has type '{1}' in some locations where its type cannot be determined."), + Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0: diag(7035, ts.DiagnosticCategory.Error, "Try_npm_install_types_Slash_0_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_mod_7035", "Try `npm install @types/{0}` if it exists or add a new declaration (.d.ts) file containing `declare module '{0}';`"), + Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0: diag(7036, ts.DiagnosticCategory.Error, "Dynamic_import_s_specifier_must_be_of_type_string_but_here_has_type_0_7036", "Dynamic import's specifier must be of type 'string', but here has type '{0}'."), + You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."), + You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."), + import_can_only_be_used_in_a_ts_file: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_a_ts_file_8002", "'import ... =' can only be used in a .ts file."), + export_can_only_be_used_in_a_ts_file: diag(8003, ts.DiagnosticCategory.Error, "export_can_only_be_used_in_a_ts_file_8003", "'export=' can only be used in a .ts file."), + type_parameter_declarations_can_only_be_used_in_a_ts_file: diag(8004, ts.DiagnosticCategory.Error, "type_parameter_declarations_can_only_be_used_in_a_ts_file_8004", "'type parameter declarations' can only be used in a .ts file."), + implements_clauses_can_only_be_used_in_a_ts_file: diag(8005, ts.DiagnosticCategory.Error, "implements_clauses_can_only_be_used_in_a_ts_file_8005", "'implements clauses' can only be used in a .ts file."), + interface_declarations_can_only_be_used_in_a_ts_file: diag(8006, ts.DiagnosticCategory.Error, "interface_declarations_can_only_be_used_in_a_ts_file_8006", "'interface declarations' can only be used in a .ts file."), + module_declarations_can_only_be_used_in_a_ts_file: diag(8007, ts.DiagnosticCategory.Error, "module_declarations_can_only_be_used_in_a_ts_file_8007", "'module declarations' can only be used in a .ts file."), + type_aliases_can_only_be_used_in_a_ts_file: diag(8008, ts.DiagnosticCategory.Error, "type_aliases_can_only_be_used_in_a_ts_file_8008", "'type aliases' can only be used in a .ts file."), + _0_can_only_be_used_in_a_ts_file: diag(8009, ts.DiagnosticCategory.Error, "_0_can_only_be_used_in_a_ts_file_8009", "'{0}' can only be used in a .ts file."), + types_can_only_be_used_in_a_ts_file: diag(8010, ts.DiagnosticCategory.Error, "types_can_only_be_used_in_a_ts_file_8010", "'types' can only be used in a .ts file."), + type_arguments_can_only_be_used_in_a_ts_file: diag(8011, ts.DiagnosticCategory.Error, "type_arguments_can_only_be_used_in_a_ts_file_8011", "'type arguments' can only be used in a .ts file."), + parameter_modifiers_can_only_be_used_in_a_ts_file: diag(8012, ts.DiagnosticCategory.Error, "parameter_modifiers_can_only_be_used_in_a_ts_file_8012", "'parameter modifiers' can only be used in a .ts file."), + non_null_assertions_can_only_be_used_in_a_ts_file: diag(8013, ts.DiagnosticCategory.Error, "non_null_assertions_can_only_be_used_in_a_ts_file_8013", "'non-null assertions' can only be used in a .ts file."), + enum_declarations_can_only_be_used_in_a_ts_file: diag(8015, ts.DiagnosticCategory.Error, "enum_declarations_can_only_be_used_in_a_ts_file_8015", "'enum declarations' can only be used in a .ts file."), + type_assertion_expressions_can_only_be_used_in_a_ts_file: diag(8016, ts.DiagnosticCategory.Error, "type_assertion_expressions_can_only_be_used_in_a_ts_file_8016", "'type assertion expressions' can only be used in a .ts file."), + Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0: diag(8017, ts.DiagnosticCategory.Error, "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017", "Octal literal types must use ES2015 syntax. Use the syntax '{0}'."), + Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0: diag(8018, ts.DiagnosticCategory.Error, "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018", "Octal literals are not allowed in enums members initializer. Use the syntax '{0}'."), + Report_errors_in_js_files: diag(8019, ts.DiagnosticCategory.Message, "Report_errors_in_js_files_8019", "Report errors in .js files."), + JSDoc_types_can_only_be_used_inside_documentation_comments: diag(8020, ts.DiagnosticCategory.Error, "JSDoc_types_can_only_be_used_inside_documentation_comments_8020", "JSDoc types can only be used inside documentation comments."), + Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clause: diag(9002, ts.DiagnosticCategory.Error, "Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_clas_9002", "Only identifiers/qualified-names with optional type arguments are currently supported in a class 'extends' clause."), + class_expressions_are_not_currently_supported: diag(9003, ts.DiagnosticCategory.Error, "class_expressions_are_not_currently_supported_9003", "'class' expressions are not currently supported."), + Language_service_is_disabled: diag(9004, ts.DiagnosticCategory.Error, "Language_service_is_disabled_9004", "Language service is disabled."), + JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), + JSX_elements_cannot_have_multiple_attributes_with_the_same_name: diag(17001, ts.DiagnosticCategory.Error, "JSX_elements_cannot_have_multiple_attributes_with_the_same_name_17001", "JSX elements cannot have multiple attributes with the same name."), + Expected_corresponding_JSX_closing_tag_for_0: diag(17002, ts.DiagnosticCategory.Error, "Expected_corresponding_JSX_closing_tag_for_0_17002", "Expected corresponding JSX closing tag for '{0}'."), + JSX_attribute_expected: diag(17003, ts.DiagnosticCategory.Error, "JSX_attribute_expected_17003", "JSX attribute expected."), + Cannot_use_JSX_unless_the_jsx_flag_is_provided: diag(17004, ts.DiagnosticCategory.Error, "Cannot_use_JSX_unless_the_jsx_flag_is_provided_17004", "Cannot use JSX unless the '--jsx' flag is provided."), + A_constructor_cannot_contain_a_super_call_when_its_class_extends_null: diag(17005, ts.DiagnosticCategory.Error, "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005", "A constructor cannot contain a 'super' call when its class extends 'null'."), + An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: diag(17006, ts.DiagnosticCategory.Error, "An_unary_expression_with_the_0_operator_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_ex_17006", "An unary expression with the '{0}' operator is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."), + A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses: diag(17007, ts.DiagnosticCategory.Error, "A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Con_17007", "A type assertion expression is not allowed in the left-hand side of an exponentiation expression. Consider enclosing the expression in parentheses."), + JSX_element_0_has_no_corresponding_closing_tag: diag(17008, ts.DiagnosticCategory.Error, "JSX_element_0_has_no_corresponding_closing_tag_17008", "JSX element '{0}' has no corresponding closing tag."), + super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class: diag(17009, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009", "'super' must be called before accessing 'this' in the constructor of a derived class."), + Unknown_type_acquisition_option_0: diag(17010, ts.DiagnosticCategory.Error, "Unknown_type_acquisition_option_0_17010", "Unknown type acquisition option '{0}'."), + super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class: diag(17011, ts.DiagnosticCategory.Error, "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011", "'super' must be called before accessing a property of 'super' in the constructor of a derived class."), + _0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2: diag(17012, ts.DiagnosticCategory.Error, "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012", "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?"), + Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor: diag(17013, ts.DiagnosticCategory.Error, "Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constru_17013", "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor."), + Circularity_detected_while_resolving_configuration_Colon_0: diag(18000, ts.DiagnosticCategory.Error, "Circularity_detected_while_resolving_configuration_Colon_0_18000", "Circularity detected while resolving configuration: {0}"), + A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not: diag(18001, ts.DiagnosticCategory.Error, "A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not_18001", "A path in an 'extends' option must be relative or rooted, but '{0}' is not."), + The_files_list_in_config_file_0_is_empty: diag(18002, ts.DiagnosticCategory.Error, "The_files_list_in_config_file_0_is_empty_18002", "The 'files' list in config file '{0}' is empty."), + No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2: diag(18003, ts.DiagnosticCategory.Error, "No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2_18003", "No inputs were found in config file '{0}'. Specified 'include' paths were '{1}' and 'exclude' paths were '{2}'."), + Add_missing_super_call: diag(90001, ts.DiagnosticCategory.Message, "Add_missing_super_call_90001", "Add missing 'super()' call."), + Make_super_call_the_first_statement_in_the_constructor: diag(90002, ts.DiagnosticCategory.Message, "Make_super_call_the_first_statement_in_the_constructor_90002", "Make 'super()' call the first statement in the constructor."), + Change_extends_to_implements: diag(90003, ts.DiagnosticCategory.Message, "Change_extends_to_implements_90003", "Change 'extends' to 'implements'."), + Remove_declaration_for_Colon_0: diag(90004, ts.DiagnosticCategory.Message, "Remove_declaration_for_Colon_0_90004", "Remove declaration for: '{0}'."), + Implement_interface_0: diag(90006, ts.DiagnosticCategory.Message, "Implement_interface_0_90006", "Implement interface '{0}'."), + Implement_inherited_abstract_class: diag(90007, ts.DiagnosticCategory.Message, "Implement_inherited_abstract_class_90007", "Implement inherited abstract class."), + Add_this_to_unresolved_variable: diag(90008, ts.DiagnosticCategory.Message, "Add_this_to_unresolved_variable_90008", "Add 'this.' to unresolved variable."), + Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig: diag(90009, ts.DiagnosticCategory.Error, "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__90009", "Adding a tsconfig.json file will help organize projects that contain both TypeScript and JavaScript files. Learn more at https://aka.ms/tsconfig."), + Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated: diag(90010, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_Two_different_types_with_this_name_exist_but_they_are_unrelated_90010", "Type '{0}' is not assignable to type '{1}'. Two different types with this name exist, but they are unrelated."), + Import_0_from_1: diag(90013, ts.DiagnosticCategory.Message, "Import_0_from_1_90013", "Import {0} from {1}."), + Change_0_to_1: diag(90014, ts.DiagnosticCategory.Message, "Change_0_to_1_90014", "Change {0} to {1}."), + Add_0_to_existing_import_declaration_from_1: diag(90015, ts.DiagnosticCategory.Message, "Add_0_to_existing_import_declaration_from_1_90015", "Add {0} to existing import declaration from {1}."), + Declare_property_0: diag(90016, ts.DiagnosticCategory.Message, "Declare_property_0_90016", "Declare property '{0}'."), + Add_index_signature_for_property_0: diag(90017, ts.DiagnosticCategory.Message, "Add_index_signature_for_property_0_90017", "Add index signature for property '{0}'."), + Disable_checking_for_this_file: diag(90018, ts.DiagnosticCategory.Message, "Disable_checking_for_this_file_90018", "Disable checking for this file."), + Ignore_this_error_message: diag(90019, ts.DiagnosticCategory.Message, "Ignore_this_error_message_90019", "Ignore this error message."), + Initialize_property_0_in_the_constructor: diag(90020, ts.DiagnosticCategory.Message, "Initialize_property_0_in_the_constructor_90020", "Initialize property '{0}' in the constructor."), + Initialize_static_property_0: diag(90021, ts.DiagnosticCategory.Message, "Initialize_static_property_0_90021", "Initialize static property '{0}'."), + Change_spelling_to_0: diag(90022, ts.DiagnosticCategory.Message, "Change_spelling_to_0_90022", "Change spelling to '{0}'."), + Declare_method_0: diag(90023, ts.DiagnosticCategory.Message, "Declare_method_0_90023", "Declare method '{0}'."), + Declare_static_method_0: diag(90024, ts.DiagnosticCategory.Message, "Declare_static_method_0_90024", "Declare static method '{0}'."), + Prefix_0_with_an_underscore: diag(90025, ts.DiagnosticCategory.Message, "Prefix_0_with_an_underscore_90025", "Prefix '{0}' with an underscore."), + Rewrite_as_the_indexed_access_type_0: diag(90026, ts.DiagnosticCategory.Message, "Rewrite_as_the_indexed_access_type_0_90026", "Rewrite as the indexed access type '{0}'."), + Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"), + Convert_function_0_to_class: diag(95002, ts.DiagnosticCategory.Message, "Convert_function_0_to_class_95002", "Convert function '{0}' to class"), + Extract_function: diag(95003, ts.DiagnosticCategory.Message, "Extract_function_95003", "Extract function"), + Extract_function_into_0: diag(95004, ts.DiagnosticCategory.Message, "Extract_function_into_0_95004", "Extract function into {0}"), }; - var optionNameMapCache; - function convertEnableAutoDiscoveryToEnable(typeAcquisition) { - if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { - var result = { - enable: typeAcquisition.enableAutoDiscovery, - include: typeAcquisition.include || [], - exclude: typeAcquisition.exclude || [] - }; - return result; - } - return typeAcquisition; - } - ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable; - function getOptionNameMap() { - if (optionNameMapCache) { - return optionNameMapCache; - } - var optionNameMap = ts.createMap(); - var shortOptionNames = ts.createMap(); - ts.forEach(ts.optionDeclarations, function (option) { - optionNameMap.set(option.name.toLowerCase(), option); - if (option.shortName) { - shortOptionNames.set(option.shortName, option.name); - } - }); - optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; - return optionNameMapCache; - } - function createCompilerDiagnosticForInvalidCustomType(opt) { - var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); - return ts.createCompilerDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); - } - ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; - function parseCustomTypeOption(opt, value, errors) { - return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); - } - ts.parseCustomTypeOption = parseCustomTypeOption; - function parseListTypeOption(opt, value, errors) { - if (value === void 0) { value = ""; } - value = trimString(value); - if (ts.startsWith(value, "-")) { - return undefined; - } - if (value === "") { - return []; - } - var values = value.split(","); - switch (opt.element.type) { - case "number": - return ts.map(values, parseInt); - case "string": - return ts.map(values, function (v) { return v || ""; }); - default: - return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); - } - } - ts.parseListTypeOption = parseListTypeOption; - function parseCommandLine(commandLine, readFile) { - var options = {}; - var fileNames = []; - var errors = []; - parseStrings(commandLine); - return { - options: options, - fileNames: fileNames, - errors: errors - }; - function parseStrings(args) { - var i = 0; - while (i < args.length) { - var s = args[i]; - i++; - if (s.charCodeAt(0) === 64) { - parseResponseFile(s.slice(1)); - } - else if (s.charCodeAt(0) === 45) { - var opt = getOptionFromName(s.slice(s.charCodeAt(1) === 45 ? 2 : 1), true); - if (opt) { - if (opt.isTSConfigOnly) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); - } - else { - if (!args[i] && opt.type !== "boolean") { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); - } - switch (opt.type) { - case "number": - options[opt.name] = parseInt(args[i]); - i++; - break; - case "boolean": - var optValue = args[i]; - options[opt.name] = optValue !== "false"; - if (optValue === "false" || optValue === "true") { - i++; - } - break; - case "string": - options[opt.name] = args[i] || ""; - i++; - break; - case "list": - var result = parseListTypeOption(opt, args[i], errors); - options[opt.name] = result || []; - if (result) { - i++; - } - break; - default: - options[opt.name] = parseCustomTypeOption(opt, args[i], errors); - i++; - break; - } - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s)); - } - } - else { - fileNames.push(s); - } - } - } - function parseResponseFile(fileName) { - var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName); - if (!text) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); - return; - } - var args = []; - var pos = 0; - while (true) { - while (pos < text.length && text.charCodeAt(pos) <= 32) - pos++; - if (pos >= text.length) - break; - var start = pos; - if (text.charCodeAt(start) === 34) { - pos++; - while (pos < text.length && text.charCodeAt(pos) !== 34) - pos++; - if (pos < text.length) { - args.push(text.substring(start + 1, pos)); - pos++; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName)); - } - } - else { - while (text.charCodeAt(pos) > 32) - pos++; - args.push(text.substring(start, pos)); - } - } - parseStrings(args); - } - } - ts.parseCommandLine = parseCommandLine; - function getOptionFromName(optionName, allowShort) { - if (allowShort === void 0) { allowShort = false; } - optionName = optionName.toLowerCase(); - var _a = getOptionNameMap(), optionNameMap = _a.optionNameMap, shortOptionNames = _a.shortOptionNames; - if (allowShort) { - var short = shortOptionNames.get(optionName); - if (short !== undefined) { - optionName = short; - } - } - return optionNameMap.get(optionName); - } - function readConfigFile(fileName, readFile) { - var text = ""; - try { - text = readFile(fileName); - } - catch (e) { - return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) }; - } - return parseConfigFileTextToJson(fileName, text); - } - ts.readConfigFile = readConfigFile; - function parseConfigFileTextToJson(fileName, jsonText, stripComments) { - if (stripComments === void 0) { stripComments = true; } - try { - var jsonTextToParse = stripComments ? removeComments(jsonText) : jsonText; - return { config: /\S/.test(jsonTextToParse) ? JSON.parse(jsonTextToParse) : {} }; - } - catch (e) { - return { error: ts.createCompilerDiagnostic(ts.Diagnostics.Failed_to_parse_file_0_Colon_1, fileName, e.message) }; - } - } - ts.parseConfigFileTextToJson = parseConfigFileTextToJson; - function generateTSConfig(options, fileNames, newLine) { - var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions); - var configurations = { - compilerOptions: serializeCompilerOptions(compilerOptions) - }; - if (fileNames && fileNames.length) { - configurations.files = fileNames; - } - return writeConfigurations(); - function getCustomTypeMapOfCommandLineOption(optionDefinition) { - if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") { - return undefined; - } - else if (optionDefinition.type === "list") { - return getCustomTypeMapOfCommandLineOption(optionDefinition.element); - } - else { - return optionDefinition.type; - } - } - function getNameOfCompilerOptionValue(value, customTypeMap) { - return ts.forEachEntry(customTypeMap, function (mapValue, key) { - if (mapValue === value) { - return key; - } - }); - } - function serializeCompilerOptions(options) { - var result = {}; - var optionsNameMap = getOptionNameMap().optionNameMap; - for (var name in options) { - if (ts.hasProperty(options, name)) { - if (optionsNameMap.has(name) && optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options) { - continue; - } - var value = options[name]; - var optionDefinition = optionsNameMap.get(name.toLowerCase()); - if (optionDefinition) { - var customTypeMap = getCustomTypeMapOfCommandLineOption(optionDefinition); - if (!customTypeMap) { - result[name] = value; - } - else { - if (optionDefinition.type === "list") { - var convertedValue = []; - for (var _i = 0, _a = value; _i < _a.length; _i++) { - var element = _a[_i]; - convertedValue.push(getNameOfCompilerOptionValue(element, customTypeMap)); - } - result[name] = convertedValue; - } - else { - result[name] = getNameOfCompilerOptionValue(value, customTypeMap); - } - } - } - } - } - return result; - } - function getDefaultValueForOption(option) { - switch (option.type) { - case "number": - return 1; - case "boolean": - return true; - case "string": - return option.isFilePath ? "./" : ""; - case "list": - return []; - case "object": - return {}; - default: - return ts.arrayFrom(option.type.keys())[0]; - } - } - function makePadding(paddingLength) { - return Array(paddingLength + 1).join(" "); - } - function writeConfigurations() { - var categorizedOptions = ts.reduceLeft(ts.filter(ts.optionDeclarations, function (o) { return o.category !== ts.Diagnostics.Command_line_Options && o.category !== ts.Diagnostics.Advanced_Options; }), function (memo, value) { - if (value.category) { - var name = ts.getLocaleSpecificMessage(value.category); - (memo[name] || (memo[name] = [])).push(value); - } - return memo; - }, {}); - var marginLength = 0; - var seenKnownKeys = 0; - var nameColumn = []; - var descriptionColumn = []; - var knownKeysCount = ts.getOwnKeys(configurations.compilerOptions).length; - for (var category in categorizedOptions) { - if (nameColumn.length !== 0) { - nameColumn.push(""); - descriptionColumn.push(""); - } - nameColumn.push("/* " + category + " */"); - descriptionColumn.push(""); - for (var _i = 0, _a = categorizedOptions[category]; _i < _a.length; _i++) { - var option = _a[_i]; - var optionName = void 0; - if (ts.hasProperty(configurations.compilerOptions, option.name)) { - optionName = "\"" + option.name + "\": " + JSON.stringify(configurations.compilerOptions[option.name]) + ((seenKnownKeys += 1) === knownKeysCount ? "" : ","); - } - else { - optionName = "// \"" + option.name + "\": " + JSON.stringify(getDefaultValueForOption(option)) + ","; - } - nameColumn.push(optionName); - descriptionColumn.push("/* " + (option.description && ts.getLocaleSpecificMessage(option.description) || option.name) + " */"); - marginLength = Math.max(optionName.length, marginLength); - } - } - var tab = makePadding(2); - var result = []; - result.push("{"); - result.push(tab + "\"compilerOptions\": {"); - for (var i = 0; i < nameColumn.length; i++) { - var optionName = nameColumn[i]; - var description = descriptionColumn[i]; - result.push(optionName && "" + tab + tab + optionName + (description && (makePadding(marginLength - optionName.length + 2) + description))); - } - if (configurations.files && configurations.files.length) { - result.push(tab + "},"); - result.push(tab + "\"files\": ["); - for (var i = 0; i < configurations.files.length; i++) { - result.push("" + tab + tab + JSON.stringify(configurations.files[i]) + (i === configurations.files.length - 1 ? "" : ",")); - } - result.push(tab + "]"); - } - else { - result.push(tab + "}"); - } - result.push("}"); - return result.join(newLine); - } - } - ts.generateTSConfig = generateTSConfig; - function removeComments(jsonText) { - var output = ""; - var scanner = ts.createScanner(1, false, 0, jsonText); - var token; - while ((token = scanner.scan()) !== 1) { - switch (token) { - case 2: - case 3: - output += scanner.getTokenText().replace(/\S/g, " "); - break; - default: - output += scanner.getTokenText(); - break; - } - } - return output; - } - 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 options = (function () { - var _a = parseConfig(json, host, basePath, configFileName, resolutionStack, errors), include = _a.include, exclude = _a.exclude, files = _a.files, options = _a.options, compileOnSave = _a.compileOnSave; - if (include) { - json.include = include; - } - if (exclude) { - json.exclude = exclude; - } - if (files) { - json.files = files; - } - if (compileOnSave !== undefined) { - json.compileOnSave = compileOnSave; - } - return options; - })(); - options = ts.extend(existingOptions, options); - options.configFilePath = configFileName; - var jsonOptions = json["typeAcquisition"] || json["typingOptions"]; - var typeAcquisition = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); - var _a = getFileNames(), fileNames = _a.fileNames, wildcardDirectories = _a.wildcardDirectories; - var compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors); - return { - options: options, - fileNames: fileNames, - typeAcquisition: typeAcquisition, - raw: json, - errors: errors, - wildcardDirectories: wildcardDirectories, - compileOnSave: compileOnSave - }; - function getFileNames() { - var fileNames; - if (ts.hasProperty(json, "files")) { - if (ts.isArray(json["files"])) { - fileNames = json["files"]; - if (fileNames.length === 0) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json")); - } - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array")); - } - } - var includeSpecs; - if (ts.hasProperty(json, "include")) { - if (ts.isArray(json["include"])) { - includeSpecs = json["include"]; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "include", "Array")); - } - } - var excludeSpecs; - if (ts.hasProperty(json, "exclude")) { - if (ts.isArray(json["exclude"])) { - excludeSpecs = json["exclude"]; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "exclude", "Array")); - } - } - else { - excludeSpecs = includeSpecs ? [] : ["node_modules", "bower_components", "jspm_packages"]; - var outDir = json["compilerOptions"] && json["compilerOptions"]["outDir"]; - if (outDir) { - excludeSpecs.push(outDir); - } - } - if (fileNames === undefined && includeSpecs === undefined) { - includeSpecs = ["**/*"]; - } - 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 || []))); - } - return result; - } - } - ts.parseJsonConfigFileContent = parseJsonConfigFileContent; - function parseConfig(json, host, basePath, configFileName, resolutionStack, errors) { - basePath = ts.normalizeSlashes(basePath); - var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); - var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); - if (resolutionStack.indexOf(resolvedPath) >= 0) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))); - return { include: undefined, exclude: undefined, files: undefined, options: {}, compileOnSave: undefined }; - } - if (ts.hasProperty(json, "excludes")) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); - } - var options = convertCompilerOptionsFromJsonWorker(json.compilerOptions, basePath, errors, configFileName); - var include = json.include, exclude = json.exclude, files = json.files; - var compileOnSave = json.compileOnSave; - if (json.extends) { - resolutionStack = resolutionStack.concat([resolvedPath]); - var base = getExtendedConfig(json.extends, host, basePath, getCanonicalFileName, resolutionStack, errors); - if (base) { - include = include || base.include; - exclude = exclude || base.exclude; - files = files || base.files; - if (compileOnSave === undefined) { - compileOnSave = base.compileOnSave; - } - options = ts.assign({}, base.options, options); - } - } - return { include: include, exclude: exclude, files: files, options: options, compileOnSave: compileOnSave }; - } - function getExtendedConfig(extended, host, basePath, getCanonicalFileName, resolutionStack, errors) { - if (typeof extended !== "string") { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string")); - return undefined; - } - extended = ts.normalizeSlashes(extended); - if (!(ts.isRootedDiskPath(extended) || ts.startsWith(extended, "./") || ts.startsWith(extended, "../"))) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extended)); - return undefined; - } - var extendedConfigPath = ts.toPath(extended, basePath, getCanonicalFileName); - if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json")) { - extendedConfigPath = extendedConfigPath + ".json"; - if (!host.fileExists(extendedConfigPath)) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_does_not_exist, extended)); - return undefined; - } - } - var extendedResult = readConfigFile(extendedConfigPath, function (path) { return host.readFile(path); }); - if (extendedResult.error) { - errors.push(extendedResult.error); - return undefined; - } - var extendedDirname = ts.getDirectoryPath(extendedConfigPath); - var relativeDifference = ts.convertToRelativePath(extendedDirname, basePath, getCanonicalFileName); - var updatePath = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference, path); }; - var _a = parseConfig(extendedResult.config, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors), include = _a.include, exclude = _a.exclude, files = _a.files, options = _a.options, compileOnSave = _a.compileOnSave; - return { include: ts.map(include, updatePath), exclude: ts.map(exclude, updatePath), files: ts.map(files, updatePath), compileOnSave: compileOnSave, options: options }; - } - function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) { - if (!ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) { - return false; - } - var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption["compileOnSave"], basePath, errors); - if (typeof result === "boolean" && result) { - return result; - } - return false; - } - ts.convertCompileOnSaveOptionFromJson = convertCompileOnSaveOptionFromJson; - function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { - var errors = []; - var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); - return { options: options, errors: errors }; - } - ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; - function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { - var errors = []; - var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); - return { options: options, errors: errors }; - } - ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; - function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { - var options = ts.getBaseFileName(configFileName) === "jsconfig.json" - ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true } - : {}; - convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); - return options; - } - function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) { - var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; - var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); - convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors); - return options; - } - function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { - if (!jsonOptions) { - return; - } - var optionNameMap = ts.arrayToMap(optionDeclarations, function (opt) { return opt.name; }); - for (var id in jsonOptions) { - var opt = optionNameMap.get(id); - if (opt) { - defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); - } - else { - errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); - } - } - } - function convertJsonOption(opt, value, basePath, errors) { - var optType = opt.type; - var expectedType = typeof optType === "string" ? optType : "string"; - if (optType === "list" && ts.isArray(value)) { - return convertJsonOptionOfListType(opt, value, basePath, errors); - } - else if (typeof value === expectedType) { - if (typeof optType !== "string") { - return convertJsonOptionOfCustomType(opt, value, errors); - } - else { - if (opt.isFilePath) { - value = ts.normalizePath(ts.combinePaths(basePath, value)); - if (value === "") { - value = "."; - } - } - } - return value; - } - else { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, expectedType)); - } - } - function convertJsonOptionOfCustomType(opt, value, errors) { - var key = value.toLowerCase(); - var val = opt.type.get(key); - if (val !== undefined) { - return val; - } - else { - errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); - } - } - function convertJsonOptionOfListType(option, values, basePath, errors) { - return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); - } - function trimString(s) { - return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, ""); - } - var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/; - var invalidMultipleRecursionPatterns = /(^|\/)\*\*\/(.*\/)?\*\*($|\/)/; - var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/; - var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//; - var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; - function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions) { - basePath = ts.normalizePath(basePath); - var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; - var literalFileMap = ts.createMap(); - var wildcardFileMap = ts.createMap(); - if (include) { - include = validateSpecs(include, errors, false); - } - if (exclude) { - exclude = validateSpecs(exclude, errors, true); - } - var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); - 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]; - var file = ts.combinePaths(basePath, fileName); - literalFileMap.set(keyMapper(file), file); - } - } - if (include && include.length > 0) { - for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensions, exclude, include); _a < _b.length; _a++) { - var file = _b[_a]; - if (hasFileWithHigherPriorityExtension(file, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) { - continue; - } - removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); - var key = keyMapper(file); - if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { - wildcardFileMap.set(key, file); - } - } - } - var literalFiles = ts.arrayFrom(literalFileMap.values()); - var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); - return { - fileNames: literalFiles.concat(wildcardFiles), - wildcardDirectories: wildcardDirectories - }; - } - function validateSpecs(specs, errors, allowTrailingRecursion) { - var validSpecs = []; - for (var _i = 0, specs_1 = specs; _i < specs_1.length; _i++) { - var spec = specs_1[_i]; - if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); - } - else if (invalidMultipleRecursionPatterns.test(spec)) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0, spec)); - } - else if (invalidDotDotAfterRecursiveWildcardPattern.test(spec)) { - errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0, spec)); - } - else { - validSpecs.push(spec); - } - } - return validSpecs; - } - function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { - var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); - var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); - var wildcardDirectories = {}; - if (include !== undefined) { - var recursiveKeys = []; - for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { - var file = include_1[_i]; - var spec = ts.normalizePath(ts.combinePaths(path, file)); - if (excludeRegex && excludeRegex.test(spec)) { - continue; - } - var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames); - if (match) { - var key = match.key, flags = match.flags; - var existingFlags = wildcardDirectories[key]; - if (existingFlags === undefined || existingFlags < flags) { - wildcardDirectories[key] = flags; - if (flags === 1) { - recursiveKeys.push(key); - } - } - } - } - for (var key in wildcardDirectories) { - if (ts.hasProperty(wildcardDirectories, key)) { - for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { - var recursiveKey = recursiveKeys_1[_a]; - if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { - delete wildcardDirectories[key]; - } - } - } - } - } - return wildcardDirectories; - } - function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) { - var match = wildcardDirectoryPattern.exec(spec); - if (match) { - return { - key: useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(), - flags: watchRecursivePattern.test(spec) ? 1 : 0 - }; - } - if (ts.isImplicitGlob(spec)) { - return { key: spec, flags: 1 }; - } - return undefined; - } - function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) { - var extensionPriority = ts.getExtensionPriority(file, extensions); - var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions); - for (var i = 0; i < adjustedExtensionPriority; i++) { - var higherPriorityExtension = extensions[i]; - var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); - if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { - return true; - } - } - return false; - } - function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) { - var extensionPriority = ts.getExtensionPriority(file, extensions); - var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions); - for (var i = nextExtensionPriority; i < extensions.length; i++) { - var lowerPriorityExtension = extensions[i]; - var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); - wildcardFiles.delete(lowerPriorityPath); - } - } - function caseSensitiveKeyMapper(key) { - return key; - } - function caseInsensitiveKeyMapper(key) { - return key.toLowerCase(); - } - function convertCompilerOptionsForTelemetry(opts) { - var out = {}; - for (var key in opts) { - if (opts.hasOwnProperty(key)) { - var type = getOptionFromName(key); - if (type !== undefined) { - out[key] = getOptionValueWithEmptyStrings(opts[key], type); - } - } - } - return out; - } - ts.convertCompilerOptionsForTelemetry = convertCompilerOptionsForTelemetry; - function getOptionValueWithEmptyStrings(value, option) { - switch (option.type) { - case "object": - return ""; - case "string": - return ""; - case "number": - return typeof value === "number" ? value : ""; - case "boolean": - return typeof value === "boolean" ? value : ""; - case "list": - var elementType_1 = option.element; - return ts.isArray(value) ? value.map(function (v) { return getOptionValueWithEmptyStrings(v, elementType_1); }) : ""; - default: - return ts.forEachEntry(option.type, function (optionEnumValue, optionStringValue) { - if (optionEnumValue === value) { - return optionStringValue; - } - }); - } - } -})(ts || (ts = {})); -var ts; -(function (ts) { - function trace(host) { - host.trace(ts.formatMessage.apply(undefined, arguments)); - } - ts.trace = trace; - function isTraceEnabled(compilerOptions, host) { - return compilerOptions.traceResolution && host.trace !== undefined; - } - ts.isTraceEnabled = isTraceEnabled; - var Extensions; - (function (Extensions) { - Extensions[Extensions["TypeScript"] = 0] = "TypeScript"; - Extensions[Extensions["JavaScript"] = 1] = "JavaScript"; - Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; - })(Extensions || (Extensions = {})); - function resolvedTypeScriptOnly(resolved) { - if (!resolved) { - return undefined; - } - ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); - return resolved.path; - } - function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) { - return { - resolvedModule: resolved && { resolvedFileName: resolved.path, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport }, - failedLookupLocations: failedLookupLocations - }; - } - function moduleHasNonRelativeName(moduleName) { - return !(ts.isRootedDiskPath(moduleName) || ts.isExternalModuleNameRelative(moduleName)); - } - ts.moduleHasNonRelativeName = moduleHasNonRelativeName; - function tryReadPackageJsonFields(readTypes, packageJsonPath, baseDirectory, state) { - var jsonContent = readJson(packageJsonPath, state.host); - return readTypes ? tryReadFromField("typings") || tryReadFromField("types") : tryReadFromField("main"); - function tryReadFromField(fieldName) { - if (!ts.hasProperty(jsonContent, fieldName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_does_not_have_a_0_field, fieldName); - } - return; - } - var fileName = jsonContent[fieldName]; - if (typeof fileName !== "string") { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof fileName); - } - return; - } - var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path); - } - return path; - } - } - function readJson(path, host) { - try { - var jsonText = host.readFile(path); - return jsonText ? JSON.parse(jsonText) : {}; - } - catch (e) { - return {}; - } - } - function getEffectiveTypeRoots(options, host) { - if (options.typeRoots) { - return options.typeRoots; - } - var currentDirectory; - if (options.configFilePath) { - currentDirectory = ts.getDirectoryPath(options.configFilePath); - } - else if (host.getCurrentDirectory) { - currentDirectory = host.getCurrentDirectory(); - } - if (currentDirectory !== undefined) { - return getDefaultTypeRoots(currentDirectory, host); - } - } - ts.getEffectiveTypeRoots = getEffectiveTypeRoots; - function getDefaultTypeRoots(currentDirectory, host) { - if (!host.directoryExists) { - return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; - } - var typeRoots; - forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) { - var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); - if (host.directoryExists(atTypes)) { - (typeRoots || (typeRoots = [])).push(atTypes); - } - return undefined; - }); - return typeRoots; - } - var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types"); - function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { - var traceEnabled = isTraceEnabled(options, host); - var moduleResolutionState = { - compilerOptions: options, - host: host, - traceEnabled: traceEnabled - }; - var typeRoots = getEffectiveTypeRoots(options, host); - if (traceEnabled) { - if (containingFile === undefined) { - if (typeRoots === undefined) { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); - } - else { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots); - } - } - else { - if (typeRoots === undefined) { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); - } - else { - trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots); - } - } - } - var failedLookupLocations = []; - var resolved = primaryLookup(); - var primary = true; - if (!resolved) { - resolved = secondaryLookup(); - primary = false; - } - var resolvedTypeReferenceDirective; - if (resolved) { - resolved = realpath(resolved, host, traceEnabled); - if (traceEnabled) { - trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved, primary); - } - resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolved }; - } - return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations }; - function primaryLookup() { - if (typeRoots && typeRoots.length) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", ")); - } - return ts.forEach(typeRoots, function (typeRoot) { - var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); - var candidateDirectory = ts.getDirectoryPath(candidate); - var directoryExists = directoryProbablyExists(candidateDirectory, host); - if (!directoryExists && traceEnabled) { - trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); - } - return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); - }); - } - else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); - } - } - } - function secondaryLookup() { - var resolvedFile; - var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile); - if (initialLocationForSecondaryLookup !== undefined) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); - } - var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, undefined); - resolvedFile = resolvedTypeScriptOnly(result && result.value); - if (!resolvedFile && traceEnabled) { - trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); - } - return resolvedFile; - } - else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); - } - } - } - } - ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; - function getAutomaticTypeDirectiveNames(options, host) { - if (options.types) { - return options.types; - } - var result = []; - if (host.directoryExists && host.getDirectories) { - var typeRoots = getEffectiveTypeRoots(options, host); - if (typeRoots) { - for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) { - var root = typeRoots_1[_i]; - if (host.directoryExists(root)) { - for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) { - var typeDirectivePath = _b[_a]; - var normalized = ts.normalizePath(typeDirectivePath); - var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized)); - var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null; - if (!isNotNeededPackage) { - result.push(ts.getBaseFileName(normalized)); - } - } - } - } - } - } - return result; - } - ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; - function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { - var directoryToModuleNameMap = ts.createFileMap(); - var moduleNameToDirectoryMap = ts.createMap(); - return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; - function getOrCreateCacheForDirectory(directoryName) { - var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); - var perFolderCache = directoryToModuleNameMap.get(path); - if (!perFolderCache) { - perFolderCache = ts.createMap(); - directoryToModuleNameMap.set(path, perFolderCache); - } - return perFolderCache; - } - function getOrCreateCacheForModuleName(nonRelativeModuleName) { - if (!moduleHasNonRelativeName(nonRelativeModuleName)) { - return undefined; - } - var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); - if (!perModuleNameCache) { - perModuleNameCache = createPerModuleNameCache(); - moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); - } - return perModuleNameCache; - } - function createPerModuleNameCache() { - var directoryPathMap = ts.createFileMap(); - return { get: get, set: set }; - function get(directory) { - return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); - } - function set(directory, result) { - var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); - if (directoryPathMap.contains(path)) { - return; - } - directoryPathMap.set(path, result); - var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; - var commonPrefix = getCommonPrefix(path, resolvedFileName); - var current = path; - while (true) { - var parent = ts.getDirectoryPath(current); - if (parent === current || directoryPathMap.contains(parent)) { - break; - } - directoryPathMap.set(parent, result); - current = parent; - if (current === commonPrefix) { - break; - } - } - } - function getCommonPrefix(directory, resolution) { - if (resolution === undefined) { - return undefined; - } - var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); - var i = 0; - while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { - i++; - } - var sep = directory.lastIndexOf(ts.directorySeparator, i); - if (sep < 0) { - return undefined; - } - return directory.substr(0, sep); - } - } - } - ts.createModuleResolutionCache = createModuleResolutionCache; - function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { - var traceEnabled = isTraceEnabled(compilerOptions, host); - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); - } - var containingDirectory = ts.getDirectoryPath(containingFile); - var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); - var result = perFolderCache && perFolderCache.get(moduleName); - if (result) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); - } - } - else { - var moduleResolution = compilerOptions.moduleResolution; - if (moduleResolution === undefined) { - moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; - if (traceEnabled) { - trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); - } - } - else { - if (traceEnabled) { - trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); - } - } - switch (moduleResolution) { - case ts.ModuleResolutionKind.NodeJs: - result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); - break; - case ts.ModuleResolutionKind.Classic: - result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); - break; - default: - ts.Debug.fail("Unexpected moduleResolution: " + moduleResolution); - } - if (perFolderCache) { - perFolderCache.set(moduleName, result); - var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); - if (perModuleNameCache) { - perModuleNameCache.set(containingDirectory, result); - } - } - } - if (traceEnabled) { - if (result.resolvedModule) { - trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); - } - else { - trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); - } - } - return result; - } - ts.resolveModuleName = resolveModuleName; - function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { - if (moduleHasNonRelativeName(moduleName)) { - return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state); - } - else { - return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); - } - } - function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { - if (!state.compilerOptions.rootDirs) { - return undefined; - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); - } - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var matchedRootDir; - var matchedNormalizedPrefix; - for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { - var rootDir = _a[_i]; - var normalizedRoot = ts.normalizePath(rootDir); - if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { - normalizedRoot += ts.directorySeparator; - } - var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && - (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); - } - if (isLongestMatchingPrefix) { - matchedNormalizedPrefix = normalizedRoot; - matchedRootDir = rootDir; - } - } - if (matchedNormalizedPrefix) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); - } - var suffix = candidate.substr(matchedNormalizedPrefix.length); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); - } - var resolvedFileName = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); - if (resolvedFileName) { - return resolvedFileName; - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); - } - for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { - var rootDir = _c[_b]; - if (rootDir === matchedRootDir) { - continue; - } - var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); - } - var baseDirectory = ts.getDirectoryPath(candidate_1); - var resolvedFileName_1 = loader(extensions, candidate_1, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); - if (resolvedFileName_1) { - return resolvedFileName_1; - } - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed); - } - } - return undefined; - } - function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) { - if (!state.compilerOptions.baseUrl) { - return undefined; - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); - } - var matchedPattern = undefined; - if (state.compilerOptions.paths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); - } - matchedPattern = ts.matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName); - } - if (matchedPattern) { - var matchedStar_1 = typeof matchedPattern === "string" ? undefined : ts.matchedText(matchedPattern, moduleName); - var matchedPatternText = typeof matchedPattern === "string" ? matchedPattern : ts.patternText(matchedPattern); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText); - } - return ts.forEach(state.compilerOptions.paths[matchedPatternText], function (subst) { - var path = matchedStar_1 ? subst.replace("*", matchedStar_1) : subst; - var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); - } - var extension = ts.tryGetExtensionFromPath(candidate); - if (extension !== undefined) { - var path_1 = tryFile(candidate, failedLookupLocations, false, state); - if (path_1 !== undefined) { - return { path: path_1, extension: extension }; - } - } - return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); - }); - } - else { - var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate); - } - return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); - } - } - function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { - return nodeModuleNameResolverWorker(moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, false); - } - ts.nodeModuleNameResolver = nodeModuleNameResolver; - function resolveJavaScriptModule(moduleName, initialDir, host) { - var _a = nodeModuleNameResolverWorker(moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, undefined, true), resolvedModule = _a.resolvedModule, failedLookupLocations = _a.failedLookupLocations; - if (!resolvedModule) { - throw new Error("Could not resolve JS module " + moduleName + " starting at " + initialDir + ". Looked in: " + failedLookupLocations.join(", ")); - } - return resolvedModule.resolvedFileName; - } - ts.resolveJavaScriptModule = resolveJavaScriptModule; - function nodeModuleNameResolverWorker(moduleName, containingDirectory, compilerOptions, host, cache, jsOnly) { - var traceEnabled = isTraceEnabled(compilerOptions, host); - var failedLookupLocations = []; - var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var result = jsOnly ? tryResolve(Extensions.JavaScript) : (tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript)); - if (result && result.value) { - var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; - return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); - } - return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; - function tryResolve(extensions) { - var loader = function (extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, true); }; - var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); - if (resolved) { - return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); - } - if (moduleHasNonRelativeName(moduleName)) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); - } - var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); - return resolved_1 && { value: resolved_1.value && { resolved: { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }, isExternalLibraryImport: true } }; - } - else { - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state, true); - return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); - } - } - } - function realpath(path, host, traceEnabled) { - if (!host.realpath) { - return path; - } - var real = ts.normalizePath(host.realpath(path)); - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real); - } - return real; - } - function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); - } - if (!ts.pathEndsWithDirectorySeparator(candidate)) { - if (!onlyRecordFailures) { - var parentOfCandidate = ts.getDirectoryPath(candidate); - if (!directoryProbablyExists(parentOfCandidate, state.host)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); - } - onlyRecordFailures = true; - } - } - var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); - if (resolvedFromFile) { - return resolvedFromFile; - } - } - if (!onlyRecordFailures) { - var candidateExists = directoryProbablyExists(candidate, state.host); - if (!candidateExists) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); - } - onlyRecordFailures = true; - } - } - return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson); - } - function directoryProbablyExists(directoryName, host) { - return !host.directoryExists || host.directoryExists(directoryName); - } - ts.directoryProbablyExists = directoryProbablyExists; - function loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { - var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state); - if (resolvedByAddingExtension) { - return resolvedByAddingExtension; - } - if (ts.hasJavaScriptFileExtension(candidate)) { - var extensionless = ts.removeFileExtension(candidate); - if (state.traceEnabled) { - var extension = candidate.substring(extensionless.length); - trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension); - } - return tryAddingExtensions(extensionless, extensions, failedLookupLocations, onlyRecordFailures, state); - } - } - function tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures) { - var directory = ts.getDirectoryPath(candidate); - if (directory) { - onlyRecordFailures = !directoryProbablyExists(directory, state.host); - } - } - switch (extensions) { - case Extensions.DtsOnly: - return tryExtension(".d.ts", ts.Extension.Dts); - case Extensions.TypeScript: - return tryExtension(".ts", ts.Extension.Ts) || tryExtension(".tsx", ts.Extension.Tsx) || tryExtension(".d.ts", ts.Extension.Dts); - case Extensions.JavaScript: - return tryExtension(".js", ts.Extension.Js) || tryExtension(".jsx", ts.Extension.Jsx); - } - function tryExtension(ext, extension) { - var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state); - return path && { path: path, extension: extension }; - } - } - function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { - if (!onlyRecordFailures) { - if (state.host.fileExists(fileName)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); - } - return fileName; - } - else { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); - } - } - } - failedLookupLocations.push(fileName); - return undefined; - } - function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { - if (considerPackageJson === void 0) { considerPackageJson = true; } - var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); - if (considerPackageJson) { - var packageJsonPath = pathToPackageJson(candidate); - if (directoryExists && state.host.fileExists(packageJsonPath)) { - var fromPackageJson = loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state); - if (fromPackageJson) { - return fromPackageJson; - } - } - else { - if (directoryExists && state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); - } - failedLookupLocations.push(packageJsonPath); - } - } - return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); - } - function loadModuleFromPackageJson(packageJsonPath, extensions, candidate, failedLookupLocations, state) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); - } - var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript, packageJsonPath, candidate, state); - if (!file) { - return undefined; - } - var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host); - var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state); - if (fromFile) { - var resolved = fromFile && resolvedIfExtensionMatches(extensions, fromFile); - if (resolved) { - return resolved; - } - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile); - } - } - var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions; - return nodeLoadModuleByRelativeName(nextExtensions, file, failedLookupLocations, onlyRecordFailures, state, false); - } - function resolvedIfExtensionMatches(extensions, path) { - var extension = ts.tryGetExtensionFromPath(path); - return extension !== undefined && extensionIsOk(extensions, extension) ? { path: path, extension: extension } : undefined; - } - function extensionIsOk(extensions, extension) { - switch (extensions) { - case Extensions.JavaScript: - return extension === ts.Extension.Js || extension === ts.Extension.Jsx; - case Extensions.TypeScript: - return extension === ts.Extension.Ts || extension === ts.Extension.Tsx || extension === ts.Extension.Dts; - case Extensions.DtsOnly: - return extension === ts.Extension.Dts; - } - } - function pathToPackageJson(directory) { - return ts.combinePaths(directory, "package.json"); - } - function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { - var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); - return loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || - loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state); - } - function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { - return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache); - } - function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { - return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, true, undefined); - } - function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { - var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); - return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { - if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { - var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); - if (resolutionFromCache) { - return resolutionFromCache; - } - return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); - } - }); - } - function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { - if (typesOnly === void 0) { typesOnly = false; } - var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); - var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); - if (!nodeModulesFolderExists && state.traceEnabled) { - trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); - } - var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); - if (packageResult) { - return packageResult; - } - if (extensions !== Extensions.JavaScript) { - var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); - var nodeModulesAtTypesExists = nodeModulesFolderExists; - if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); - } - nodeModulesAtTypesExists = false; - } - return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, mangleScopedPackage(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); - } - } - var mangledScopedPackageSeparator = "__"; - function mangleScopedPackage(moduleName, state) { - if (ts.startsWith(moduleName, "@")) { - var replaceSlash = moduleName.replace(ts.directorySeparator, mangledScopedPackageSeparator); - if (replaceSlash !== moduleName) { - var mangled = replaceSlash.slice(1); - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.Scoped_package_detected_looking_in_0, mangled); - } - return mangled; - } - } - return moduleName; - } - function getPackageNameFromAtTypesDirectory(mangledName) { - var withoutAtTypePrefix = ts.removePrefix(mangledName, "@types/"); - if (withoutAtTypePrefix !== mangledName) { - return withoutAtTypePrefix.indexOf("__") !== -1 ? - "@" + withoutAtTypePrefix.replace(mangledScopedPackageSeparator, ts.directorySeparator) : - withoutAtTypePrefix; - } - return mangledName; - } - ts.getPackageNameFromAtTypesDirectory = getPackageNameFromAtTypesDirectory; - function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { - var result = cache && cache.get(containingDirectory); - if (result) { - if (traceEnabled) { - trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); - } - return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension } }; - } - } - function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { - var traceEnabled = isTraceEnabled(compilerOptions, host); - var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var failedLookupLocations = []; - var containingDirectory = ts.getDirectoryPath(containingFile); - var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); - return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations); - function tryResolve(extensions) { - var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFile, failedLookupLocations, state); - if (resolvedUsingSettings) { - return { value: resolvedUsingSettings }; - } - var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); - if (moduleHasNonRelativeName(moduleName)) { - var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { - var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); - if (resolutionFromCache) { - return resolutionFromCache; - } - var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); - return toSearchResult(loadModuleFromFile(extensions, searchName, failedLookupLocations, false, state)); - }); - if (resolved_3) { - return resolved_3; - } - if (extensions === Extensions.TypeScript) { - return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); - } - } - else { - var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); - return toSearchResult(loadModuleFromFile(extensions, candidate, failedLookupLocations, false, state)); - } - } - } - ts.classicNameResolver = classicNameResolver; - function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache) { - var traceEnabled = isTraceEnabled(compilerOptions, host); - if (traceEnabled) { - trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache); - } - var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; - var failedLookupLocations = []; - var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); - return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations); - } - ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; - function toSearchResult(value) { - return value !== undefined ? { value: value } : undefined; - } - function forEachAncestorDirectory(directory, callback) { - while (true) { - var result = callback(directory); - if (result !== undefined) { - return result; - } - var parentPath = ts.getDirectoryPath(directory); - if (parentPath === directory) { - return undefined; - } - directory = parentPath; - } - } })(ts || (ts = {})); var ts; (function (ts) { + ts.emptyArray = []; + ts.emptyMap = ts.createMap(); ts.externalHelpersModuleNameText = "tslib"; function getDeclarationOfKind(symbol, kind) { var declarations = symbol.declarations; @@ -8265,61 +4582,49 @@ var ts; return undefined; } ts.getDeclarationOfKind = getDeclarationOfKind; - function findDeclaration(symbol, predicate) { - var declarations = symbol.declarations; - if (declarations) { - for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { - var declaration = declarations_2[_i]; - if (predicate(declaration)) { - return declaration; - } - } + var stringWriter = createSingleLineStringWriter(); + var stringWriterAcquired = false; + function createSingleLineStringWriter() { + var str = ""; + var writeText = function (text) { return str += text; }; + return { + string: function () { return str; }, + writeKeyword: writeText, + writeOperator: writeText, + writePunctuation: writeText, + writeSpace: writeText, + writeStringLiteral: writeText, + writeParameter: writeText, + writeProperty: writeText, + writeSymbol: writeText, + writeLine: function () { return str += " "; }, + increaseIndent: ts.noop, + decreaseIndent: ts.noop, + clear: function () { return str = ""; }, + trackSymbol: ts.noop, + reportInaccessibleThisError: ts.noop, + reportPrivateInBaseOfClassExpression: ts.noop, + }; + } + function usingSingleLineStringWriter(action) { + try { + ts.Debug.assert(!stringWriterAcquired); + stringWriterAcquired = true; + action(stringWriter); + return stringWriter.string(); + } + finally { + stringWriter.clear(); + stringWriterAcquired = false; } - return undefined; } - ts.findDeclaration = findDeclaration; - var stringWriters = []; - function getSingleLineStringWriter() { - if (stringWriters.length === 0) { - var str_1 = ""; - var writeText = function (text) { return str_1 += text; }; - return { - string: function () { return str_1; }, - writeKeyword: writeText, - writeOperator: writeText, - writePunctuation: writeText, - writeSpace: writeText, - writeStringLiteral: writeText, - writeParameter: writeText, - writeProperty: writeText, - writeSymbol: writeText, - writeLine: function () { return str_1 += " "; }, - increaseIndent: ts.noop, - decreaseIndent: ts.noop, - clear: function () { return str_1 = ""; }, - trackSymbol: ts.noop, - reportInaccessibleThisError: ts.noop, - reportPrivateInBaseOfClassExpression: ts.noop, - }; - } - return stringWriters.pop(); - } - ts.getSingleLineStringWriter = getSingleLineStringWriter; - function releaseStringWriter(writer) { - writer.clear(); - stringWriters.push(writer); - } - ts.releaseStringWriter = releaseStringWriter; + ts.usingSingleLineStringWriter = usingSingleLineStringWriter; function getFullWidth(node) { return node.end - node.pos; } ts.getFullWidth = getFullWidth; - function hasResolvedModule(sourceFile, moduleNameText) { - return !!(sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText)); - } - ts.hasResolvedModule = hasResolvedModule; function getResolvedModule(sourceFile, moduleNameText) { - return hasResolvedModule(sourceFile, moduleNameText) ? sourceFile.resolvedModules.get(moduleNameText) : undefined; + return sourceFile && sourceFile.resolvedModules && sourceFile.resolvedModules.get(moduleNameText); } ts.getResolvedModule = getResolvedModule; function setResolvedModule(sourceFile, moduleNameText, resolvedModule) { @@ -8339,9 +4644,13 @@ var ts; function moduleResolutionIsEqualTo(oldResolution, newResolution) { return oldResolution.isExternalLibraryImport === newResolution.isExternalLibraryImport && oldResolution.extension === newResolution.extension && - oldResolution.resolvedFileName === newResolution.resolvedFileName; + oldResolution.resolvedFileName === newResolution.resolvedFileName && + packageIdIsEqual(oldResolution.packageId, newResolution.packageId); } ts.moduleResolutionIsEqualTo = moduleResolutionIsEqualTo; + function packageIdIsEqual(a, b) { + return a === b || a && b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version; + } function typeDirectiveIsEqualTo(oldResolution, newResolution) { return oldResolution.resolvedFileName === newResolution.resolvedFileName && oldResolution.primary === newResolution.primary; } @@ -8406,14 +4715,6 @@ var ts; return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; } ts.nodePosToString = nodePosToString; - function getStartPosOfNode(node) { - return node.pos; - } - ts.getStartPosOfNode = getStartPosOfNode; - function isDefined(value) { - return value !== undefined; - } - ts.isDefined = isDefined; function getEndLinePosition(line, sourceFile) { ts.Debug.assert(line >= 0); var lineStarts = ts.getLineStarts(sourceFile); @@ -8444,6 +4745,25 @@ var ts; return !nodeIsMissing(node); } ts.nodeIsPresent = nodeIsPresent; + function isRecognizedTripleSlashComment(text, commentPos, commentEnd) { + if (text.charCodeAt(commentPos + 1) === 47 && + commentPos + 2 < commentEnd && + text.charCodeAt(commentPos + 2) === 47) { + var textSubStr = text.substring(commentPos, commentEnd); + return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || + textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) || + textSubStr.match(fullTripleSlashReferenceTypeReferenceDirectiveRegEx) || + textSubStr.match(defaultLibReferenceRegEx) ? + true : false; + } + return false; + } + ts.isRecognizedTripleSlashComment = isRecognizedTripleSlashComment; + function isPinnedComment(text, comment) { + return text.charCodeAt(comment.pos + 1) === 42 && + text.charCodeAt(comment.pos + 2) === 33; + } + ts.isPinnedComment = isPinnedComment; function getTokenPosOfNode(node, sourceFile, includeJsDoc) { if (nodeIsMissing(node)) { return node.pos; @@ -8454,7 +4774,7 @@ var ts; if (includeJsDoc && node.jsDoc && node.jsDoc.length > 0) { return getTokenPosOfNode(node.jsDoc[0]); } - if (node.kind === 295 && node._children.length > 0) { + if (node.kind === 286 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos); @@ -8488,22 +4808,32 @@ var ts; return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); } ts.getTextOfNode = getTextOfNode; + function getEmitFlags(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.flags; + } + ts.getEmitFlags = getEmitFlags; function getLiteralText(node, sourceFile) { if (!nodeIsSynthesized(node) && node.parent) { return getSourceTextOfNodeFromSourceFile(sourceFile, node); } - var escapeText = ts.getEmitFlags(node) & 16777216 ? escapeString : escapeNonAsciiString; + var escapeText = getEmitFlags(node) & 16777216 ? escapeString : escapeNonAsciiString; switch (node.kind) { case 9: - return '"' + escapeText(node.text) + '"'; + if (node.singleQuote) { + return "'" + escapeText(node.text, 39) + "'"; + } + else { + return '"' + escapeText(node.text, 34) + '"'; + } case 13: - return "`" + escapeText(node.text) + "`"; + return "`" + escapeText(node.text, 96) + "`"; case 14: - return "`" + escapeText(node.text) + "${"; + return "`" + escapeText(node.text, 96) + "${"; case 15: - return "}" + escapeText(node.text) + "${"; + return "}" + escapeText(node.text, 96) + "${"; case 16: - return "}" + escapeText(node.text) + "`"; + return "}" + escapeText(node.text, 96) + "`"; case 8: return node.text; } @@ -8514,8 +4844,12 @@ var ts; return typeof value === "string" ? '"' + escapeNonAsciiString(value) + '"' : "" + value; } ts.getTextOfConstantValue = getTextOfConstantValue; + function escapeLeadingUnderscores(identifier) { + return (identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier); + } + ts.escapeLeadingUnderscores = escapeLeadingUnderscores; function escapeIdentifier(identifier) { - return identifier.length >= 2 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 ? "_" + identifier : identifier; + return identifier; } ts.escapeIdentifier = escapeIdentifier; function makeIdentifierFromModuleName(moduleName) { @@ -8537,6 +4871,10 @@ var ts; (node.name.kind === 9 || isGlobalScopeAugmentation(node)); } ts.isAmbientModule = isAmbientModule; + function isNonGlobalAmbientModule(node) { + return ts.isModuleDeclaration(node) && ts.isStringLiteral(node.name); + } + ts.isNonGlobalAmbientModule = isNonGlobalAmbientModule; function isShorthandAmbientModuleSymbol(moduleSymbol) { return isShorthandAmbientModule(moduleSymbol.valueDeclaration); } @@ -8615,13 +4953,13 @@ var ts; function getTextOfPropertyName(name) { switch (name.kind) { case 71: - return name.text; + return name.escapedText; case 9: case 8: - return name.text; + return escapeLeadingUnderscores(name.text); case 144: if (isStringOrNumericLiteral(name.expression)) { - return name.expression.text; + return escapeLeadingUnderscores(name.expression.text); } } return undefined; @@ -8630,7 +4968,7 @@ var ts; function entityNameToString(name) { switch (name.kind) { case 71: - return getFullWidth(name) === 0 ? ts.unescapeIdentifier(name.text) : getTextOfNode(name); + return getFullWidth(name) === 0 ? ts.unescapeLeadingUnderscores(name.escapedText) : getTextOfNode(name); case 143: return entityNameToString(name.left) + "." + entityNameToString(name.right); case 179: @@ -8750,17 +5088,14 @@ var ts; return ts.getLeadingCommentRanges(sourceFileOfNode.text, node.pos); } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; - function getLeadingCommentRangesOfNodeFromText(node, text) { - return ts.getLeadingCommentRanges(text, node.pos); - } - ts.getLeadingCommentRangesOfNodeFromText = getLeadingCommentRangesOfNodeFromText; function getJSDocCommentRanges(node, text) { var commentRanges = (node.kind === 146 || node.kind === 145 || node.kind === 186 || - node.kind === 187) ? + node.kind === 187 || + node.kind === 185) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : - getLeadingCommentRangesOfNodeFromText(node, text); + ts.getLeadingCommentRanges(text, node.pos); return ts.filter(commentRanges, function (comment) { return text.charCodeAt(comment.pos + 1) === 42 && text.charCodeAt(comment.pos + 2) === 42 && @@ -8769,8 +5104,9 @@ var ts; } ts.getJSDocCommentRanges = getJSDocCommentRanges; ts.fullTripleSlashReferencePathRegEx = /^(\/\/\/\s*<reference\s+path\s*=\s*)('|")(.+?)\2.*?\/>/; - ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*<reference\s+types\s*=\s*)('|")(.+?)\2.*?\/>/; + var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^(\/\/\/\s*<reference\s+types\s*=\s*)('|")(.+?)\2.*?\/>/; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/; + var defaultLibReferenceRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)('|")(.+?)\2\s*\/>/; function isPartOfTypeNode(node) { if (158 <= node.kind && node.kind <= 173) { return true; @@ -8987,22 +5323,21 @@ var ts; return predicate && predicate.kind === 0; } ts.isThisTypePredicate = isThisTypePredicate; - function getContainingFunction(node) { - while (true) { - node = node.parent; - if (!node || ts.isFunctionLike(node)) { - return node; + function getPropertyAssignment(objectLiteral, key, key2) { + return ts.filter(objectLiteral.properties, function (property) { + if (property.kind === 261) { + var propName = getTextOfPropertyName(property.name); + return key === propName || (key2 && key2 === propName); } - } + }); + } + ts.getPropertyAssignment = getPropertyAssignment; + function getContainingFunction(node) { + return ts.findAncestor(node.parent, ts.isFunctionLike); } ts.getContainingFunction = getContainingFunction; function getContainingClass(node) { - while (true) { - node = node.parent; - if (!node || ts.isClassLike(node)) { - return node; - } - } + return ts.findAncestor(node.parent, ts.isClassLike); } ts.getContainingClass = getContainingClass; function getThisContainer(node, includeArrowFunctions) { @@ -9122,7 +5457,6 @@ var ts; function getEntityNameFromTypeNode(node) { switch (node.kind) { case 159: - case 277: return node.typeName; case 201: return isEntityNameExpression(node.expression) @@ -9197,7 +5531,6 @@ var ts; ts.isJSXTagName = isJSXTagName; function isPartOfExpression(node) { switch (node.kind) { - case 99: case 97: case 95: case 101: @@ -9265,7 +5598,6 @@ var ts; case 221: case 257: case 223: - case 221: return parent.expression === node; case 214: var forStatement = parent; @@ -9300,12 +5632,6 @@ var ts; return false; } ts.isPartOfExpression = isPartOfExpression; - function isInstantiatedModule(node, preserveConstEnums) { - var moduleState = ts.getModuleInstanceState(node); - return moduleState === 1 || - (preserveConstEnums && moduleState === 2); - } - ts.isInstantiatedModule = isInstantiatedModule; function isExternalModuleImportEqualsDeclaration(node) { return node.kind === 237 && node.moduleReference.kind === 248; } @@ -9327,12 +5653,16 @@ var ts; return node && !!(node.flags & 65536); } ts.isInJavaScriptFile = isInJavaScriptFile; + function isInJSDoc(node) { + return node && !!(node.flags & 1048576); + } + ts.isInJSDoc = isInJSDoc; function isRequireCall(callExpression, checkArgumentIsStringLiteral) { if (callExpression.kind !== 181) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; - if (expression.kind !== 71 || expression.text !== "require") { + if (expression.kind !== 71 || expression.escapedText !== "require") { return false; } if (args.length !== 1) { @@ -9362,11 +5692,11 @@ var ts; } ts.getRightMostAssignedExpression = getRightMostAssignedExpression; function isExportsIdentifier(node) { - return ts.isIdentifier(node) && node.text === "exports"; + return ts.isIdentifier(node) && node.escapedText === "exports"; } ts.isExportsIdentifier = isExportsIdentifier; function isModuleExportsPropertyAccessExpression(node) { - return ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "module" && node.name.text === "exports"; + return ts.isPropertyAccessExpression(node) && ts.isIdentifier(node.expression) && node.expression.escapedText === "module" && node.name.escapedText === "exports"; } ts.isModuleExportsPropertyAccessExpression = isModuleExportsPropertyAccessExpression; function getSpecialPropertyAssignmentKind(expression) { @@ -9380,10 +5710,10 @@ var ts; var lhs = expr.left; if (lhs.expression.kind === 71) { var lhsId = lhs.expression; - if (lhsId.text === "exports") { + if (lhsId.escapedText === "exports") { return 1; } - else if (lhsId.text === "module" && lhs.name.text === "exports") { + else if (lhsId.escapedText === "module" && lhs.name.escapedText === "exports") { return 2; } else { @@ -9397,10 +5727,10 @@ var ts; var innerPropertyAccess = lhs.expression; if (innerPropertyAccess.expression.kind === 71) { var innerPropertyAccessIdentifier = innerPropertyAccess.expression; - if (innerPropertyAccessIdentifier.text === "module" && innerPropertyAccess.name.text === "exports") { + if (innerPropertyAccessIdentifier.escapedText === "module" && innerPropertyAccess.name.escapedText === "exports") { return 1; } - if (innerPropertyAccess.name.text === "prototype") { + if (innerPropertyAccess.name.escapedText === "prototype") { return 3; } } @@ -9459,41 +5789,40 @@ var ts; } ts.hasQuestionToken = hasQuestionToken; function isJSDocConstructSignature(node) { - return node.kind === 279 && + return node.kind === 273 && node.parameters.length > 0 && - node.parameters[0].type.kind === 281; + node.parameters[0].name && + node.parameters[0].name.escapedText === "new"; } ts.isJSDocConstructSignature = isJSDocConstructSignature; - function getCommentsFromJSDoc(node) { - return ts.map(getJSDocs(node), function (doc) { return doc.comment; }); - } - ts.getCommentsFromJSDoc = getCommentsFromJSDoc; function hasJSDocParameterTags(node) { - var parameterTags = getJSDocTags(node, 287); - return parameterTags && parameterTags.length > 0; + return !!getFirstJSDocTag(node, 279); } ts.hasJSDocParameterTags = hasJSDocParameterTags; - function getJSDocTags(node, kind) { - return ts.flatMap(getJSDocs(node), function (doc) { - return doc.kind === 283 - ? ts.filter(doc.tags, function (tag) { return tag.kind === kind; }) - : doc.kind === kind && doc; - }); - } function getFirstJSDocTag(node, kind) { - return node && ts.firstOrUndefined(getJSDocTags(node, kind)); + var tags = getJSDocTags(node); + return ts.find(tags, function (doc) { return doc.kind === kind; }); } - function getJSDocs(node) { + function getAllJSDocs(node) { if (ts.isJSDocTypedefTag(node)) { return [node.parent]; } - var cache = node.jsDocCache; - if (!cache) { - getJSDocsWorker(node); - node.jsDocCache = cache; + return getJSDocCommentsAndTags(node); + } + ts.getAllJSDocs = getAllJSDocs; + function getJSDocTags(node) { + var tags = node.jsDocCache; + if (tags === undefined) { + node.jsDocCache = tags = ts.flatMap(getJSDocCommentsAndTags(node), function (j) { return ts.isJSDoc(j) ? j.tags : j; }); } - return cache; - function getJSDocsWorker(node) { + return tags; + } + ts.getJSDocTags = getJSDocTags; + function getJSDocCommentsAndTags(node) { + var result; + getJSDocCommentsAndTagsWorker(node); + return result || ts.emptyArray; + function getJSDocCommentsAndTagsWorker(node) { var parent = node.parent; var isInitializerOfVariableDeclarationInStatement = isVariableLike(parent) && parent.initializer === node && @@ -9504,70 +5833,65 @@ var ts; isVariableOfVariableDeclarationStatement ? parent.parent : undefined; if (variableStatementNode) { - getJSDocsWorker(variableStatementNode); + getJSDocCommentsAndTagsWorker(variableStatementNode); } var isSourceOfAssignmentExpressionStatement = parent && parent.parent && parent.kind === 194 && parent.operatorToken.kind === 58 && parent.parent.kind === 210; if (isSourceOfAssignmentExpressionStatement) { - getJSDocsWorker(parent.parent); + getJSDocCommentsAndTagsWorker(parent.parent); } var isModuleDeclaration = node.kind === 233 && parent && parent.kind === 233; var isPropertyAssignmentExpression = parent && parent.kind === 261; if (isModuleDeclaration || isPropertyAssignmentExpression) { - getJSDocsWorker(parent); + getJSDocCommentsAndTagsWorker(parent); } if (node.kind === 146) { - cache = ts.concatenate(cache, getJSDocParameterTags(node)); + result = ts.addRange(result, getJSDocParameterTags(node)); } if (isVariableLike(node) && node.initializer) { - cache = ts.concatenate(cache, node.initializer.jsDoc); + result = ts.addRange(result, node.initializer.jsDoc); } - cache = ts.concatenate(cache, node.jsDoc); + result = ts.addRange(result, node.jsDoc); } } - ts.getJSDocs = getJSDocs; function getJSDocParameterTags(param) { - var func = param.parent; - var tags = getJSDocTags(func, 287); - if (!param.name) { - var i = func.parameters.indexOf(param); - var paramTags = ts.filter(tags, function (tag) { return tag.kind === 287; }); - if (paramTags && 0 <= i && i < paramTags.length) { - return [paramTags[i]]; - } + if (param.name && ts.isIdentifier(param.name)) { + var name_1 = param.name.escapedText; + return getJSDocTags(param.parent).filter(function (tag) { return ts.isJSDocParameterTag(tag) && ts.isIdentifier(tag.name) && tag.name.escapedText === name_1; }); } - else if (param.name.kind === 71) { - var name_1 = param.name.text; - return ts.filter(tags, function (tag) { return tag.kind === 287 && tag.name.text === name_1; }); + return undefined; + } + ts.getJSDocParameterTags = getJSDocParameterTags; + function getParameterSymbolFromJSDoc(node) { + if (node.symbol) { + return node.symbol; } - else { + if (!ts.isIdentifier(node.name)) { return undefined; } - } - ts.getJSDocParameterTags = getJSDocParameterTags; - function getParameterFromJSDoc(node) { - var name = node.name.text; - var grandParent = node.parent.parent; - ts.Debug.assert(node.parent.kind === 283); - if (!ts.isFunctionLike(grandParent)) { + var name = node.name.escapedText; + ts.Debug.assert(node.parent.kind === 275); + var func = node.parent.parent; + if (!ts.isFunctionLike(func)) { return undefined; } - return ts.find(grandParent.parameters, function (p) { - return p.name.kind === 71 && p.name.text === name; + var parameter = ts.find(func.parameters, function (p) { + return p.name.kind === 71 && p.name.escapedText === name; }); + return parameter && parameter.symbol; } - ts.getParameterFromJSDoc = getParameterFromJSDoc; + ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc; function getTypeParameterFromJsDoc(node) { - var name = node.name.text; + var name = node.name.escapedText; var typeParameters = node.parent.parent.parent.typeParameters; - return ts.find(typeParameters, function (p) { return p.name.text === name; }); + return ts.find(typeParameters, function (p) { return p.name.escapedText === name; }); } ts.getTypeParameterFromJsDoc = getTypeParameterFromJsDoc; function getJSDocType(node) { - var tag = getFirstJSDocTag(node, 289); + var tag = getFirstJSDocTag(node, 281); if (!tag && node.kind === 146) { var paramTags = getJSDocParameterTags(node); if (paramTags) { @@ -9578,15 +5902,15 @@ var ts; } ts.getJSDocType = getJSDocType; function getJSDocAugmentsTag(node) { - return getFirstJSDocTag(node, 285); + return getFirstJSDocTag(node, 277); } ts.getJSDocAugmentsTag = getJSDocAugmentsTag; function getJSDocClassTag(node) { - return getFirstJSDocTag(node, 286); + return getFirstJSDocTag(node, 278); } ts.getJSDocClassTag = getJSDocClassTag; function getJSDocReturnTag(node) { - return getFirstJSDocTag(node, 288); + return getFirstJSDocTag(node, 280); } ts.getJSDocReturnTag = getJSDocReturnTag; function getJSDocReturnType(node) { @@ -9595,7 +5919,7 @@ var ts; } ts.getJSDocReturnType = getJSDocReturnType; function getJSDocTemplateTag(node) { - return getFirstJSDocTag(node, 290); + return getFirstJSDocTag(node, 282); } ts.getJSDocTemplateTag = getJSDocTemplateTag; function hasRestParameter(s) { @@ -9607,9 +5931,9 @@ var ts; } ts.hasDeclaredRestParameter = hasDeclaredRestParameter; function isRestParameter(node) { - if (node && (node.flags & 65536)) { - if (node.type && node.type.kind === 280 || - ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 280; })) { + if (isInJavaScriptFile(node)) { + if (node.type && node.type.kind === 274 || + ts.forEach(getJSDocParameterTags(node), function (t) { return t.typeExpression && t.typeExpression.type.kind === 274; })) { return true; } } @@ -9757,6 +6081,7 @@ var ts; case 242: return parent.propertyName === node; case 246: + case 253: return true; } return false; @@ -9822,14 +6147,14 @@ var ts; ts.getAncestor = getAncestor; function getFileReferenceFromReferencePath(comment, commentRange) { var simpleReferenceRegEx = /^\/\/\/\s*<reference\s+/gim; - var isNoDefaultLibRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)('|")(.+?)\2\s*\/>/gim; + var isNoDefaultLibRegEx = new RegExp(defaultLibReferenceRegEx.source, "gim"); if (simpleReferenceRegEx.test(comment)) { if (isNoDefaultLibRegEx.test(comment)) { return { isNoDefaultLib: true }; } else { var refMatchResult = ts.fullTripleSlashReferencePathRegEx.exec(comment); - var refLibResult = !refMatchResult && ts.fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); + var refLibResult = !refMatchResult && fullTripleSlashReferenceTypeReferenceDirectiveRegEx.exec(comment); var match = refMatchResult || refLibResult; if (match) { var pos = commentRange.pos + match[1].length + match[2].length; @@ -9927,32 +6252,61 @@ var ts; } ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically; function getPropertyNameForPropertyNameNode(name) { - if (name.kind === 71 || name.kind === 9 || name.kind === 8 || name.kind === 146) { - return name.text; + if (name.kind === 71) { + return name.escapedText; + } + if (name.kind === 9 || name.kind === 8) { + return escapeLeadingUnderscores(name.text); } if (name.kind === 144) { var nameExpression = name.expression; if (isWellKnownSymbolSyntactically(nameExpression)) { - var rightHandSideName = nameExpression.name.text; - return getPropertyNameForKnownSymbolName(rightHandSideName); + var rightHandSideName = nameExpression.name.escapedText; + return getPropertyNameForKnownSymbolName(ts.unescapeLeadingUnderscores(rightHandSideName)); } else if (nameExpression.kind === 9 || nameExpression.kind === 8) { - return nameExpression.text; + return escapeLeadingUnderscores(nameExpression.text); } } return undefined; } ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode; + function getTextOfIdentifierOrLiteral(node) { + if (node) { + if (node.kind === 71) { + return ts.unescapeLeadingUnderscores(node.escapedText); + } + if (node.kind === 9 || + node.kind === 8) { + return node.text; + } + } + return undefined; + } + ts.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral; + function getEscapedTextOfIdentifierOrLiteral(node) { + if (node) { + if (node.kind === 71) { + return node.escapedText; + } + if (node.kind === 9 || + node.kind === 8) { + return escapeLeadingUnderscores(node.text); + } + } + return undefined; + } + ts.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral; function getPropertyNameForKnownSymbolName(symbolName) { return "__@" + symbolName; } ts.getPropertyNameForKnownSymbolName = getPropertyNameForKnownSymbolName; function isESSymbolIdentifier(node) { - return node.kind === 71 && node.text === "Symbol"; + return node.kind === 71 && node.escapedText === "Symbol"; } ts.isESSymbolIdentifier = isESSymbolIdentifier; function isPushOrUnshiftIdentifier(node) { - return node.text === "push" || node.text === "unshift"; + return node.escapedText === "push" || node.escapedText === "unshift"; } ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { @@ -9980,30 +6334,15 @@ var ts; || kind === 265; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; - function nodeIsSynthesized(node) { - return ts.positionIsSynthesized(node.pos) - || ts.positionIsSynthesized(node.end); + function nodeIsSynthesized(range) { + return ts.positionIsSynthesized(range.pos) + || ts.positionIsSynthesized(range.end); } ts.nodeIsSynthesized = nodeIsSynthesized; - function getOriginalSourceFileOrBundle(sourceFileOrBundle) { - if (sourceFileOrBundle.kind === 266) { - return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, getOriginalSourceFile)); - } - return getOriginalSourceFile(sourceFileOrBundle); - } - ts.getOriginalSourceFileOrBundle = getOriginalSourceFileOrBundle; function getOriginalSourceFile(sourceFile) { return ts.getParseTreeNode(sourceFile, ts.isSourceFile) || sourceFile; } - function getOriginalSourceFiles(sourceFiles) { - return ts.sameMap(sourceFiles, getOriginalSourceFile); - } - ts.getOriginalSourceFiles = getOriginalSourceFiles; - function getOriginalNodeId(node) { - node = ts.getOriginalNode(node); - return node ? ts.getNodeId(node) : 0; - } - ts.getOriginalNodeId = getOriginalNodeId; + ts.getOriginalSourceFile = getOriginalSourceFile; var Associativity; (function (Associativity) { Associativity[Associativity["Left"] = 0] = "Left"; @@ -10170,7 +6509,7 @@ var ts; return 2; case 198: return 1; - case 298: + case 289: return 0; default: return -1; @@ -10242,7 +6581,9 @@ var ts; } } ts.createDiagnosticCollection = createDiagnosticCollection; - var escapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + var doubleQuoteEscapedCharsRegExp = /[\\\"\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + var singleQuoteEscapedCharsRegExp = /[\\\'\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; + var backtickQuoteEscapedCharsRegExp = /[\\\`\u0000-\u001f\t\v\f\b\r\n\u2028\u2029\u0085]/g; var escapedCharsMap = ts.createMapFromTemplate({ "\0": "\\0", "\t": "\\t", @@ -10253,11 +6594,16 @@ var ts; "\n": "\\n", "\\": "\\\\", "\"": "\\\"", + "\'": "\\\'", + "\`": "\\\`", "\u2028": "\\u2028", "\u2029": "\\u2029", "\u0085": "\\u0085" }); - function escapeString(s) { + function escapeString(s, quoteChar) { + var escapedCharsRegExp = quoteChar === 96 ? backtickQuoteEscapedCharsRegExp : + quoteChar === 39 ? singleQuoteEscapedCharsRegExp : + doubleQuoteEscapedCharsRegExp; return s.replace(escapedCharsRegExp, getReplacement); } ts.escapeString = escapeString; @@ -10275,8 +6621,8 @@ var ts; return "\\u" + paddedHexCode; } var nonAsciiCharacters = /[^\u0000-\u007F]/g; - function escapeNonAsciiString(s) { - s = escapeString(s); + function escapeNonAsciiString(s, quoteChar) { + s = escapeString(s, quoteChar); return nonAsciiCharacters.test(s) ? s.replace(nonAsciiCharacters, function (c) { return get16BitUnicodeEscapeSequence(c.charCodeAt(0)); }) : s; @@ -10425,44 +6771,6 @@ var ts; return !(options.noEmitForJsFiles && isSourceFileJavaScript(sourceFile)) && !sourceFile.isDeclarationFile && !isSourceFileFromExternalLibrary(sourceFile); } ts.sourceFileMayBeEmitted = sourceFileMayBeEmitted; - function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { - var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); - var options = host.getCompilerOptions(); - if (options.outFile || options.out) { - if (sourceFiles.length) { - var jsFilePath = options.outFile || options.out; - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : ""; - action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, ts.createBundle(sourceFiles), emitOnlyDtsFiles); - } - } - else { - for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { - var sourceFile = sourceFiles_1[_i]; - var jsFilePath = getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); - var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); - var declarationFilePath = !isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; - action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFile, emitOnlyDtsFiles); - } - } - } - ts.forEachEmittedFile = forEachEmittedFile; - function getSourceMapFilePath(jsFilePath, options) { - return options.sourceMap ? jsFilePath + ".map" : undefined; - } - function getOutputExtension(sourceFile, options) { - if (options.jsx === 1) { - if (isSourceFileJavaScript(sourceFile)) { - if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { - return ".jsx"; - } - } - else if (sourceFile.languageVariant === 1) { - return ".jsx"; - } - } - return ".js"; - } function getSourceFilePathInNewDir(sourceFile, host, newDirPath) { var sourceFilePath = ts.getNormalizedAbsolutePath(sourceFile.fileName, host.getCurrentDirectory()); var commonSourceDirectory = host.getCommonSourceDirectory(); @@ -10577,7 +6885,7 @@ var ts; if (node.type) { return node.type; } - if (node.flags & 65536) { + if (isInJavaScriptFile(node)) { return getJSDocType(node); } } @@ -10586,7 +6894,7 @@ var ts; if (node.type) { return node.type; } - if (node.flags & 65536) { + if (isInJavaScriptFile(node)) { return getJSDocReturnType(node); } } @@ -10595,7 +6903,7 @@ var ts; if (node.typeParameters) { return node.typeParameters; } - if (node.flags & 65536) { + if (isInJavaScriptFile(node)) { var templateTag = getJSDocTemplateTag(node); return templateTag && templateTag.typeParameters; } @@ -10655,7 +6963,7 @@ var ts; var currentDetachedCommentInfo; if (removeComments) { if (node.pos === 0) { - leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedComment); + leadingComments = ts.filter(ts.getLeadingCommentRanges(text, node.pos), isPinnedCommentLocal); } } else { @@ -10687,9 +6995,8 @@ var ts; } } return currentDetachedCommentInfo; - function isPinnedComment(comment) { - return text.charCodeAt(comment.pos + 1) === 42 && - text.charCodeAt(comment.pos + 2) === 33; + function isPinnedCommentLocal(comment) { + return isPinnedComment(text, comment); } } ts.emitDetachedComments = emitDetachedComments; @@ -10760,9 +7067,13 @@ var ts; } ts.hasModifiers = hasModifiers; function hasModifier(node, flags) { - return (getModifierFlags(node) & flags) !== 0; + return !!getSelectedModifierFlags(node, flags); } ts.hasModifier = hasModifier; + function getSelectedModifierFlags(node, flags) { + return getModifierFlags(node) & flags; + } + ts.getSelectedModifierFlags = getSelectedModifierFlags; function getModifierFlags(node) { if (node.modifierFlagsCache & 536870912) { return node.modifierFlagsCache & ~536870912; @@ -10838,21 +7149,6 @@ var ts; return false; } ts.isDestructuringAssignment = isDestructuringAssignment; - function isSupportedExpressionWithTypeArguments(node) { - return isSupportedExpressionWithTypeArgumentsRest(node.expression); - } - ts.isSupportedExpressionWithTypeArguments = isSupportedExpressionWithTypeArguments; - function isSupportedExpressionWithTypeArgumentsRest(node) { - if (node.kind === 71) { - return true; - } - else if (ts.isPropertyAccessExpression(node)) { - return isSupportedExpressionWithTypeArgumentsRest(node.expression); - } - else { - return false; - } - } function isExpressionWithTypeArgumentsInClassExtendsClause(node) { return tryGetClassExtendingExpressionWithTypeArguments(node) !== undefined; } @@ -10965,72 +7261,6 @@ var ts; return carriageReturnLineFeed; } ts.getNewLineCharacter = getNewLineCharacter; - function isSimpleExpression(node) { - return isSimpleExpressionWorker(node, 0); - } - ts.isSimpleExpression = isSimpleExpression; - function isSimpleExpressionWorker(node, depth) { - if (depth <= 5) { - var kind = node.kind; - if (kind === 9 - || kind === 8 - || kind === 12 - || kind === 13 - || kind === 71 - || kind === 99 - || kind === 97 - || kind === 101 - || kind === 86 - || kind === 95) { - return true; - } - else if (kind === 179) { - return isSimpleExpressionWorker(node.expression, depth + 1); - } - else if (kind === 180) { - return isSimpleExpressionWorker(node.expression, depth + 1) - && isSimpleExpressionWorker(node.argumentExpression, depth + 1); - } - else if (kind === 192 - || kind === 193) { - return isSimpleExpressionWorker(node.operand, depth + 1); - } - else if (kind === 194) { - return node.operatorToken.kind !== 40 - && isSimpleExpressionWorker(node.left, depth + 1) - && isSimpleExpressionWorker(node.right, depth + 1); - } - else if (kind === 195) { - return isSimpleExpressionWorker(node.condition, depth + 1) - && isSimpleExpressionWorker(node.whenTrue, depth + 1) - && isSimpleExpressionWorker(node.whenFalse, depth + 1); - } - else if (kind === 190 - || kind === 189 - || kind === 188) { - return isSimpleExpressionWorker(node.expression, depth + 1); - } - else if (kind === 177) { - return node.elements.length === 0; - } - else if (kind === 178) { - return node.properties.length === 0; - } - else if (kind === 181) { - if (!isSimpleExpressionWorker(node.expression, depth + 1)) { - return false; - } - for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { - var argument = _a[_i]; - if (!isSimpleExpressionWorker(argument, depth + 1)) { - return false; - } - } - return true; - } - } - return false; - } function formatEnum(value, enumObject, isFlags) { if (value === void 0) { value = 0; } var members = getEnumMembers(enumObject); @@ -11099,18 +7329,6 @@ var ts; return formatEnum(flags, ts.ObjectFlags, true); } ts.formatObjectFlags = formatObjectFlags; - function getRangePos(range) { - return range ? range.pos : -1; - } - ts.getRangePos = getRangePos; - function getRangeEnd(range) { - return range ? range.end : -1; - } - ts.getRangeEnd = getRangeEnd; - function movePos(pos, value) { - return ts.positionIsSynthesized(pos) ? -1 : pos + value; - } - ts.movePos = movePos; function createRange(pos, end) { return { pos: pos, end: end }; } @@ -11139,14 +7357,6 @@ var ts; return range.pos === range.end; } ts.isCollapsedRange = isCollapsedRange; - function collapseRangeToStart(range) { - return isCollapsedRange(range) ? range : moveRangeEnd(range, range.pos); - } - ts.collapseRangeToStart = collapseRangeToStart; - function collapseRangeToEnd(range) { - return isCollapsedRange(range) ? range : moveRangePos(range, range.end); - } - ts.collapseRangeToEnd = collapseRangeToEnd; function createTokenRange(pos, token) { return createRange(pos, pos + ts.tokenToString(token).length); } @@ -11199,28 +7409,12 @@ var ts; function isInitializedVariable(node) { return node.initializer !== undefined; } - function isMergedWithClass(node) { - if (node.symbol) { - for (var _i = 0, _a = node.symbol.declarations; _i < _a.length; _i++) { - var declaration = _a[_i]; - if (declaration.kind === 229 && declaration !== node) { - return true; - } - } - } - return false; - } - ts.isMergedWithClass = isMergedWithClass; - function isFirstDeclarationOfKind(node, kind) { - return node.symbol && getDeclarationOfKind(node.symbol, kind) === node; - } - ts.isFirstDeclarationOfKind = isFirstDeclarationOfKind; function isWatchSet(options) { return options.watch && options.hasOwnProperty("watch"); } ts.isWatchSet = isWatchSet; function getCheckFlags(symbol) { - return symbol.flags & 134217728 ? symbol.checkFlags : 0; + return symbol.flags & 33554432 ? symbol.checkFlags : 0; } ts.getCheckFlags = getCheckFlags; function getDeclarationModifierFlagsFromSymbol(s) { @@ -11236,7 +7430,7 @@ var ts; var staticModifier = checkFlags & 512 ? 32 : 0; return accessModifier | staticModifier; } - if (s.flags & 16777216) { + if (s.flags & 4194304) { return 4 | 32; } return 0; @@ -11261,6 +7455,14 @@ var ts; return previous[previous.length - 1]; } ts.levenshtein = levenshtein; + function skipAlias(symbol, checker) { + return symbol.flags & 2097152 ? checker.getAliasedSymbol(symbol) : symbol; + } + ts.skipAlias = skipAlias; + function getCombinedLocalAndExportSymbolFlags(symbol) { + return symbol.exportSymbol ? symbol.exportSymbol.flags | symbol.flags : symbol.flags; + } + ts.getCombinedLocalAndExportSymbolFlags = getCombinedLocalAndExportSymbolFlags; })(ts || (ts = {})); (function (ts) { function getDefaultLibFileName(options) { @@ -11407,6 +7609,20 @@ var ts; return ts.hasModifier(node, 92) && node.parent.kind === 152 && ts.isClassLike(node.parent.parent); } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; + function isEmptyBindingPattern(node) { + if (ts.isBindingPattern(node)) { + return ts.every(node.elements, isEmptyBindingElement); + } + return false; + } + ts.isEmptyBindingPattern = isEmptyBindingPattern; + function isEmptyBindingElement(node) { + if (ts.isOmittedExpression(node)) { + return true; + } + return isEmptyBindingPattern(node.name); + } + ts.isEmptyBindingElement = isEmptyBindingElement; function walkUpBindingElementsAndPatterns(node) { while (node && (node.kind === 176 || ts.isBindingPattern(node))) { node = node.parent; @@ -11516,14 +7732,22 @@ var ts; return undefined; } ts.getParseTreeNode = getParseTreeNode; - function unescapeIdentifier(identifier) { - return identifier.length >= 3 && identifier.charCodeAt(0) === 95 && identifier.charCodeAt(1) === 95 && identifier.charCodeAt(2) === 95 ? identifier.substr(1) : identifier; + function unescapeLeadingUnderscores(identifier) { + var id = identifier; + return id.length >= 3 && id.charCodeAt(0) === 95 && id.charCodeAt(1) === 95 && id.charCodeAt(2) === 95 ? id.substr(1) : id; + } + ts.unescapeLeadingUnderscores = unescapeLeadingUnderscores; + function unescapeIdentifier(id) { + return id; } ts.unescapeIdentifier = unescapeIdentifier; function getNameOfDeclaration(declaration) { if (!declaration) { return undefined; } + if (ts.isJSDocPropertyLikeTag(declaration) && declaration.name.kind === 143) { + return declaration.name.right; + } if (declaration.kind === 194) { var expr = declaration; switch (ts.getSpecialPropertyAssignmentKind(expr)) { @@ -11751,6 +7975,13 @@ var ts; return node.kind === 185; } ts.isParenthesizedExpression = isParenthesizedExpression; + function skipPartiallyEmittedExpressions(node) { + while (node.kind === 288) { + node = node.expression; + } + return node; + } + ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions; function isFunctionExpression(node) { return node.kind === 186; } @@ -12087,100 +8318,72 @@ var ts; return node.kind === 269; } ts.isJSDocUnknownType = isJSDocUnknownType; - function isJSDocArrayType(node) { - return node.kind === 270; - } - ts.isJSDocArrayType = isJSDocArrayType; - function isJSDocUnionType(node) { - return node.kind === 271; - } - ts.isJSDocUnionType = isJSDocUnionType; - function isJSDocTupleType(node) { - return node.kind === 272; - } - ts.isJSDocTupleType = isJSDocTupleType; function isJSDocNullableType(node) { - return node.kind === 273; + return node.kind === 270; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 274; + return node.kind === 271; } ts.isJSDocNonNullableType = isJSDocNonNullableType; - function isJSDocRecordType(node) { - return node.kind === 275; - } - ts.isJSDocRecordType = isJSDocRecordType; - function isJSDocRecordMember(node) { - return node.kind === 276; - } - ts.isJSDocRecordMember = isJSDocRecordMember; - function isJSDocTypeReference(node) { - return node.kind === 277; - } - ts.isJSDocTypeReference = isJSDocTypeReference; function isJSDocOptionalType(node) { - return node.kind === 278; + return node.kind === 272; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 279; + return node.kind === 273; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 280; + return node.kind === 274; } ts.isJSDocVariadicType = isJSDocVariadicType; - function isJSDocConstructorType(node) { - return node.kind === 281; - } - ts.isJSDocConstructorType = isJSDocConstructorType; - function isJSDocThisType(node) { - return node.kind === 282; - } - ts.isJSDocThisType = isJSDocThisType; function isJSDoc(node) { - return node.kind === 283; + return node.kind === 275; } ts.isJSDoc = isJSDoc; function isJSDocAugmentsTag(node) { - return node.kind === 285; + return node.kind === 277; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocParameterTag(node) { - return node.kind === 287; + return node.kind === 279; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 288; + return node.kind === 280; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocTypeTag(node) { - return node.kind === 289; + return node.kind === 281; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 290; + return node.kind === 282; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 291; + return node.kind === 283; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocPropertyTag(node) { - return node.kind === 292; + return node.kind === 284; } ts.isJSDocPropertyTag = isJSDocPropertyTag; + function isJSDocPropertyLikeTag(node) { + return node.kind === 284 || node.kind === 279; + } + ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isJSDocTypeLiteral(node) { - return node.kind === 293; + return node.kind === 285; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; - function isJSDocLiteralType(node) { - return node.kind === 294; - } - ts.isJSDocLiteralType = isJSDocLiteralType; })(ts || (ts = {})); (function (ts) { + function isSyntaxList(n) { + return n.kind === 286; + } + ts.isSyntaxList = isSyntaxList; function isNode(node) { return isNodeKind(node.kind); } @@ -12194,8 +8397,7 @@ var ts; } ts.isToken = isToken; function isNodeArray(array) { - return array.hasOwnProperty("pos") - && array.hasOwnProperty("end"); + return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); } ts.isNodeArray = isNodeArray; function isLiteralKind(kind) { @@ -12216,6 +8418,19 @@ var ts; || kind === 16; } ts.isTemplateMiddleOrTemplateTail = isTemplateMiddleOrTemplateTail; + function isStringTextContainingNode(node) { + switch (node.kind) { + case 9: + case 14: + case 15: + case 16: + case 13: + return true; + default: + return false; + } + } + ts.isStringTextContainingNode = isStringTextContainingNode; function isGeneratedIdentifier(node) { return ts.isIdentifier(node) && node.autoGenerateKind > 0; } @@ -12281,6 +8496,7 @@ var ts; case 156: case 157: case 160: + case 273: case 161: return true; } @@ -12464,6 +8680,7 @@ var ts; || kind === 99 || kind === 101 || kind === 97 + || kind === 91 || kind === 203 || kind === 204; } @@ -12485,6 +8702,18 @@ var ts; return isUnaryExpressionKind(ts.skipPartiallyEmittedExpressions(node).kind); } ts.isUnaryExpression = isUnaryExpression; + function isUnaryExpressionWithWrite(expr) { + switch (expr.kind) { + case 193: + return true; + case 192: + return expr.operator === 43 || + expr.operator === 44; + default: + return false; + } + } + ts.isUnaryExpressionWithWrite = isUnaryExpressionWithWrite; function isExpressionKind(kind) { return kind === 195 || kind === 197 @@ -12493,7 +8722,7 @@ var ts; || kind === 198 || kind === 202 || kind === 200 - || kind === 298 + || kind === 289 || isUnaryExpressionKind(kind); } function isExpression(node) { @@ -12507,11 +8736,11 @@ var ts; } ts.isAssertionExpression = isAssertionExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 297; + return node.kind === 288; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isNotEmittedStatement(node) { - return node.kind === 296; + return node.kind === 287; } ts.isNotEmittedStatement = isNotEmittedStatement; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -12611,7 +8840,7 @@ var ts; || kind === 231 || kind === 145 || kind === 226 - || kind === 291; + || kind === 283; } function isDeclarationStatementKind(kind) { return kind === 228 @@ -12646,13 +8875,13 @@ var ts; || kind === 208 || kind === 213 || kind === 220 - || kind === 296 - || kind === 300 - || kind === 299; + || kind === 287 + || kind === 291 + || kind === 290; } function isDeclaration(node) { if (node.kind === 145) { - return node.parent.kind !== 290 || ts.isInJavaScriptFile(node); + return node.parent.kind !== 282 || ts.isInJavaScriptFile(node); } return isDeclarationKind(node.kind); } @@ -12669,9 +8898,19 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 207; + || isBlockStatement(node); } ts.isStatement = isStatement; + function isBlockStatement(node) { + if (node.kind !== 207) + return false; + if (node.parent !== undefined) { + if (node.parent.kind === 224 || node.parent.kind === 260) { + return false; + } + } + return !ts.isFunctionBlock(node); + } function isModuleReference(node) { var kind = node.kind; return kind === 248 @@ -12719,3558 +8958,1626 @@ var ts; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isJSDocNode(node) { - return node.kind >= 267 && node.kind <= 294; + return node.kind >= 267 && node.kind <= 285; } ts.isJSDocNode = isJSDocNode; function isJSDocCommentContainingNode(node) { - return node.kind === 283 || isJSDocTag(node); + return node.kind === 275 || isJSDocTag(node); } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; function isJSDocTag(node) { - return node.kind >= 284 && node.kind <= 294; + return node.kind >= 276 && node.kind <= 285; } ts.isJSDocTag = isJSDocTag; })(ts || (ts = {})); var ts; (function (ts) { - function createSynthesizedNode(kind) { - var node = ts.createNode(kind, -1, -1); - node.flags |= 8; - return node; - } - function updateNode(updated, original) { - if (updated !== original) { - setOriginalNode(updated, original); - setTextRange(updated, original); - if (original.startsOnNewLine) { - updated.startsOnNewLine = true; - } - ts.aggregateTransformFlags(updated); - } - return updated; - } - ts.updateNode = updateNode; - function createNodeArray(elements, hasTrailingComma) { - if (elements) { - if (ts.isNodeArray(elements)) { - return elements; - } - } - else { - elements = []; - } - var array = elements; - array.pos = -1; - array.end = -1; - array.hasTrailingComma = hasTrailingComma; - return array; - } - ts.createNodeArray = createNodeArray; - function getSynthesizedClone(node) { - var clone = createSynthesizedNode(node.kind); - clone.flags |= node.flags; - setOriginalNode(clone, node); - for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { - continue; - } - clone[key] = node[key]; - } - return clone; - } - ts.getSynthesizedClone = getSynthesizedClone; - function createLiteral(value) { - if (typeof value === "number") { - return createNumericLiteral(value + ""); - } - if (typeof value === "boolean") { - return value ? createTrue() : createFalse(); - } - if (typeof value === "string") { - return createStringLiteral(value); - } - return createLiteralFromNode(value); - } - ts.createLiteral = createLiteral; - function createNumericLiteral(value) { - var node = createSynthesizedNode(8); - node.text = value; - node.numericLiteralFlags = 0; - return node; - } - ts.createNumericLiteral = createNumericLiteral; - function createStringLiteral(text) { - var node = createSynthesizedNode(9); - node.text = text; - return node; - } - function createLiteralFromNode(sourceNode) { - var node = createStringLiteral(sourceNode.text); - node.textSourceNode = sourceNode; - return node; - } - function createIdentifier(text, typeArguments) { - var node = createSynthesizedNode(71); - node.text = ts.escapeIdentifier(text); - node.originalKeywordKind = text ? ts.stringToToken(text) : 0; - node.autoGenerateKind = 0; - node.autoGenerateId = 0; - if (typeArguments) { - node.typeArguments = createNodeArray(typeArguments); - } - return node; - } - ts.createIdentifier = createIdentifier; - function updateIdentifier(node, typeArguments) { - return node.typeArguments !== typeArguments - ? updateNode(createIdentifier(node.text, typeArguments), node) - : node; - } - ts.updateIdentifier = updateIdentifier; - var nextAutoGenerateId = 0; - function createTempVariable(recordTempVariable) { - var name = createIdentifier(""); - name.autoGenerateKind = 1; - name.autoGenerateId = nextAutoGenerateId; - nextAutoGenerateId++; - if (recordTempVariable) { - recordTempVariable(name); - } - return name; - } - ts.createTempVariable = createTempVariable; - function createLoopVariable() { - var name = createIdentifier(""); - name.autoGenerateKind = 2; - name.autoGenerateId = nextAutoGenerateId; - nextAutoGenerateId++; - return name; - } - ts.createLoopVariable = createLoopVariable; - function createUniqueName(text) { - var name = createIdentifier(text); - name.autoGenerateKind = 3; - name.autoGenerateId = nextAutoGenerateId; - nextAutoGenerateId++; - return name; - } - ts.createUniqueName = createUniqueName; - function getGeneratedNameForNode(node) { - var name = createIdentifier(""); - name.autoGenerateKind = 4; - name.autoGenerateId = nextAutoGenerateId; - name.original = node; - nextAutoGenerateId++; - return name; - } - ts.getGeneratedNameForNode = getGeneratedNameForNode; - function createToken(token) { - return createSynthesizedNode(token); - } - ts.createToken = createToken; - function createSuper() { - return createSynthesizedNode(97); - } - ts.createSuper = createSuper; - function createThis() { - return createSynthesizedNode(99); - } - ts.createThis = createThis; - function createNull() { - return createSynthesizedNode(95); - } - ts.createNull = createNull; - function createTrue() { - return createSynthesizedNode(101); - } - ts.createTrue = createTrue; - function createFalse() { - return createSynthesizedNode(86); - } - ts.createFalse = createFalse; - function createQualifiedName(left, right) { - var node = createSynthesizedNode(143); - node.left = left; - node.right = asName(right); - return node; - } - ts.createQualifiedName = createQualifiedName; - function updateQualifiedName(node, left, right) { - return node.left !== left - || node.right !== right - ? updateNode(createQualifiedName(left, right), node) - : node; - } - ts.updateQualifiedName = updateQualifiedName; - function createComputedPropertyName(expression) { - var node = createSynthesizedNode(144); - node.expression = expression; - return node; - } - ts.createComputedPropertyName = createComputedPropertyName; - function updateComputedPropertyName(node, expression) { - return node.expression !== expression - ? updateNode(createComputedPropertyName(expression), node) - : node; - } - ts.updateComputedPropertyName = updateComputedPropertyName; - function createTypeParameterDeclaration(name, constraint, defaultType) { - var node = createSynthesizedNode(145); - node.name = asName(name); - node.constraint = constraint; - node.default = defaultType; - return node; - } - ts.createTypeParameterDeclaration = createTypeParameterDeclaration; - function updateTypeParameterDeclaration(node, name, constraint, defaultType) { - return node.name !== name - || node.constraint !== constraint - || node.default !== defaultType - ? updateNode(createTypeParameterDeclaration(name, constraint, defaultType), node) - : node; - } - ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration; - function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createSynthesizedNode(146); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.dotDotDotToken = dotDotDotToken; - node.name = asName(name); - node.questionToken = questionToken; - node.type = type; - node.initializer = initializer ? ts.parenthesizeExpressionForList(initializer) : undefined; - return node; - } - ts.createParameter = createParameter; - function updateParameter(node, decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.dotDotDotToken !== dotDotDotToken - || node.name !== name - || node.questionToken !== questionToken - || node.type !== type - || node.initializer !== initializer - ? updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, node.questionToken, type, initializer), node) - : node; - } - ts.updateParameter = updateParameter; - function createDecorator(expression) { - var node = createSynthesizedNode(147); - node.expression = ts.parenthesizeForAccess(expression); - return node; - } - ts.createDecorator = createDecorator; - function updateDecorator(node, expression) { - return node.expression !== expression - ? updateNode(createDecorator(expression), node) - : node; - } - ts.updateDecorator = updateDecorator; - function createPropertySignature(modifiers, name, questionToken, type, initializer) { - var node = createSynthesizedNode(148); - node.modifiers = asNodeArray(modifiers); - node.name = asName(name); - node.questionToken = questionToken; - node.type = type; - node.initializer = initializer; - return node; - } - ts.createPropertySignature = createPropertySignature; - function updatePropertySignature(node, modifiers, name, questionToken, type, initializer) { - return node.modifiers !== modifiers - || node.name !== name - || node.questionToken !== questionToken - || node.type !== type - || node.initializer !== initializer - ? updateNode(createPropertySignature(modifiers, name, questionToken, type, initializer), node) - : node; - } - ts.updatePropertySignature = updatePropertySignature; - function createProperty(decorators, modifiers, name, questionToken, type, initializer) { - var node = createSynthesizedNode(149); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.name = asName(name); - node.questionToken = questionToken; - node.type = type; - node.initializer = initializer; - return node; - } - ts.createProperty = createProperty; - function updateProperty(node, decorators, modifiers, name, type, initializer) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.name !== name - || node.type !== type - || node.initializer !== initializer - ? updateNode(createProperty(decorators, modifiers, name, node.questionToken, type, initializer), node) - : node; - } - ts.updateProperty = updateProperty; - function createMethodSignature(typeParameters, parameters, type, name, questionToken) { - var node = createSignatureDeclaration(150, typeParameters, parameters, type); - node.name = asName(name); - node.questionToken = questionToken; - return node; - } - ts.createMethodSignature = createMethodSignature; - function updateMethodSignature(node, typeParameters, parameters, type, name, questionToken) { - return node.typeParameters !== typeParameters - || node.parameters !== parameters - || node.type !== type - || node.name !== name - || node.questionToken !== questionToken - ? updateNode(createMethodSignature(typeParameters, parameters, type, name, questionToken), node) - : node; - } - ts.updateMethodSignature = updateMethodSignature; - function createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(151); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.asteriskToken = asteriskToken; - node.name = asName(name); - node.questionToken = questionToken; - node.typeParameters = asNodeArray(typeParameters); - node.parameters = createNodeArray(parameters); - node.type = type; - node.body = body; - return node; - } - ts.createMethod = createMethod; - function updateMethod(node, decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.asteriskToken !== asteriskToken - || node.name !== name - || node.typeParameters !== typeParameters - || node.parameters !== parameters - || node.type !== type - || node.body !== body - ? updateNode(createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body), node) - : node; - } - ts.updateMethod = updateMethod; - function createConstructor(decorators, modifiers, parameters, body) { - var node = createSynthesizedNode(152); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.typeParameters = undefined; - node.parameters = createNodeArray(parameters); - node.type = undefined; - node.body = body; - return node; - } - ts.createConstructor = createConstructor; - function updateConstructor(node, decorators, modifiers, parameters, body) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.parameters !== parameters - || node.body !== body - ? updateNode(createConstructor(decorators, modifiers, parameters, body), node) - : node; - } - ts.updateConstructor = updateConstructor; - function createGetAccessor(decorators, modifiers, name, parameters, type, body) { - var node = createSynthesizedNode(153); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.name = asName(name); - node.typeParameters = undefined; - node.parameters = createNodeArray(parameters); - node.type = type; - node.body = body; - return node; - } - ts.createGetAccessor = createGetAccessor; - function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.name !== name - || node.parameters !== parameters - || node.type !== type - || node.body !== body - ? updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body), node) - : node; - } - ts.updateGetAccessor = updateGetAccessor; - function createSetAccessor(decorators, modifiers, name, parameters, body) { - var node = createSynthesizedNode(154); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.name = asName(name); - node.typeParameters = undefined; - node.parameters = createNodeArray(parameters); - node.body = body; - return node; - } - ts.createSetAccessor = createSetAccessor; - function updateSetAccessor(node, decorators, modifiers, name, parameters, body) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.name !== name - || node.parameters !== parameters - || node.body !== body - ? updateNode(createSetAccessor(decorators, modifiers, name, parameters, body), node) - : node; - } - ts.updateSetAccessor = updateSetAccessor; - function createCallSignature(typeParameters, parameters, type) { - return createSignatureDeclaration(155, typeParameters, parameters, type); - } - ts.createCallSignature = createCallSignature; - function updateCallSignature(node, typeParameters, parameters, type) { - return updateSignatureDeclaration(node, typeParameters, parameters, type); - } - ts.updateCallSignature = updateCallSignature; - function createConstructSignature(typeParameters, parameters, type) { - return createSignatureDeclaration(156, typeParameters, parameters, type); - } - ts.createConstructSignature = createConstructSignature; - function updateConstructSignature(node, typeParameters, parameters, type) { - return updateSignatureDeclaration(node, typeParameters, parameters, type); - } - ts.updateConstructSignature = updateConstructSignature; - function createIndexSignature(decorators, modifiers, parameters, type) { - var node = createSynthesizedNode(157); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.parameters = createNodeArray(parameters); - node.type = type; - return node; - } - ts.createIndexSignature = createIndexSignature; - function updateIndexSignature(node, decorators, modifiers, parameters, type) { - return node.parameters !== parameters - || node.type !== type - || node.decorators !== decorators - || node.modifiers !== modifiers - ? updateNode(createIndexSignature(decorators, modifiers, parameters, type), node) - : node; - } - ts.updateIndexSignature = updateIndexSignature; - function createSignatureDeclaration(kind, typeParameters, parameters, type) { - var node = createSynthesizedNode(kind); - node.typeParameters = asNodeArray(typeParameters); - node.parameters = asNodeArray(parameters); - node.type = type; - return node; - } - ts.createSignatureDeclaration = createSignatureDeclaration; - function updateSignatureDeclaration(node, typeParameters, parameters, type) { - return node.typeParameters !== typeParameters - || node.parameters !== parameters - || node.type !== type - ? updateNode(createSignatureDeclaration(node.kind, typeParameters, parameters, type), node) - : node; - } - function createKeywordTypeNode(kind) { - return createSynthesizedNode(kind); - } - ts.createKeywordTypeNode = createKeywordTypeNode; - function createTypePredicateNode(parameterName, type) { - var node = createSynthesizedNode(158); - node.parameterName = asName(parameterName); - node.type = type; - return node; - } - ts.createTypePredicateNode = createTypePredicateNode; - function updateTypePredicateNode(node, parameterName, type) { - return node.parameterName !== parameterName - || node.type !== type - ? updateNode(createTypePredicateNode(parameterName, type), node) - : node; - } - ts.updateTypePredicateNode = updateTypePredicateNode; - function createTypeReferenceNode(typeName, typeArguments) { - var node = createSynthesizedNode(159); - node.typeName = asName(typeName); - node.typeArguments = typeArguments && ts.parenthesizeTypeParameters(typeArguments); - return node; - } - ts.createTypeReferenceNode = createTypeReferenceNode; - function updateTypeReferenceNode(node, typeName, typeArguments) { - return node.typeName !== typeName - || node.typeArguments !== typeArguments - ? updateNode(createTypeReferenceNode(typeName, typeArguments), node) - : node; - } - ts.updateTypeReferenceNode = updateTypeReferenceNode; - function createFunctionTypeNode(typeParameters, parameters, type) { - return createSignatureDeclaration(160, typeParameters, parameters, type); - } - ts.createFunctionTypeNode = createFunctionTypeNode; - function updateFunctionTypeNode(node, typeParameters, parameters, type) { - return updateSignatureDeclaration(node, typeParameters, parameters, type); - } - ts.updateFunctionTypeNode = updateFunctionTypeNode; - function createConstructorTypeNode(typeParameters, parameters, type) { - return createSignatureDeclaration(161, typeParameters, parameters, type); - } - ts.createConstructorTypeNode = createConstructorTypeNode; - function updateConstructorTypeNode(node, typeParameters, parameters, type) { - return updateSignatureDeclaration(node, typeParameters, parameters, type); - } - ts.updateConstructorTypeNode = updateConstructorTypeNode; - function createTypeQueryNode(exprName) { - var node = createSynthesizedNode(162); - node.exprName = exprName; - return node; - } - ts.createTypeQueryNode = createTypeQueryNode; - function updateTypeQueryNode(node, exprName) { - return node.exprName !== exprName - ? updateNode(createTypeQueryNode(exprName), node) - : node; - } - ts.updateTypeQueryNode = updateTypeQueryNode; - function createTypeLiteralNode(members) { - var node = createSynthesizedNode(163); - node.members = createNodeArray(members); - return node; - } - ts.createTypeLiteralNode = createTypeLiteralNode; - function updateTypeLiteralNode(node, members) { - return node.members !== members - ? updateNode(createTypeLiteralNode(members), node) - : node; - } - ts.updateTypeLiteralNode = updateTypeLiteralNode; - function createArrayTypeNode(elementType) { - var node = createSynthesizedNode(164); - node.elementType = ts.parenthesizeElementTypeMember(elementType); - return node; - } - ts.createArrayTypeNode = createArrayTypeNode; - function updateArrayTypeNode(node, elementType) { - return node.elementType !== elementType - ? updateNode(createArrayTypeNode(elementType), node) - : node; - } - ts.updateArrayTypeNode = updateArrayTypeNode; - function createTupleTypeNode(elementTypes) { - var node = createSynthesizedNode(165); - node.elementTypes = createNodeArray(elementTypes); - return node; - } - ts.createTupleTypeNode = createTupleTypeNode; - function updateTypleTypeNode(node, elementTypes) { - return node.elementTypes !== elementTypes - ? updateNode(createTupleTypeNode(elementTypes), node) - : node; - } - ts.updateTypleTypeNode = updateTypleTypeNode; - function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(166, types); - } - ts.createUnionTypeNode = createUnionTypeNode; - function updateUnionTypeNode(node, types) { - return updateUnionOrIntersectionTypeNode(node, types); - } - ts.updateUnionTypeNode = updateUnionTypeNode; - function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(167, types); - } - ts.createIntersectionTypeNode = createIntersectionTypeNode; - function updateIntersectionTypeNode(node, types) { - return updateUnionOrIntersectionTypeNode(node, types); - } - ts.updateIntersectionTypeNode = updateIntersectionTypeNode; - function createUnionOrIntersectionTypeNode(kind, types) { - var node = createSynthesizedNode(kind); - node.types = ts.parenthesizeElementTypeMembers(types); - return node; - } - ts.createUnionOrIntersectionTypeNode = createUnionOrIntersectionTypeNode; - function updateUnionOrIntersectionTypeNode(node, types) { - return node.types !== types - ? updateNode(createUnionOrIntersectionTypeNode(node.kind, types), node) - : node; - } - function createParenthesizedType(type) { - var node = createSynthesizedNode(168); - node.type = type; - return node; - } - ts.createParenthesizedType = createParenthesizedType; - function updateParenthesizedType(node, type) { - return node.type !== type - ? updateNode(createParenthesizedType(type), node) - : node; - } - ts.updateParenthesizedType = updateParenthesizedType; - function createThisTypeNode() { - return createSynthesizedNode(169); - } - ts.createThisTypeNode = createThisTypeNode; - function createTypeOperatorNode(type) { - var node = createSynthesizedNode(170); - node.operator = 127; - node.type = ts.parenthesizeElementTypeMember(type); - return node; - } - ts.createTypeOperatorNode = createTypeOperatorNode; - function updateTypeOperatorNode(node, type) { - return node.type !== type ? updateNode(createTypeOperatorNode(type), node) : node; - } - ts.updateTypeOperatorNode = updateTypeOperatorNode; - function createIndexedAccessTypeNode(objectType, indexType) { - var node = createSynthesizedNode(171); - node.objectType = ts.parenthesizeElementTypeMember(objectType); - node.indexType = indexType; - return node; - } - ts.createIndexedAccessTypeNode = createIndexedAccessTypeNode; - function updateIndexedAccessTypeNode(node, objectType, indexType) { - return node.objectType !== objectType - || node.indexType !== indexType - ? updateNode(createIndexedAccessTypeNode(objectType, indexType), node) - : node; - } - ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode; - function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) { - var node = createSynthesizedNode(172); - node.readonlyToken = readonlyToken; - node.typeParameter = typeParameter; - node.questionToken = questionToken; - node.type = type; - return node; - } - ts.createMappedTypeNode = createMappedTypeNode; - function updateMappedTypeNode(node, readonlyToken, typeParameter, questionToken, type) { - return node.readonlyToken !== readonlyToken - || node.typeParameter !== typeParameter - || node.questionToken !== questionToken - || node.type !== type - ? updateNode(createMappedTypeNode(readonlyToken, typeParameter, questionToken, type), node) - : node; - } - ts.updateMappedTypeNode = updateMappedTypeNode; - function createLiteralTypeNode(literal) { - var node = createSynthesizedNode(173); - node.literal = literal; - return node; - } - ts.createLiteralTypeNode = createLiteralTypeNode; - function updateLiteralTypeNode(node, literal) { - return node.literal !== literal - ? updateNode(createLiteralTypeNode(literal), node) - : node; - } - ts.updateLiteralTypeNode = updateLiteralTypeNode; - function createObjectBindingPattern(elements) { - var node = createSynthesizedNode(174); - node.elements = createNodeArray(elements); - return node; - } - ts.createObjectBindingPattern = createObjectBindingPattern; - function updateObjectBindingPattern(node, elements) { - return node.elements !== elements - ? updateNode(createObjectBindingPattern(elements), node) - : node; - } - ts.updateObjectBindingPattern = updateObjectBindingPattern; - function createArrayBindingPattern(elements) { - var node = createSynthesizedNode(175); - node.elements = createNodeArray(elements); - return node; - } - ts.createArrayBindingPattern = createArrayBindingPattern; - function updateArrayBindingPattern(node, elements) { - return node.elements !== elements - ? updateNode(createArrayBindingPattern(elements), node) - : node; - } - ts.updateArrayBindingPattern = updateArrayBindingPattern; - function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createSynthesizedNode(176); - node.dotDotDotToken = dotDotDotToken; - node.propertyName = asName(propertyName); - node.name = asName(name); - node.initializer = initializer; - return node; - } - ts.createBindingElement = createBindingElement; - function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { - return node.propertyName !== propertyName - || node.dotDotDotToken !== dotDotDotToken - || node.name !== name - || node.initializer !== initializer - ? updateNode(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) - : node; - } - ts.updateBindingElement = updateBindingElement; - function createArrayLiteral(elements, multiLine) { - var node = createSynthesizedNode(177); - node.elements = ts.parenthesizeListElements(createNodeArray(elements)); - if (multiLine) - node.multiLine = true; - return node; - } - ts.createArrayLiteral = createArrayLiteral; - function updateArrayLiteral(node, elements) { - return node.elements !== elements - ? updateNode(createArrayLiteral(elements, node.multiLine), node) - : node; - } - ts.updateArrayLiteral = updateArrayLiteral; - function createObjectLiteral(properties, multiLine) { - var node = createSynthesizedNode(178); - node.properties = createNodeArray(properties); - if (multiLine) - node.multiLine = true; - return node; - } - ts.createObjectLiteral = createObjectLiteral; - function updateObjectLiteral(node, properties) { - return node.properties !== properties - ? updateNode(createObjectLiteral(properties, node.multiLine), node) - : node; - } - ts.updateObjectLiteral = updateObjectLiteral; - function createPropertyAccess(expression, name) { - var node = createSynthesizedNode(179); - node.expression = ts.parenthesizeForAccess(expression); - node.name = asName(name); - setEmitFlags(node, 131072); - return node; - } - ts.createPropertyAccess = createPropertyAccess; - function updatePropertyAccess(node, expression, name) { - return node.expression !== expression - || node.name !== name - ? updateNode(setEmitFlags(createPropertyAccess(expression, name), getEmitFlags(node)), node) - : node; - } - ts.updatePropertyAccess = updatePropertyAccess; - function createElementAccess(expression, index) { - var node = createSynthesizedNode(180); - node.expression = ts.parenthesizeForAccess(expression); - node.argumentExpression = asExpression(index); - return node; - } - ts.createElementAccess = createElementAccess; - function updateElementAccess(node, expression, argumentExpression) { - return node.expression !== expression - || node.argumentExpression !== argumentExpression - ? updateNode(createElementAccess(expression, argumentExpression), node) - : node; - } - ts.updateElementAccess = updateElementAccess; - function createCall(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(181); - node.expression = ts.parenthesizeForAccess(expression); - node.typeArguments = asNodeArray(typeArguments); - node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); - return node; - } - ts.createCall = createCall; - function updateCall(node, expression, typeArguments, argumentsArray) { - return node.expression !== expression - || node.typeArguments !== typeArguments - || node.arguments !== argumentsArray - ? updateNode(createCall(expression, typeArguments, argumentsArray), node) - : node; - } - ts.updateCall = updateCall; - function createNew(expression, typeArguments, argumentsArray) { - var node = createSynthesizedNode(182); - node.expression = ts.parenthesizeForNew(expression); - node.typeArguments = asNodeArray(typeArguments); - node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; - return node; - } - ts.createNew = createNew; - function updateNew(node, expression, typeArguments, argumentsArray) { - return node.expression !== expression - || node.typeArguments !== typeArguments - || node.arguments !== argumentsArray - ? updateNode(createNew(expression, typeArguments, argumentsArray), node) - : node; - } - ts.updateNew = updateNew; - function createTaggedTemplate(tag, template) { - var node = createSynthesizedNode(183); - node.tag = ts.parenthesizeForAccess(tag); - node.template = template; - return node; - } - ts.createTaggedTemplate = createTaggedTemplate; - function updateTaggedTemplate(node, tag, template) { - return node.tag !== tag - || node.template !== template - ? updateNode(createTaggedTemplate(tag, template), node) - : node; - } - ts.updateTaggedTemplate = updateTaggedTemplate; - function createTypeAssertion(type, expression) { - var node = createSynthesizedNode(184); - node.type = type; - node.expression = ts.parenthesizePrefixOperand(expression); - return node; - } - ts.createTypeAssertion = createTypeAssertion; - function updateTypeAssertion(node, type, expression) { - return node.type !== type - || node.expression !== expression - ? updateNode(createTypeAssertion(type, expression), node) - : node; - } - ts.updateTypeAssertion = updateTypeAssertion; - function createParen(expression) { - var node = createSynthesizedNode(185); - node.expression = expression; - return node; - } - ts.createParen = createParen; - function updateParen(node, expression) { - return node.expression !== expression - ? updateNode(createParen(expression), node) - : node; - } - ts.updateParen = updateParen; - function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(186); - node.modifiers = asNodeArray(modifiers); - node.asteriskToken = asteriskToken; - node.name = asName(name); - node.typeParameters = asNodeArray(typeParameters); - node.parameters = createNodeArray(parameters); - node.type = type; - node.body = body; - return node; - } - ts.createFunctionExpression = createFunctionExpression; - function updateFunctionExpression(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - return node.name !== name - || node.modifiers !== modifiers - || node.asteriskToken !== asteriskToken - || node.typeParameters !== typeParameters - || node.parameters !== parameters - || node.type !== type - || node.body !== body - ? updateNode(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) - : node; - } - ts.updateFunctionExpression = updateFunctionExpression; - function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createSynthesizedNode(187); - node.modifiers = asNodeArray(modifiers); - node.typeParameters = asNodeArray(typeParameters); - node.parameters = createNodeArray(parameters); - node.type = type; - node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(36); - node.body = ts.parenthesizeConciseBody(body); - return node; - } - ts.createArrowFunction = createArrowFunction; - function updateArrowFunction(node, modifiers, typeParameters, parameters, type, body) { - return node.modifiers !== modifiers - || node.typeParameters !== typeParameters - || node.parameters !== parameters - || node.type !== type - || node.body !== body - ? updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, node.equalsGreaterThanToken, body), node) - : node; - } - ts.updateArrowFunction = updateArrowFunction; - function createDelete(expression) { - var node = createSynthesizedNode(188); - node.expression = ts.parenthesizePrefixOperand(expression); - return node; - } - ts.createDelete = createDelete; - function updateDelete(node, expression) { - return node.expression !== expression - ? updateNode(createDelete(expression), node) - : node; - } - ts.updateDelete = updateDelete; - function createTypeOf(expression) { - var node = createSynthesizedNode(189); - node.expression = ts.parenthesizePrefixOperand(expression); - return node; - } - ts.createTypeOf = createTypeOf; - function updateTypeOf(node, expression) { - return node.expression !== expression - ? updateNode(createTypeOf(expression), node) - : node; - } - ts.updateTypeOf = updateTypeOf; - function createVoid(expression) { - var node = createSynthesizedNode(190); - node.expression = ts.parenthesizePrefixOperand(expression); - return node; - } - ts.createVoid = createVoid; - function updateVoid(node, expression) { - return node.expression !== expression - ? updateNode(createVoid(expression), node) - : node; - } - ts.updateVoid = updateVoid; - function createAwait(expression) { - var node = createSynthesizedNode(191); - node.expression = ts.parenthesizePrefixOperand(expression); - return node; - } - ts.createAwait = createAwait; - function updateAwait(node, expression) { - return node.expression !== expression - ? updateNode(createAwait(expression), node) - : node; - } - ts.updateAwait = updateAwait; - function createPrefix(operator, operand) { - var node = createSynthesizedNode(192); - node.operator = operator; - node.operand = ts.parenthesizePrefixOperand(operand); - return node; - } - ts.createPrefix = createPrefix; - function updatePrefix(node, operand) { - return node.operand !== operand - ? updateNode(createPrefix(node.operator, operand), node) - : node; - } - ts.updatePrefix = updatePrefix; - function createPostfix(operand, operator) { - var node = createSynthesizedNode(193); - node.operand = ts.parenthesizePostfixOperand(operand); - node.operator = operator; - return node; - } - ts.createPostfix = createPostfix; - function updatePostfix(node, operand) { - return node.operand !== operand - ? updateNode(createPostfix(operand, node.operator), node) - : node; - } - ts.updatePostfix = updatePostfix; - function createBinary(left, operator, right) { - var node = createSynthesizedNode(194); - var operatorToken = asToken(operator); - var operatorKind = operatorToken.kind; - node.left = ts.parenthesizeBinaryOperand(operatorKind, left, true, undefined); - node.operatorToken = operatorToken; - node.right = ts.parenthesizeBinaryOperand(operatorKind, right, false, node.left); - return node; - } - ts.createBinary = createBinary; - function updateBinary(node, left, right, operator) { - return node.left !== left - || node.right !== right - ? updateNode(createBinary(left, operator || node.operatorToken, right), node) - : node; - } - ts.updateBinary = updateBinary; - function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { - var node = createSynthesizedNode(195); - node.condition = ts.parenthesizeForConditionalHead(condition); - node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(55); - node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); - node.colonToken = whenFalse ? colonToken : createToken(56); - node.whenFalse = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenFalse : whenTrueOrWhenFalse); - return node; - } - ts.createConditional = createConditional; - function updateConditional(node, condition, whenTrue, whenFalse) { - return node.condition !== condition - || node.whenTrue !== whenTrue - || node.whenFalse !== whenFalse - ? updateNode(createConditional(condition, node.questionToken, whenTrue, node.colonToken, whenFalse), node) - : node; - } - ts.updateConditional = updateConditional; - function createTemplateExpression(head, templateSpans) { - var node = createSynthesizedNode(196); - node.head = head; - node.templateSpans = createNodeArray(templateSpans); - return node; - } - ts.createTemplateExpression = createTemplateExpression; - function updateTemplateExpression(node, head, templateSpans) { - return node.head !== head - || node.templateSpans !== templateSpans - ? updateNode(createTemplateExpression(head, templateSpans), node) - : node; - } - ts.updateTemplateExpression = updateTemplateExpression; - function createYield(asteriskTokenOrExpression, expression) { - var node = createSynthesizedNode(197); - node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 39 ? asteriskTokenOrExpression : undefined; - node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 39 ? asteriskTokenOrExpression : expression; - return node; - } - ts.createYield = createYield; - function updateYield(node, asteriskToken, expression) { - return node.expression !== expression - || node.asteriskToken !== asteriskToken - ? updateNode(createYield(asteriskToken, expression), node) - : node; - } - ts.updateYield = updateYield; - function createSpread(expression) { - var node = createSynthesizedNode(198); - node.expression = ts.parenthesizeExpressionForList(expression); - return node; - } - ts.createSpread = createSpread; - function updateSpread(node, expression) { - return node.expression !== expression - ? updateNode(createSpread(expression), node) - : node; - } - ts.updateSpread = updateSpread; - function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(199); - node.decorators = undefined; - node.modifiers = asNodeArray(modifiers); - node.name = asName(name); - node.typeParameters = asNodeArray(typeParameters); - node.heritageClauses = asNodeArray(heritageClauses); - node.members = createNodeArray(members); - return node; - } - ts.createClassExpression = createClassExpression; - function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) { - return node.modifiers !== modifiers - || node.name !== name - || node.typeParameters !== typeParameters - || node.heritageClauses !== heritageClauses - || node.members !== members - ? updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members), node) - : node; - } - ts.updateClassExpression = updateClassExpression; - function createOmittedExpression() { - return createSynthesizedNode(200); - } - ts.createOmittedExpression = createOmittedExpression; - function createExpressionWithTypeArguments(typeArguments, expression) { - var node = createSynthesizedNode(201); - node.expression = ts.parenthesizeForAccess(expression); - node.typeArguments = asNodeArray(typeArguments); - return node; - } - ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments; - function updateExpressionWithTypeArguments(node, typeArguments, expression) { - return node.typeArguments !== typeArguments - || node.expression !== expression - ? updateNode(createExpressionWithTypeArguments(typeArguments, expression), node) - : node; - } - ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; - function createAsExpression(expression, type) { - var node = createSynthesizedNode(202); - node.expression = expression; - node.type = type; - return node; - } - ts.createAsExpression = createAsExpression; - function updateAsExpression(node, expression, type) { - return node.expression !== expression - || node.type !== type - ? updateNode(createAsExpression(expression, type), node) - : node; - } - ts.updateAsExpression = updateAsExpression; - function createNonNullExpression(expression) { - var node = createSynthesizedNode(203); - node.expression = ts.parenthesizeForAccess(expression); - return node; - } - ts.createNonNullExpression = createNonNullExpression; - function updateNonNullExpression(node, expression) { - return node.expression !== expression - ? updateNode(createNonNullExpression(expression), node) - : node; - } - ts.updateNonNullExpression = updateNonNullExpression; - function createMetaProperty(keywordToken, name) { - var node = createSynthesizedNode(204); - node.keywordToken = keywordToken; - node.name = name; - return node; - } - ts.createMetaProperty = createMetaProperty; - function updateMetaProperty(node, name) { - return node.name !== name - ? updateNode(createMetaProperty(node.keywordToken, name), node) - : node; - } - ts.updateMetaProperty = updateMetaProperty; - function createTemplateSpan(expression, literal) { - var node = createSynthesizedNode(205); - node.expression = expression; - node.literal = literal; - return node; - } - ts.createTemplateSpan = createTemplateSpan; - function updateTemplateSpan(node, expression, literal) { - return node.expression !== expression - || node.literal !== literal - ? updateNode(createTemplateSpan(expression, literal), node) - : node; - } - ts.updateTemplateSpan = updateTemplateSpan; - function createSemicolonClassElement() { - return createSynthesizedNode(206); - } - ts.createSemicolonClassElement = createSemicolonClassElement; - function createBlock(statements, multiLine) { - var block = createSynthesizedNode(207); - block.statements = createNodeArray(statements); - if (multiLine) - block.multiLine = multiLine; - return block; - } - ts.createBlock = createBlock; - function updateBlock(node, statements) { - return node.statements !== statements - ? updateNode(createBlock(statements, node.multiLine), node) - : node; - } - ts.updateBlock = updateBlock; - function createVariableStatement(modifiers, declarationList) { - var node = createSynthesizedNode(208); - node.decorators = undefined; - node.modifiers = asNodeArray(modifiers); - node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; - return node; - } - ts.createVariableStatement = createVariableStatement; - function updateVariableStatement(node, modifiers, declarationList) { - return node.modifiers !== modifiers - || node.declarationList !== declarationList - ? updateNode(createVariableStatement(modifiers, declarationList), node) - : node; - } - ts.updateVariableStatement = updateVariableStatement; - function createEmptyStatement() { - return createSynthesizedNode(209); - } - ts.createEmptyStatement = createEmptyStatement; - function createStatement(expression) { - var node = createSynthesizedNode(210); - node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); - return node; - } - ts.createStatement = createStatement; - function updateStatement(node, expression) { - return node.expression !== expression - ? updateNode(createStatement(expression), node) - : node; - } - ts.updateStatement = updateStatement; - function createIf(expression, thenStatement, elseStatement) { - var node = createSynthesizedNode(211); - node.expression = expression; - node.thenStatement = thenStatement; - node.elseStatement = elseStatement; - return node; - } - ts.createIf = createIf; - function updateIf(node, expression, thenStatement, elseStatement) { - return node.expression !== expression - || node.thenStatement !== thenStatement - || node.elseStatement !== elseStatement - ? updateNode(createIf(expression, thenStatement, elseStatement), node) - : node; - } - ts.updateIf = updateIf; - function createDo(statement, expression) { - var node = createSynthesizedNode(212); - node.statement = statement; - node.expression = expression; - return node; - } - ts.createDo = createDo; - function updateDo(node, statement, expression) { - return node.statement !== statement - || node.expression !== expression - ? updateNode(createDo(statement, expression), node) - : node; - } - ts.updateDo = updateDo; - function createWhile(expression, statement) { - var node = createSynthesizedNode(213); - node.expression = expression; - node.statement = statement; - return node; - } - ts.createWhile = createWhile; - function updateWhile(node, expression, statement) { - return node.expression !== expression - || node.statement !== statement - ? updateNode(createWhile(expression, statement), node) - : node; - } - ts.updateWhile = updateWhile; - function createFor(initializer, condition, incrementor, statement) { - var node = createSynthesizedNode(214); - node.initializer = initializer; - node.condition = condition; - node.incrementor = incrementor; - node.statement = statement; - return node; - } - ts.createFor = createFor; - function updateFor(node, initializer, condition, incrementor, statement) { - return node.initializer !== initializer - || node.condition !== condition - || node.incrementor !== incrementor - || node.statement !== statement - ? updateNode(createFor(initializer, condition, incrementor, statement), node) - : node; - } - ts.updateFor = updateFor; - function createForIn(initializer, expression, statement) { - var node = createSynthesizedNode(215); - node.initializer = initializer; - node.expression = expression; - node.statement = statement; - return node; - } - ts.createForIn = createForIn; - function updateForIn(node, initializer, expression, statement) { - return node.initializer !== initializer - || node.expression !== expression - || node.statement !== statement - ? updateNode(createForIn(initializer, expression, statement), node) - : node; - } - ts.updateForIn = updateForIn; - function createForOf(awaitModifier, initializer, expression, statement) { - var node = createSynthesizedNode(216); - node.awaitModifier = awaitModifier; - node.initializer = initializer; - node.expression = expression; - node.statement = statement; - return node; - } - ts.createForOf = createForOf; - function updateForOf(node, awaitModifier, initializer, expression, statement) { - return node.awaitModifier !== awaitModifier - || node.initializer !== initializer - || node.expression !== expression - || node.statement !== statement - ? updateNode(createForOf(awaitModifier, initializer, expression, statement), node) - : node; - } - ts.updateForOf = updateForOf; - function createContinue(label) { - var node = createSynthesizedNode(217); - node.label = asName(label); - return node; - } - ts.createContinue = createContinue; - function updateContinue(node, label) { - return node.label !== label - ? updateNode(createContinue(label), node) - : node; - } - ts.updateContinue = updateContinue; - function createBreak(label) { - var node = createSynthesizedNode(218); - node.label = asName(label); - return node; - } - ts.createBreak = createBreak; - function updateBreak(node, label) { - return node.label !== label - ? updateNode(createBreak(label), node) - : node; - } - ts.updateBreak = updateBreak; - function createReturn(expression) { - var node = createSynthesizedNode(219); - node.expression = expression; - return node; - } - ts.createReturn = createReturn; - function updateReturn(node, expression) { - return node.expression !== expression - ? updateNode(createReturn(expression), node) - : node; - } - ts.updateReturn = updateReturn; - function createWith(expression, statement) { - var node = createSynthesizedNode(220); - node.expression = expression; - node.statement = statement; - return node; - } - ts.createWith = createWith; - function updateWith(node, expression, statement) { - return node.expression !== expression - || node.statement !== statement - ? updateNode(createWith(expression, statement), node) - : node; - } - ts.updateWith = updateWith; - function createSwitch(expression, caseBlock) { - var node = createSynthesizedNode(221); - node.expression = ts.parenthesizeExpressionForList(expression); - node.caseBlock = caseBlock; - return node; - } - ts.createSwitch = createSwitch; - function updateSwitch(node, expression, caseBlock) { - return node.expression !== expression - || node.caseBlock !== caseBlock - ? updateNode(createSwitch(expression, caseBlock), node) - : node; - } - ts.updateSwitch = updateSwitch; - function createLabel(label, statement) { - var node = createSynthesizedNode(222); - node.label = asName(label); - node.statement = statement; - return node; - } - ts.createLabel = createLabel; - function updateLabel(node, label, statement) { - return node.label !== label - || node.statement !== statement - ? updateNode(createLabel(label, statement), node) - : node; - } - ts.updateLabel = updateLabel; - function createThrow(expression) { - var node = createSynthesizedNode(223); - node.expression = expression; - return node; - } - ts.createThrow = createThrow; - function updateThrow(node, expression) { - return node.expression !== expression - ? updateNode(createThrow(expression), node) - : node; - } - ts.updateThrow = updateThrow; - function createTry(tryBlock, catchClause, finallyBlock) { - var node = createSynthesizedNode(224); - node.tryBlock = tryBlock; - node.catchClause = catchClause; - node.finallyBlock = finallyBlock; - return node; - } - ts.createTry = createTry; - function updateTry(node, tryBlock, catchClause, finallyBlock) { - return node.tryBlock !== tryBlock - || node.catchClause !== catchClause - || node.finallyBlock !== finallyBlock - ? updateNode(createTry(tryBlock, catchClause, finallyBlock), node) - : node; - } - ts.updateTry = updateTry; - function createDebuggerStatement() { - return createSynthesizedNode(225); - } - ts.createDebuggerStatement = createDebuggerStatement; - function createVariableDeclaration(name, type, initializer) { - var node = createSynthesizedNode(226); - node.name = asName(name); - node.type = type; - node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; - return node; - } - ts.createVariableDeclaration = createVariableDeclaration; - function updateVariableDeclaration(node, name, type, initializer) { - return node.name !== name - || node.type !== type - || node.initializer !== initializer - ? updateNode(createVariableDeclaration(name, type, initializer), node) - : node; - } - ts.updateVariableDeclaration = updateVariableDeclaration; - function createVariableDeclarationList(declarations, flags) { - var node = createSynthesizedNode(227); - node.flags |= flags & 3; - node.declarations = createNodeArray(declarations); - return node; - } - ts.createVariableDeclarationList = createVariableDeclarationList; - function updateVariableDeclarationList(node, declarations) { - return node.declarations !== declarations - ? updateNode(createVariableDeclarationList(declarations, node.flags), node) - : node; - } - ts.updateVariableDeclarationList = updateVariableDeclarationList; - function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createSynthesizedNode(228); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.asteriskToken = asteriskToken; - node.name = asName(name); - node.typeParameters = asNodeArray(typeParameters); - node.parameters = createNodeArray(parameters); - node.type = type; - node.body = body; - return node; - } - ts.createFunctionDeclaration = createFunctionDeclaration; - function updateFunctionDeclaration(node, decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.asteriskToken !== asteriskToken - || node.name !== name - || node.typeParameters !== typeParameters - || node.parameters !== parameters - || node.type !== type - || node.body !== body - ? updateNode(createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) - : node; - } - ts.updateFunctionDeclaration = updateFunctionDeclaration; - function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(229); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.name = asName(name); - node.typeParameters = asNodeArray(typeParameters); - node.heritageClauses = asNodeArray(heritageClauses); - node.members = createNodeArray(members); - return node; - } - ts.createClassDeclaration = createClassDeclaration; - function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.name !== name - || node.typeParameters !== typeParameters - || node.heritageClauses !== heritageClauses - || node.members !== members - ? updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node) - : node; - } - ts.updateClassDeclaration = updateClassDeclaration; - function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { - var node = createSynthesizedNode(230); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.name = asName(name); - node.typeParameters = asNodeArray(typeParameters); - node.heritageClauses = asNodeArray(heritageClauses); - node.members = createNodeArray(members); - return node; - } - ts.createInterfaceDeclaration = createInterfaceDeclaration; - function updateInterfaceDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.name !== name - || node.typeParameters !== typeParameters - || node.heritageClauses !== heritageClauses - || node.members !== members - ? updateNode(createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node) - : node; - } - ts.updateInterfaceDeclaration = updateInterfaceDeclaration; - function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) { - var node = createSynthesizedNode(231); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.name = asName(name); - node.typeParameters = asNodeArray(typeParameters); - node.type = type; - return node; - } - ts.createTypeAliasDeclaration = createTypeAliasDeclaration; - function updateTypeAliasDeclaration(node, decorators, modifiers, name, typeParameters, type) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.name !== name - || node.typeParameters !== typeParameters - || node.type !== type - ? updateNode(createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type), node) - : node; - } - ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration; - function createEnumDeclaration(decorators, modifiers, name, members) { - var node = createSynthesizedNode(232); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.name = asName(name); - node.members = createNodeArray(members); - return node; - } - ts.createEnumDeclaration = createEnumDeclaration; - function updateEnumDeclaration(node, decorators, modifiers, name, members) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.name !== name - || node.members !== members - ? updateNode(createEnumDeclaration(decorators, modifiers, name, members), node) - : node; - } - ts.updateEnumDeclaration = updateEnumDeclaration; - function createModuleDeclaration(decorators, modifiers, name, body, flags) { - var node = createSynthesizedNode(233); - node.flags |= flags & (16 | 4 | 512); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.name = name; - node.body = body; - return node; - } - ts.createModuleDeclaration = createModuleDeclaration; - function updateModuleDeclaration(node, decorators, modifiers, name, body) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.name !== name - || node.body !== body - ? updateNode(createModuleDeclaration(decorators, modifiers, name, body, node.flags), node) - : node; - } - ts.updateModuleDeclaration = updateModuleDeclaration; - function createModuleBlock(statements) { - var node = createSynthesizedNode(234); - node.statements = createNodeArray(statements); - return node; - } - ts.createModuleBlock = createModuleBlock; - function updateModuleBlock(node, statements) { - return node.statements !== statements - ? updateNode(createModuleBlock(statements), node) - : node; - } - ts.updateModuleBlock = updateModuleBlock; - function createCaseBlock(clauses) { - var node = createSynthesizedNode(235); - node.clauses = createNodeArray(clauses); - return node; - } - ts.createCaseBlock = createCaseBlock; - function updateCaseBlock(node, clauses) { - return node.clauses !== clauses - ? updateNode(createCaseBlock(clauses), node) - : node; - } - ts.updateCaseBlock = updateCaseBlock; - function createNamespaceExportDeclaration(name) { - var node = createSynthesizedNode(236); - node.name = asName(name); - return node; - } - ts.createNamespaceExportDeclaration = createNamespaceExportDeclaration; - function updateNamespaceExportDeclaration(node, name) { - return node.name !== name - ? updateNode(createNamespaceExportDeclaration(name), node) - : node; - } - ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration; - function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { - var node = createSynthesizedNode(237); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.name = asName(name); - node.moduleReference = moduleReference; - return node; - } - ts.createImportEqualsDeclaration = createImportEqualsDeclaration; - function updateImportEqualsDeclaration(node, decorators, modifiers, name, moduleReference) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.name !== name - || node.moduleReference !== moduleReference - ? updateNode(createImportEqualsDeclaration(decorators, modifiers, name, moduleReference), node) - : node; - } - ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; - function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { - var node = createSynthesizedNode(238); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.importClause = importClause; - node.moduleSpecifier = moduleSpecifier; - return node; - } - ts.createImportDeclaration = createImportDeclaration; - function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.importClause !== importClause - || node.moduleSpecifier !== moduleSpecifier - ? updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier), node) - : node; - } - ts.updateImportDeclaration = updateImportDeclaration; - function createImportClause(name, namedBindings) { - var node = createSynthesizedNode(239); - node.name = name; - node.namedBindings = namedBindings; - return node; - } - ts.createImportClause = createImportClause; - function updateImportClause(node, name, namedBindings) { - return node.name !== name - || node.namedBindings !== namedBindings - ? updateNode(createImportClause(name, namedBindings), node) - : node; - } - ts.updateImportClause = updateImportClause; - function createNamespaceImport(name) { - var node = createSynthesizedNode(240); - node.name = name; - return node; - } - ts.createNamespaceImport = createNamespaceImport; - function updateNamespaceImport(node, name) { - return node.name !== name - ? updateNode(createNamespaceImport(name), node) - : node; - } - ts.updateNamespaceImport = updateNamespaceImport; - function createNamedImports(elements) { - var node = createSynthesizedNode(241); - node.elements = createNodeArray(elements); - return node; - } - ts.createNamedImports = createNamedImports; - function updateNamedImports(node, elements) { - return node.elements !== elements - ? updateNode(createNamedImports(elements), node) - : node; - } - ts.updateNamedImports = updateNamedImports; - function createImportSpecifier(propertyName, name) { - var node = createSynthesizedNode(242); - node.propertyName = propertyName; - node.name = name; - return node; - } - ts.createImportSpecifier = createImportSpecifier; - function updateImportSpecifier(node, propertyName, name) { - return node.propertyName !== propertyName - || node.name !== name - ? updateNode(createImportSpecifier(propertyName, name), node) - : node; - } - ts.updateImportSpecifier = updateImportSpecifier; - function createExportAssignment(decorators, modifiers, isExportEquals, expression) { - var node = createSynthesizedNode(243); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.isExportEquals = isExportEquals; - node.expression = expression; - return node; - } - ts.createExportAssignment = createExportAssignment; - function updateExportAssignment(node, decorators, modifiers, expression) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.expression !== expression - ? updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression), node) - : node; - } - ts.updateExportAssignment = updateExportAssignment; - function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { - var node = createSynthesizedNode(244); - node.decorators = asNodeArray(decorators); - node.modifiers = asNodeArray(modifiers); - node.exportClause = exportClause; - node.moduleSpecifier = moduleSpecifier; - return node; - } - ts.createExportDeclaration = createExportDeclaration; - function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) { - return node.decorators !== decorators - || node.modifiers !== modifiers - || node.exportClause !== exportClause - || node.moduleSpecifier !== moduleSpecifier - ? updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier), node) - : node; - } - ts.updateExportDeclaration = updateExportDeclaration; - function createNamedExports(elements) { - var node = createSynthesizedNode(245); - node.elements = createNodeArray(elements); - return node; - } - ts.createNamedExports = createNamedExports; - function updateNamedExports(node, elements) { - return node.elements !== elements - ? updateNode(createNamedExports(elements), node) - : node; - } - ts.updateNamedExports = updateNamedExports; - function createExportSpecifier(propertyName, name) { - var node = createSynthesizedNode(246); - node.propertyName = asName(propertyName); - node.name = asName(name); - return node; - } - ts.createExportSpecifier = createExportSpecifier; - function updateExportSpecifier(node, propertyName, name) { - return node.propertyName !== propertyName - || node.name !== name - ? updateNode(createExportSpecifier(propertyName, name), node) - : node; - } - ts.updateExportSpecifier = updateExportSpecifier; - function createExternalModuleReference(expression) { - var node = createSynthesizedNode(248); - node.expression = expression; - return node; - } - ts.createExternalModuleReference = createExternalModuleReference; - function updateExternalModuleReference(node, expression) { - return node.expression !== expression - ? updateNode(createExternalModuleReference(expression), node) - : node; - } - ts.updateExternalModuleReference = updateExternalModuleReference; - function createJsxElement(openingElement, children, closingElement) { - var node = createSynthesizedNode(249); - node.openingElement = openingElement; - node.children = createNodeArray(children); - node.closingElement = closingElement; - return node; - } - ts.createJsxElement = createJsxElement; - function updateJsxElement(node, openingElement, children, closingElement) { - return node.openingElement !== openingElement - || node.children !== children - || node.closingElement !== closingElement - ? updateNode(createJsxElement(openingElement, children, closingElement), node) - : node; - } - ts.updateJsxElement = updateJsxElement; - function createJsxSelfClosingElement(tagName, attributes) { - var node = createSynthesizedNode(250); - node.tagName = tagName; - node.attributes = attributes; - return node; - } - ts.createJsxSelfClosingElement = createJsxSelfClosingElement; - function updateJsxSelfClosingElement(node, tagName, attributes) { - return node.tagName !== tagName - || node.attributes !== attributes - ? updateNode(createJsxSelfClosingElement(tagName, attributes), node) - : node; - } - ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; - function createJsxOpeningElement(tagName, attributes) { - var node = createSynthesizedNode(251); - node.tagName = tagName; - node.attributes = attributes; - return node; - } - ts.createJsxOpeningElement = createJsxOpeningElement; - function updateJsxOpeningElement(node, tagName, attributes) { - return node.tagName !== tagName - || node.attributes !== attributes - ? updateNode(createJsxOpeningElement(tagName, attributes), node) - : node; - } - ts.updateJsxOpeningElement = updateJsxOpeningElement; - function createJsxClosingElement(tagName) { - var node = createSynthesizedNode(252); - node.tagName = tagName; - return node; - } - ts.createJsxClosingElement = createJsxClosingElement; - function updateJsxClosingElement(node, tagName) { - return node.tagName !== tagName - ? updateNode(createJsxClosingElement(tagName), node) - : node; - } - ts.updateJsxClosingElement = updateJsxClosingElement; - function createJsxAttribute(name, initializer) { - var node = createSynthesizedNode(253); - node.name = name; - node.initializer = initializer; - return node; - } - ts.createJsxAttribute = createJsxAttribute; - function updateJsxAttribute(node, name, initializer) { - return node.name !== name - || node.initializer !== initializer - ? updateNode(createJsxAttribute(name, initializer), node) - : node; - } - ts.updateJsxAttribute = updateJsxAttribute; - function createJsxAttributes(properties) { - var node = createSynthesizedNode(254); - node.properties = createNodeArray(properties); - return node; - } - ts.createJsxAttributes = createJsxAttributes; - function updateJsxAttributes(node, properties) { - return node.properties !== properties - ? updateNode(createJsxAttributes(properties), node) - : node; - } - ts.updateJsxAttributes = updateJsxAttributes; - function createJsxSpreadAttribute(expression) { - var node = createSynthesizedNode(255); - node.expression = expression; - return node; - } - ts.createJsxSpreadAttribute = createJsxSpreadAttribute; - function updateJsxSpreadAttribute(node, expression) { - return node.expression !== expression - ? updateNode(createJsxSpreadAttribute(expression), node) - : node; - } - ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; - function createJsxExpression(dotDotDotToken, expression) { - var node = createSynthesizedNode(256); - node.dotDotDotToken = dotDotDotToken; - node.expression = expression; - return node; - } - ts.createJsxExpression = createJsxExpression; - function updateJsxExpression(node, expression) { - return node.expression !== expression - ? updateNode(createJsxExpression(node.dotDotDotToken, expression), node) - : node; - } - ts.updateJsxExpression = updateJsxExpression; - function createCaseClause(expression, statements) { - var node = createSynthesizedNode(257); - node.expression = ts.parenthesizeExpressionForList(expression); - node.statements = createNodeArray(statements); - return node; - } - ts.createCaseClause = createCaseClause; - function updateCaseClause(node, expression, statements) { - return node.expression !== expression - || node.statements !== statements - ? updateNode(createCaseClause(expression, statements), node) - : node; - } - ts.updateCaseClause = updateCaseClause; - function createDefaultClause(statements) { - var node = createSynthesizedNode(258); - node.statements = createNodeArray(statements); - return node; - } - ts.createDefaultClause = createDefaultClause; - function updateDefaultClause(node, statements) { - return node.statements !== statements - ? updateNode(createDefaultClause(statements), node) - : node; - } - ts.updateDefaultClause = updateDefaultClause; - function createHeritageClause(token, types) { - var node = createSynthesizedNode(259); - node.token = token; - node.types = createNodeArray(types); - return node; - } - ts.createHeritageClause = createHeritageClause; - function updateHeritageClause(node, types) { - return node.types !== types - ? updateNode(createHeritageClause(node.token, types), node) - : node; - } - ts.updateHeritageClause = updateHeritageClause; - function createCatchClause(variableDeclaration, block) { - var node = createSynthesizedNode(260); - node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; - node.block = block; - return node; - } - ts.createCatchClause = createCatchClause; - function updateCatchClause(node, variableDeclaration, block) { - return node.variableDeclaration !== variableDeclaration - || node.block !== block - ? updateNode(createCatchClause(variableDeclaration, block), node) - : node; - } - ts.updateCatchClause = updateCatchClause; - function createPropertyAssignment(name, initializer) { - var node = createSynthesizedNode(261); - node.name = asName(name); - node.questionToken = undefined; - node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; - return node; - } - ts.createPropertyAssignment = createPropertyAssignment; - function updatePropertyAssignment(node, name, initializer) { - return node.name !== name - || node.initializer !== initializer - ? updateNode(createPropertyAssignment(name, initializer), node) - : node; - } - ts.updatePropertyAssignment = updatePropertyAssignment; - function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createSynthesizedNode(262); - node.name = asName(name); - node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; - return node; - } - ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; - function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) { - return node.name !== name - || node.objectAssignmentInitializer !== objectAssignmentInitializer - ? updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node) - : node; - } - ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; - function createSpreadAssignment(expression) { - var node = createSynthesizedNode(263); - node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; - return node; - } - ts.createSpreadAssignment = createSpreadAssignment; - function updateSpreadAssignment(node, expression) { - return node.expression !== expression - ? updateNode(createSpreadAssignment(expression), node) - : node; - } - ts.updateSpreadAssignment = updateSpreadAssignment; - function createEnumMember(name, initializer) { - var node = createSynthesizedNode(264); - node.name = asName(name); - node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); - return node; - } - ts.createEnumMember = createEnumMember; - function updateEnumMember(node, name, initializer) { - return node.name !== name - || node.initializer !== initializer - ? updateNode(createEnumMember(name, initializer), node) - : node; - } - ts.updateEnumMember = updateEnumMember; - function updateSourceFileNode(node, statements) { - if (node.statements !== statements) { - var updated = createSynthesizedNode(265); - updated.flags |= node.flags; - updated.statements = createNodeArray(statements); - updated.endOfFileToken = node.endOfFileToken; - updated.fileName = node.fileName; - updated.path = node.path; - updated.text = node.text; - if (node.amdDependencies !== undefined) - updated.amdDependencies = node.amdDependencies; - if (node.moduleName !== undefined) - updated.moduleName = node.moduleName; - if (node.referencedFiles !== undefined) - updated.referencedFiles = node.referencedFiles; - if (node.typeReferenceDirectives !== undefined) - updated.typeReferenceDirectives = node.typeReferenceDirectives; - if (node.languageVariant !== undefined) - updated.languageVariant = node.languageVariant; - if (node.isDeclarationFile !== undefined) - updated.isDeclarationFile = node.isDeclarationFile; - if (node.renamedDependencies !== undefined) - updated.renamedDependencies = node.renamedDependencies; - if (node.hasNoDefaultLib !== undefined) - updated.hasNoDefaultLib = node.hasNoDefaultLib; - if (node.languageVersion !== undefined) - updated.languageVersion = node.languageVersion; - if (node.scriptKind !== undefined) - updated.scriptKind = node.scriptKind; - if (node.externalModuleIndicator !== undefined) - updated.externalModuleIndicator = node.externalModuleIndicator; - if (node.commonJsModuleIndicator !== undefined) - updated.commonJsModuleIndicator = node.commonJsModuleIndicator; - if (node.identifiers !== undefined) - updated.identifiers = node.identifiers; - if (node.nodeCount !== undefined) - updated.nodeCount = node.nodeCount; - if (node.identifierCount !== undefined) - updated.identifierCount = node.identifierCount; - if (node.symbolCount !== undefined) - updated.symbolCount = node.symbolCount; - if (node.parseDiagnostics !== undefined) - updated.parseDiagnostics = node.parseDiagnostics; - if (node.bindDiagnostics !== undefined) - updated.bindDiagnostics = node.bindDiagnostics; - if (node.lineMap !== undefined) - updated.lineMap = node.lineMap; - if (node.classifiableNames !== undefined) - updated.classifiableNames = node.classifiableNames; - if (node.resolvedModules !== undefined) - updated.resolvedModules = node.resolvedModules; - if (node.resolvedTypeReferenceDirectiveNames !== undefined) - updated.resolvedTypeReferenceDirectiveNames = node.resolvedTypeReferenceDirectiveNames; - if (node.imports !== undefined) - updated.imports = node.imports; - if (node.moduleAugmentations !== undefined) - updated.moduleAugmentations = node.moduleAugmentations; - return updateNode(updated, node); - } - return node; - } - ts.updateSourceFileNode = updateSourceFileNode; - function getMutableClone(node) { - var clone = getSynthesizedClone(node); - clone.pos = node.pos; - clone.end = node.end; - clone.parent = node.parent; - return clone; - } - ts.getMutableClone = getMutableClone; - function createNotEmittedStatement(original) { - var node = createSynthesizedNode(296); - node.original = original; - setTextRange(node, original); - return node; - } - ts.createNotEmittedStatement = createNotEmittedStatement; - function createEndOfDeclarationMarker(original) { - var node = createSynthesizedNode(300); - node.emitNode = {}; - node.original = original; - return node; - } - ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; - function createMergeDeclarationMarker(original) { - var node = createSynthesizedNode(299); - node.emitNode = {}; - node.original = original; - return node; - } - ts.createMergeDeclarationMarker = createMergeDeclarationMarker; - function createPartiallyEmittedExpression(expression, original) { - var node = createSynthesizedNode(297); - node.expression = expression; - node.original = original; - setTextRange(node, original); - return node; - } - ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression; - function updatePartiallyEmittedExpression(node, expression) { - if (node.expression !== expression) { - return updateNode(createPartiallyEmittedExpression(expression, node.original), node); - } - return node; - } - ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; - function flattenCommaElements(node) { - if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { - if (node.kind === 298) { - return node.elements; - } - if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26) { - return [node.left, node.right]; - } - } - return node; - } - function createCommaList(elements) { - var node = createSynthesizedNode(298); - node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); - return node; - } - ts.createCommaList = createCommaList; - function updateCommaList(node, elements) { - return node.elements !== elements - ? updateNode(createCommaList(elements), node) - : node; - } - ts.updateCommaList = updateCommaList; - function createBundle(sourceFiles) { - var node = ts.createNode(266); - node.sourceFiles = sourceFiles; - return node; - } - ts.createBundle = createBundle; - function updateBundle(node, sourceFiles) { - if (node.sourceFiles !== sourceFiles) { - return createBundle(sourceFiles); - } - return node; - } - ts.updateBundle = updateBundle; - function createImmediatelyInvokedFunctionExpression(statements, param, paramValue) { - return createCall(createFunctionExpression(undefined, undefined, undefined, undefined, param ? [param] : [], undefined, createBlock(statements, true)), undefined, paramValue ? [paramValue] : []); - } - ts.createImmediatelyInvokedFunctionExpression = createImmediatelyInvokedFunctionExpression; - function createComma(left, right) { - return createBinary(left, 26, right); - } - ts.createComma = createComma; - function createLessThan(left, right) { - return createBinary(left, 27, right); - } - ts.createLessThan = createLessThan; - function createAssignment(left, right) { - return createBinary(left, 58, right); - } - ts.createAssignment = createAssignment; - function createStrictEquality(left, right) { - return createBinary(left, 34, right); - } - ts.createStrictEquality = createStrictEquality; - function createStrictInequality(left, right) { - return createBinary(left, 35, right); - } - ts.createStrictInequality = createStrictInequality; - function createAdd(left, right) { - return createBinary(left, 37, right); - } - ts.createAdd = createAdd; - function createSubtract(left, right) { - return createBinary(left, 38, right); - } - ts.createSubtract = createSubtract; - function createPostfixIncrement(operand) { - return createPostfix(operand, 43); - } - ts.createPostfixIncrement = createPostfixIncrement; - function createLogicalAnd(left, right) { - return createBinary(left, 53, right); - } - ts.createLogicalAnd = createLogicalAnd; - function createLogicalOr(left, right) { - return createBinary(left, 54, right); - } - ts.createLogicalOr = createLogicalOr; - function createLogicalNot(operand) { - return createPrefix(51, operand); - } - ts.createLogicalNot = createLogicalNot; - function createVoidZero() { - return createVoid(createLiteral(0)); - } - ts.createVoidZero = createVoidZero; - function createExportDefault(expression) { - return createExportAssignment(undefined, undefined, false, expression); - } - ts.createExportDefault = createExportDefault; - function createExternalModuleExport(exportName) { - return createExportDeclaration(undefined, undefined, createNamedExports([createExportSpecifier(undefined, exportName)])); - } - ts.createExternalModuleExport = createExternalModuleExport; - function asName(name) { - return typeof name === "string" ? createIdentifier(name) : name; - } - function asExpression(value) { - return typeof value === "string" || typeof value === "number" ? createLiteral(value) : value; - } - function asNodeArray(array) { - return array ? createNodeArray(array) : undefined; - } - function asToken(value) { - return typeof value === "number" ? createToken(value) : value; + function tokenIsIdentifierOrKeyword(token) { + return token >= 71; } - function disposeEmitNodes(sourceFile) { - sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); - var emitNode = sourceFile && sourceFile.emitNode; - var annotatedNodes = emitNode && emitNode.annotatedNodes; - if (annotatedNodes) { - for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { - var node = annotatedNodes_1[_i]; - node.emitNode = undefined; - } + ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword; + var textToToken = ts.createMapFromTemplate({ + "abstract": 117, + "any": 119, + "as": 118, + "boolean": 122, + "break": 72, + "case": 73, + "catch": 74, + "class": 75, + "continue": 77, + "const": 76, + "constructor": 123, + "debugger": 78, + "declare": 124, + "default": 79, + "delete": 80, + "do": 81, + "else": 82, + "enum": 83, + "export": 84, + "extends": 85, + "false": 86, + "finally": 87, + "for": 88, + "from": 140, + "function": 89, + "get": 125, + "if": 90, + "implements": 108, + "import": 91, + "in": 92, + "instanceof": 93, + "interface": 109, + "is": 126, + "keyof": 127, + "let": 110, + "module": 128, + "namespace": 129, + "never": 130, + "new": 94, + "null": 95, + "number": 133, + "object": 134, + "package": 111, + "private": 112, + "protected": 113, + "public": 114, + "readonly": 131, + "require": 132, + "global": 141, + "return": 96, + "set": 135, + "static": 115, + "string": 136, + "super": 97, + "switch": 98, + "symbol": 137, + "this": 99, + "throw": 100, + "true": 101, + "try": 102, + "type": 138, + "typeof": 103, + "undefined": 139, + "var": 104, + "void": 105, + "while": 106, + "with": 107, + "yield": 116, + "async": 120, + "await": 121, + "of": 142, + "{": 17, + "}": 18, + "(": 19, + ")": 20, + "[": 21, + "]": 22, + ".": 23, + "...": 24, + ";": 25, + ",": 26, + "<": 27, + ">": 29, + "<=": 30, + ">=": 31, + "==": 32, + "!=": 33, + "===": 34, + "!==": 35, + "=>": 36, + "+": 37, + "-": 38, + "**": 40, + "*": 39, + "/": 41, + "%": 42, + "++": 43, + "--": 44, + "<<": 45, + "</": 28, + ">>": 46, + ">>>": 47, + "&": 48, + "|": 49, + "^": 50, + "!": 51, + "~": 52, + "&&": 53, + "||": 54, + "?": 55, + ":": 56, + "=": 58, + "+=": 59, + "-=": 60, + "*=": 61, + "**=": 62, + "/=": 63, + "%=": 64, + "<<=": 65, + ">>=": 66, + ">>>=": 67, + "&=": 68, + "|=": 69, + "^=": 70, + "@": 57, + }); + var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + var unicodeES5IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 768, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1155, 1159, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1469, 1471, 1471, 1473, 1474, 1476, 1477, 1479, 1479, 1488, 1514, 1520, 1522, 1552, 1562, 1568, 1641, 1646, 1747, 1749, 1756, 1759, 1768, 1770, 1788, 1791, 1791, 1808, 1866, 1869, 1969, 1984, 2037, 2042, 2042, 2048, 2093, 2112, 2139, 2208, 2208, 2210, 2220, 2276, 2302, 2304, 2403, 2406, 2415, 2417, 2423, 2425, 2431, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2500, 2503, 2504, 2507, 2510, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2561, 2563, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2641, 2641, 2649, 2652, 2654, 2654, 2662, 2677, 2689, 2691, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2787, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2876, 2884, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2915, 2918, 2927, 2929, 2929, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3024, 3024, 3031, 3031, 3046, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3160, 3161, 3168, 3171, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3260, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3299, 3302, 3311, 3313, 3314, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3396, 3398, 3400, 3402, 3406, 3415, 3415, 3424, 3427, 3430, 3439, 3450, 3455, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3807, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3948, 3953, 3972, 3974, 3991, 3993, 4028, 4038, 4038, 4096, 4169, 4176, 4253, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4957, 4959, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5908, 5920, 5940, 5952, 5971, 5984, 5996, 5998, 6000, 6002, 6003, 6016, 6099, 6103, 6103, 6108, 6109, 6112, 6121, 6155, 6157, 6160, 6169, 6176, 6263, 6272, 6314, 6320, 6389, 6400, 6428, 6432, 6443, 6448, 6459, 6470, 6509, 6512, 6516, 6528, 6571, 6576, 6601, 6608, 6617, 6656, 6683, 6688, 6750, 6752, 6780, 6783, 6793, 6800, 6809, 6823, 6823, 6912, 6987, 6992, 7001, 7019, 7027, 7040, 7155, 7168, 7223, 7232, 7241, 7245, 7293, 7376, 7378, 7380, 7414, 7424, 7654, 7676, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8204, 8205, 8255, 8256, 8276, 8276, 8305, 8305, 8319, 8319, 8336, 8348, 8400, 8412, 8417, 8417, 8421, 8432, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11647, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11744, 11775, 11823, 11823, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12348, 12353, 12438, 12441, 12442, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42539, 42560, 42607, 42612, 42621, 42623, 42647, 42655, 42737, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43047, 43072, 43123, 43136, 43204, 43216, 43225, 43232, 43255, 43259, 43259, 43264, 43309, 43312, 43347, 43360, 43388, 43392, 43456, 43471, 43481, 43520, 43574, 43584, 43597, 43600, 43609, 43616, 43638, 43642, 43643, 43648, 43714, 43739, 43741, 43744, 43759, 43762, 43766, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44010, 44012, 44013, 44016, 44025, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65024, 65039, 65056, 65062, 65075, 65076, 65101, 65103, 65136, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,]; + function lookupInUnicodeMap(code, map) { + if (code < map[0]) { + return false; } - } - ts.disposeEmitNodes = disposeEmitNodes; - function getOrCreateEmitNode(node) { - if (!node.emitNode) { - if (ts.isParseTreeNode(node)) { - if (node.kind === 265) { - return node.emitNode = { annotatedNodes: [node] }; - } - var sourceFile = ts.getSourceFileOfNode(node); - getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); + var lo = 0; + var hi = map.length; + var mid; + while (lo + 1 < hi) { + mid = lo + (hi - lo) / 2; + mid -= mid % 2; + if (map[mid] <= code && code <= map[mid + 1]) { + return true; } - node.emitNode = {}; - } - return node.emitNode; - } - ts.getOrCreateEmitNode = getOrCreateEmitNode; - function setTextRange(range, location) { - if (location) { - range.pos = location.pos; - range.end = location.end; - } - return range; - } - ts.setTextRange = setTextRange; - function getEmitFlags(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.flags; - } - ts.getEmitFlags = getEmitFlags; - function setEmitFlags(node, emitFlags) { - getOrCreateEmitNode(node).flags = emitFlags; - return node; - } - ts.setEmitFlags = setEmitFlags; - function getSourceMapRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.sourceMapRange) || node; - } - ts.getSourceMapRange = getSourceMapRange; - function setSourceMapRange(node, range) { - getOrCreateEmitNode(node).sourceMapRange = range; - return node; - } - ts.setSourceMapRange = setSourceMapRange; - var SourceMapSource; - function createSourceMapSource(fileName, text, skipTrivia) { - return new (SourceMapSource || (SourceMapSource = ts.objectAllocator.getSourceMapSourceConstructor()))(fileName, text, skipTrivia); - } - ts.createSourceMapSource = createSourceMapSource; - function getTokenSourceMapRange(node, token) { - var emitNode = node.emitNode; - var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; - return tokenSourceMapRanges && tokenSourceMapRanges[token]; - } - ts.getTokenSourceMapRange = getTokenSourceMapRange; - function setTokenSourceMapRange(node, token, range) { - var emitNode = getOrCreateEmitNode(node); - var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); - tokenSourceMapRanges[token] = range; - return node; - } - ts.setTokenSourceMapRange = setTokenSourceMapRange; - function getCommentRange(node) { - var emitNode = node.emitNode; - return (emitNode && emitNode.commentRange) || node; - } - ts.getCommentRange = getCommentRange; - function setCommentRange(node, range) { - getOrCreateEmitNode(node).commentRange = range; - return node; - } - ts.setCommentRange = setCommentRange; - function getSyntheticLeadingComments(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.leadingComments; - } - ts.getSyntheticLeadingComments = getSyntheticLeadingComments; - function setSyntheticLeadingComments(node, comments) { - getOrCreateEmitNode(node).leadingComments = comments; - return node; - } - ts.setSyntheticLeadingComments = setSyntheticLeadingComments; - function addSyntheticLeadingComment(node, kind, text, hasTrailingNewLine) { - return setSyntheticLeadingComments(node, ts.append(getSyntheticLeadingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); - } - ts.addSyntheticLeadingComment = addSyntheticLeadingComment; - function getSyntheticTrailingComments(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.trailingComments; - } - ts.getSyntheticTrailingComments = getSyntheticTrailingComments; - function setSyntheticTrailingComments(node, comments) { - getOrCreateEmitNode(node).trailingComments = comments; - return node; - } - ts.setSyntheticTrailingComments = setSyntheticTrailingComments; - function addSyntheticTrailingComment(node, kind, text, hasTrailingNewLine) { - return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); - } - ts.addSyntheticTrailingComment = addSyntheticTrailingComment; - function getConstantValue(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.constantValue; - } - ts.getConstantValue = getConstantValue; - function setConstantValue(node, value) { - var emitNode = getOrCreateEmitNode(node); - emitNode.constantValue = value; - return node; - } - ts.setConstantValue = setConstantValue; - function addEmitHelper(node, helper) { - var emitNode = getOrCreateEmitNode(node); - emitNode.helpers = ts.append(emitNode.helpers, helper); - return node; - } - ts.addEmitHelper = addEmitHelper; - function addEmitHelpers(node, helpers) { - if (ts.some(helpers)) { - var emitNode = getOrCreateEmitNode(node); - for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { - var helper = helpers_1[_i]; - if (!ts.contains(emitNode.helpers, helper)) { - emitNode.helpers = ts.append(emitNode.helpers, helper); - } + if (code < map[mid]) { + hi = mid; } - } - return node; - } - ts.addEmitHelpers = addEmitHelpers; - function removeEmitHelper(node, helper) { - var emitNode = node.emitNode; - if (emitNode) { - var helpers = emitNode.helpers; - if (helpers) { - return ts.orderedRemoveItem(helpers, helper); + else { + lo = mid + 2; } } return false; } - ts.removeEmitHelper = removeEmitHelper; - function getEmitHelpers(node) { - var emitNode = node.emitNode; - return emitNode && emitNode.helpers; - } - ts.getEmitHelpers = getEmitHelpers; - function moveEmitHelpers(source, target, predicate) { - var sourceEmitNode = source.emitNode; - var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; - if (!ts.some(sourceEmitHelpers)) - return; - var targetEmitNode = getOrCreateEmitNode(target); - var helpersRemoved = 0; - for (var i = 0; i < sourceEmitHelpers.length; i++) { - var helper = sourceEmitHelpers[i]; - if (predicate(helper)) { - helpersRemoved++; - if (!ts.contains(targetEmitNode.helpers, helper)) { - targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); - } - } - else if (helpersRemoved > 0) { - sourceEmitHelpers[i - helpersRemoved] = helper; - } - } - if (helpersRemoved > 0) { - sourceEmitHelpers.length -= helpersRemoved; - } - } - ts.moveEmitHelpers = moveEmitHelpers; - function compareEmitHelpers(x, y) { - if (x === y) - return 0; - if (x.priority === y.priority) - return 0; - if (x.priority === undefined) - return 1; - if (y.priority === undefined) - return -1; - return ts.compareValues(x.priority, y.priority); - } - ts.compareEmitHelpers = compareEmitHelpers; - function setOriginalNode(node, original) { - node.original = original; - if (original) { - var emitNode = original.emitNode; - if (emitNode) - node.emitNode = mergeEmitNode(emitNode, node.emitNode); - } - return node; - } - ts.setOriginalNode = setOriginalNode; - function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; - if (!destEmitNode) - destEmitNode = {}; - if (leadingComments) - destEmitNode.leadingComments = ts.addRange(leadingComments.slice(), destEmitNode.leadingComments); - if (trailingComments) - destEmitNode.trailingComments = ts.addRange(trailingComments.slice(), destEmitNode.trailingComments); - if (flags) - destEmitNode.flags = flags; - if (commentRange) - destEmitNode.commentRange = commentRange; - if (sourceMapRange) - destEmitNode.sourceMapRange = sourceMapRange; - if (tokenSourceMapRanges) - destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); - if (constantValue !== undefined) - destEmitNode.constantValue = constantValue; - if (helpers) - destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); - return destEmitNode; - } - function mergeTokenSourceMapRanges(sourceRanges, destRanges) { - if (!destRanges) - destRanges = []; - for (var key in sourceRanges) { - destRanges[key] = sourceRanges[key]; - } - return destRanges; + function isUnicodeIdentifierStart(code, languageVersion) { + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierStart) : + lookupInUnicodeMap(code, unicodeES3IdentifierStart); } -})(ts || (ts = {})); -(function (ts) { - ts.nullTransformationContext = { - enableEmitNotification: ts.noop, - enableSubstitution: ts.noop, - endLexicalEnvironment: function () { return undefined; }, - getCompilerOptions: ts.notImplemented, - getEmitHost: ts.notImplemented, - getEmitResolver: ts.notImplemented, - hoistFunctionDeclaration: ts.noop, - hoistVariableDeclaration: ts.noop, - isEmitNotificationEnabled: ts.notImplemented, - isSubstitutionEnabled: ts.notImplemented, - onEmitNode: ts.noop, - onSubstituteNode: ts.notImplemented, - readEmitHelpers: ts.notImplemented, - requestEmitHelper: ts.noop, - resumeLexicalEnvironment: ts.noop, - startLexicalEnvironment: ts.noop, - suspendLexicalEnvironment: ts.noop - }; - function createTypeCheck(value, tag) { - return tag === "undefined" - ? ts.createStrictEquality(value, ts.createVoidZero()) - : ts.createStrictEquality(ts.createTypeOf(value), ts.createLiteral(tag)); + ts.isUnicodeIdentifierStart = isUnicodeIdentifierStart; + function isUnicodeIdentifierPart(code, languageVersion) { + return languageVersion >= 1 ? + lookupInUnicodeMap(code, unicodeES5IdentifierPart) : + lookupInUnicodeMap(code, unicodeES3IdentifierPart); } - ts.createTypeCheck = createTypeCheck; - function createMemberAccessForPropertyName(target, memberName, location) { - if (ts.isComputedPropertyName(memberName)) { - return ts.setTextRange(ts.createElementAccess(target, memberName.expression), location); - } - else { - var expression = ts.setTextRange(ts.isIdentifier(memberName) - ? ts.createPropertyAccess(target, memberName) - : ts.createElementAccess(target, memberName), memberName); - ts.getOrCreateEmitNode(expression).flags |= 64; - return expression; - } + function makeReverseMap(source) { + var result = []; + source.forEach(function (value, name) { + result[value] = name; + }); + return result; } - ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName; - function createFunctionCall(func, thisArg, argumentsList, location) { - return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "call"), undefined, [ - thisArg - ].concat(argumentsList)), location); + var tokenStrings = makeReverseMap(textToToken); + function tokenToString(t) { + return tokenStrings[t]; } - ts.createFunctionCall = createFunctionCall; - function createFunctionApply(func, thisArg, argumentsExpression, location) { - return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "apply"), undefined, [ - thisArg, - argumentsExpression - ]), location); + ts.tokenToString = tokenToString; + function stringToToken(s) { + return textToToken.get(s); } - ts.createFunctionApply = createFunctionApply; - function createArraySlice(array, start) { - var argumentsList = []; - if (start !== undefined) { - argumentsList.push(typeof start === "number" ? ts.createLiteral(start) : start); + ts.stringToToken = stringToToken; + function computeLineStarts(text) { + var result = new Array(); + var pos = 0; + var lineStart = 0; + while (pos < text.length) { + var ch = text.charCodeAt(pos); + pos++; + switch (ch) { + case 13: + if (text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + result.push(lineStart); + lineStart = pos; + break; + default: + if (ch > 127 && isLineBreak(ch)) { + result.push(lineStart); + lineStart = pos; + } + break; + } } - return ts.createCall(ts.createPropertyAccess(array, "slice"), undefined, argumentsList); - } - ts.createArraySlice = createArraySlice; - function createArrayConcat(array, values) { - return ts.createCall(ts.createPropertyAccess(array, "concat"), undefined, values); - } - ts.createArrayConcat = createArrayConcat; - function createMathPow(left, right, location) { - return ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Math"), "pow"), undefined, [left, right]), location); + result.push(lineStart); + return result; } - ts.createMathPow = createMathPow; - function createReactNamespace(reactNamespace, parent) { - var react = ts.createIdentifier(reactNamespace || "React"); - react.flags &= ~8; - react.parent = ts.getParseTreeNode(parent); - return react; + ts.computeLineStarts = computeLineStarts; + function getPositionOfLineAndCharacter(sourceFile, line, character) { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character, sourceFile.text); } - function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { - if (ts.isQualifiedName(jsxFactory)) { - var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); - var right = ts.createIdentifier(jsxFactory.right.text); - right.text = jsxFactory.right.text; - return ts.createPropertyAccess(left, right); + ts.getPositionOfLineAndCharacter = getPositionOfLineAndCharacter; + function computePositionOfLineAndCharacter(lineStarts, line, character, debugText) { + ts.Debug.assert(line >= 0 && line < lineStarts.length); + var res = lineStarts[line] + character; + if (line < lineStarts.length - 1) { + ts.Debug.assert(res < lineStarts[line + 1]); } - else { - return createReactNamespace(jsxFactory.text, parent); + else if (debugText !== undefined) { + ts.Debug.assert(res < debugText.length); } + return res; } - function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) { - return jsxFactoryEntity ? - createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) : - ts.createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); + ts.computePositionOfLineAndCharacter = computePositionOfLineAndCharacter; + function getLineStarts(sourceFile) { + return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); } - function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) { - var argumentsList = [tagName]; - if (props) { - argumentsList.push(props); - } - if (children && children.length > 0) { - if (!props) { - argumentsList.push(ts.createNull()); - } - if (children.length > 1) { - for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { - var child = children_1[_i]; - child.startsOnNewLine = true; - argumentsList.push(child); - } - } - else { - argumentsList.push(children[0]); - } + ts.getLineStarts = getLineStarts; + function computeLineAndCharacterOfPosition(lineStarts, position) { + var lineNumber = ts.binarySearch(lineStarts, position); + if (lineNumber < 0) { + lineNumber = ~lineNumber - 1; + ts.Debug.assert(lineNumber !== -1, "position cannot precede the beginning of the file"); } - return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList), location); - } - ts.createExpressionForJsxElement = createExpressionForJsxElement; - function getHelperName(name) { - return ts.setEmitFlags(ts.createIdentifier(name), 4096 | 2); + return { + line: lineNumber, + character: position - lineStarts[lineNumber] + }; } - ts.getHelperName = getHelperName; - var valuesHelper = { - name: "typescript:values", - scoped: false, - text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };\n " - }; - function createValuesHelper(context, expression, location) { - context.requestEmitHelper(valuesHelper); - return ts.setTextRange(ts.createCall(getHelperName("__values"), undefined, [expression]), location); + ts.computeLineAndCharacterOfPosition = computeLineAndCharacterOfPosition; + function getLineAndCharacterOfPosition(sourceFile, position) { + return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } - ts.createValuesHelper = createValuesHelper; - var readHelper = { - name: "typescript:read", - scoped: false, - text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };\n " - }; - function createReadHelper(context, iteratorRecord, count, location) { - context.requestEmitHelper(readHelper); - return ts.setTextRange(ts.createCall(getHelperName("__read"), undefined, count !== undefined - ? [iteratorRecord, ts.createLiteral(count)] - : [iteratorRecord]), location); + ts.getLineAndCharacterOfPosition = getLineAndCharacterOfPosition; + function isWhiteSpaceLike(ch) { + return isWhiteSpaceSingleLine(ch) || isLineBreak(ch); } - ts.createReadHelper = createReadHelper; - var spreadHelper = { - name: "typescript:spread", - scoped: false, - text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };" - }; - function createSpreadHelper(context, argumentList, location) { - context.requestEmitHelper(readHelper); - context.requestEmitHelper(spreadHelper); - return ts.setTextRange(ts.createCall(getHelperName("__spread"), undefined, argumentList), location); + ts.isWhiteSpaceLike = isWhiteSpaceLike; + function isWhiteSpaceSingleLine(ch) { + return ch === 32 || + ch === 9 || + ch === 11 || + ch === 12 || + ch === 160 || + ch === 133 || + ch === 5760 || + ch >= 8192 && ch <= 8203 || + ch === 8239 || + ch === 8287 || + ch === 12288 || + ch === 65279; } - ts.createSpreadHelper = createSpreadHelper; - function createForOfBindingStatement(node, boundValue) { - if (ts.isVariableDeclarationList(node)) { - var firstDeclaration = ts.firstOrUndefined(node.declarations); - var updatedDeclaration = ts.updateVariableDeclaration(firstDeclaration, firstDeclaration.name, undefined, boundValue); - return ts.setTextRange(ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(node, [updatedDeclaration])), node); - } - else { - var updatedExpression = ts.setTextRange(ts.createAssignment(node, boundValue), node); - return ts.setTextRange(ts.createStatement(updatedExpression), node); - } + ts.isWhiteSpaceSingleLine = isWhiteSpaceSingleLine; + function isLineBreak(ch) { + return ch === 10 || + ch === 13 || + ch === 8232 || + ch === 8233; } - ts.createForOfBindingStatement = createForOfBindingStatement; - function insertLeadingStatement(dest, source) { - if (ts.isBlock(dest)) { - return ts.updateBlock(dest, ts.setTextRange(ts.createNodeArray([source].concat(dest.statements)), dest.statements)); - } - else { - return ts.createBlock(ts.createNodeArray([dest, source]), true); - } + ts.isLineBreak = isLineBreak; + function isDigit(ch) { + return ch >= 48 && ch <= 57; } - ts.insertLeadingStatement = insertLeadingStatement; - function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { - if (!outermostLabeledStatement) { - return node; - } - var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 222 - ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) - : node); - if (afterRestoreLabelCallback) { - afterRestoreLabelCallback(outermostLabeledStatement); - } - return updated; + function isOctalDigit(ch) { + return ch >= 48 && ch <= 55; } - ts.restoreEnclosingLabel = restoreEnclosingLabel; - function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { - var target = skipParentheses(node); - switch (target.kind) { - case 71: - return cacheIdentifiers; - case 99: - case 8: + ts.isOctalDigit = isOctalDigit; + function couldStartTrivia(text, pos) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + case 10: case 9: - return false; - case 177: - var elements = target.elements; - if (elements.length === 0) { - return false; - } + case 11: + case 12: + case 32: + case 47: + case 60: + case 124: + case 61: + case 62: return true; - case 178: - return target.properties.length > 0; + case 35: + return pos === 0; default: - return true; + return ch > 127; } } - function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) { - var callee = skipOuterExpressions(expression, 7); - var thisArg; - var target; - if (ts.isSuperProperty(callee)) { - thisArg = ts.createThis(); - target = callee; - } - else if (callee.kind === 97) { - thisArg = ts.createThis(); - target = languageVersion < 2 - ? ts.setTextRange(ts.createIdentifier("_super"), callee) - : callee; - } - else if (ts.getEmitFlags(callee) & 4096) { - thisArg = ts.createVoidZero(); - target = parenthesizeForAccess(callee); + ts.couldStartTrivia = couldStartTrivia; + function skipTrivia(text, pos, stopAfterLineBreak, stopAtComments) { + if (stopAtComments === void 0) { stopAtComments = false; } + if (ts.positionIsSynthesized(pos)) { + return pos; } - else { - switch (callee.kind) { - case 179: { - if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { - thisArg = ts.createTempVariable(recordTempVariable); - target = ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.name); - ts.setTextRange(target, callee); + while (true) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) { + pos++; } - else { - thisArg = callee.expression; - target = callee; + case 10: + pos++; + if (stopAfterLineBreak) { + return pos; + } + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + if (stopAtComments) { + break; + } + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + break; + } + pos++; + } + continue; + } + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + continue; } break; - } - case 180: { - if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { - thisArg = ts.createTempVariable(recordTempVariable); - target = ts.createElementAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression); - ts.setTextRange(target, callee); + case 60: + case 124: + case 61: + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos); + continue; } - else { - thisArg = callee.expression; - target = callee; + break; + case 35: + if (pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + continue; } break; - } - default: { - thisArg = ts.createVoidZero(); - target = parenthesizeForAccess(expression); + default: + if (ch > 127 && (isWhiteSpaceLike(ch))) { + pos++; + continue; + } break; - } } + return pos; } - return { target: target, thisArg: thisArg }; - } - ts.createCallBinding = createCallBinding; - function inlineExpressions(expressions) { - return expressions.length > 10 - ? ts.createCommaList(expressions) - : ts.reduceLeft(expressions, ts.createComma); } - ts.inlineExpressions = inlineExpressions; - function createExpressionFromEntityName(node) { - if (ts.isQualifiedName(node)) { - var left = createExpressionFromEntityName(node.left); - var right = ts.getMutableClone(node.right); - return ts.setTextRange(ts.createPropertyAccess(left, right), node); - } - else { - return ts.getMutableClone(node); + ts.skipTrivia = skipTrivia; + var mergeConflictMarkerLength = "<<<<<<<".length; + function isConflictMarkerTrivia(text, pos) { + ts.Debug.assert(pos >= 0); + if (pos === 0 || isLineBreak(text.charCodeAt(pos - 1))) { + var ch = text.charCodeAt(pos); + if ((pos + mergeConflictMarkerLength) < text.length) { + for (var i = 0; i < mergeConflictMarkerLength; i++) { + if (text.charCodeAt(pos + i) !== ch) { + return false; + } + } + return ch === 61 || + text.charCodeAt(pos + mergeConflictMarkerLength) === 32; + } } + return false; } - ts.createExpressionFromEntityName = createExpressionFromEntityName; - function createExpressionForPropertyName(memberName) { - if (ts.isIdentifier(memberName)) { - return ts.createLiteral(memberName); + function scanConflictMarkerTrivia(text, pos, error) { + if (error) { + error(ts.Diagnostics.Merge_conflict_marker_encountered, mergeConflictMarkerLength); } - else if (ts.isComputedPropertyName(memberName)) { - return ts.getMutableClone(memberName.expression); + var ch = text.charCodeAt(pos); + var len = text.length; + if (ch === 60 || ch === 62) { + while (pos < len && !isLineBreak(text.charCodeAt(pos))) { + pos++; + } } else { - return ts.getMutableClone(memberName); - } - } - ts.createExpressionForPropertyName = createExpressionForPropertyName; - function createExpressionForObjectLiteralElementLike(node, property, receiver) { - switch (property.kind) { - case 153: - case 154: - return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); - case 261: - return createExpressionForPropertyAssignment(property, receiver); - case 262: - return createExpressionForShorthandPropertyAssignment(property, receiver); - case 151: - return createExpressionForMethodDeclaration(property, receiver); - } - } - ts.createExpressionForObjectLiteralElementLike = createExpressionForObjectLiteralElementLike; - function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) { - var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; - if (property === firstAccessor) { - var properties_1 = []; - if (getAccessor) { - var getterFunction = ts.createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body); - ts.setTextRange(getterFunction, getAccessor); - ts.setOriginalNode(getterFunction, getAccessor); - var getter = ts.createPropertyAssignment("get", getterFunction); - properties_1.push(getter); - } - if (setAccessor) { - var setterFunction = ts.createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body); - ts.setTextRange(setterFunction, setAccessor); - ts.setOriginalNode(setterFunction, setAccessor); - var setter = ts.createPropertyAssignment("set", setterFunction); - properties_1.push(setter); + ts.Debug.assert(ch === 124 || ch === 61); + while (pos < len) { + var currentChar = text.charCodeAt(pos); + if ((currentChar === 61 || currentChar === 62) && currentChar !== ch && isConflictMarkerTrivia(text, pos)) { + break; + } + pos++; } - properties_1.push(ts.createPropertyAssignment("enumerable", ts.createTrue())); - properties_1.push(ts.createPropertyAssignment("configurable", ts.createTrue())); - var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ - receiver, - createExpressionForPropertyName(property.name), - ts.createObjectLiteral(properties_1, multiLine) - ]), firstAccessor); - return ts.aggregateTransformFlags(expression); } - return undefined; - } - function createExpressionForPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer), property), property)); - } - function createExpressionForShorthandPropertyAssignment(property, receiver) { - return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), ts.getSynthesizedClone(property.name)), property), property)); - } - function createExpressionForMethodDeclaration(method, receiver) { - return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body), method), method)), method), method)); - } - function getInternalName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 16384 | 32768); + return pos; } - ts.getInternalName = getInternalName; - function isInternalName(node) { - return (ts.getEmitFlags(node) & 32768) !== 0; + var shebangTriviaRegex = /^#!.*/; + function isShebangTrivia(text, pos) { + ts.Debug.assert(pos === 0); + return shebangTriviaRegex.test(text); } - ts.isInternalName = isInternalName; - function getLocalName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 16384); + function scanShebangTrivia(text, pos) { + var shebang = shebangTriviaRegex.exec(text)[0]; + pos = pos + shebang.length; + return pos; } - ts.getLocalName = getLocalName; - function isLocalName(node) { - return (ts.getEmitFlags(node) & 16384) !== 0; + function iterateCommentRanges(reduce, text, pos, trailing, cb, state, initial) { + var pendingPos; + var pendingEnd; + var pendingKind; + var pendingHasTrailingNewLine; + var hasPendingCommentRange = false; + var collecting = trailing || pos === 0; + var accumulator = initial; + scan: while (pos >= 0 && pos < text.length) { + var ch = text.charCodeAt(pos); + switch (ch) { + case 13: + if (text.charCodeAt(pos + 1) === 10) { + pos++; + } + case 10: + pos++; + if (trailing) { + break scan; + } + collecting = true; + if (hasPendingCommentRange) { + pendingHasTrailingNewLine = true; + } + continue; + case 9: + case 11: + case 12: + case 32: + pos++; + continue; + case 47: + var nextChar = text.charCodeAt(pos + 1); + var hasTrailingNewLine = false; + if (nextChar === 47 || nextChar === 42) { + var kind = nextChar === 47 ? 2 : 3; + var startPos = pos; + pos += 2; + if (nextChar === 47) { + while (pos < text.length) { + if (isLineBreak(text.charCodeAt(pos))) { + hasTrailingNewLine = true; + break; + } + pos++; + } + } + else { + while (pos < text.length) { + if (text.charCodeAt(pos) === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + break; + } + pos++; + } + } + if (collecting) { + if (hasPendingCommentRange) { + accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); + if (!reduce && accumulator) { + return accumulator; + } + hasPendingCommentRange = false; + } + pendingPos = startPos; + pendingEnd = pos; + pendingKind = kind; + pendingHasTrailingNewLine = hasTrailingNewLine; + hasPendingCommentRange = true; + } + continue; + } + break scan; + default: + if (ch > 127 && (isWhiteSpaceLike(ch))) { + if (hasPendingCommentRange && isLineBreak(ch)) { + pendingHasTrailingNewLine = true; + } + pos++; + continue; + } + break scan; + } + } + if (hasPendingCommentRange) { + accumulator = cb(pendingPos, pendingEnd, pendingKind, pendingHasTrailingNewLine, state, accumulator); + } + return accumulator; } - ts.isLocalName = isLocalName; - function getExportName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps, 8192); + function forEachLeadingCommentRange(text, pos, cb, state) { + return iterateCommentRanges(false, text, pos, false, cb, state); } - ts.getExportName = getExportName; - function isExportName(node) { - return (ts.getEmitFlags(node) & 8192) !== 0; + ts.forEachLeadingCommentRange = forEachLeadingCommentRange; + function forEachTrailingCommentRange(text, pos, cb, state) { + return iterateCommentRanges(false, text, pos, true, cb, state); } - ts.isExportName = isExportName; - function getDeclarationName(node, allowComments, allowSourceMaps) { - return getName(node, allowComments, allowSourceMaps); + ts.forEachTrailingCommentRange = forEachTrailingCommentRange; + function reduceEachLeadingCommentRange(text, pos, cb, state, initial) { + return iterateCommentRanges(true, text, pos, false, cb, state, initial); } - ts.getDeclarationName = getDeclarationName; - function getName(node, allowComments, allowSourceMaps, emitFlags) { - var nodeName = ts.getNameOfDeclaration(node); - if (nodeName && ts.isIdentifier(nodeName) && !ts.isGeneratedIdentifier(nodeName)) { - var name = ts.getMutableClone(nodeName); - emitFlags |= ts.getEmitFlags(nodeName); - if (!allowSourceMaps) - emitFlags |= 48; - if (!allowComments) - emitFlags |= 1536; - if (emitFlags) - ts.setEmitFlags(name, emitFlags); - return name; - } - return ts.getGeneratedNameForNode(node); + ts.reduceEachLeadingCommentRange = reduceEachLeadingCommentRange; + function reduceEachTrailingCommentRange(text, pos, cb, state, initial) { + return iterateCommentRanges(true, text, pos, true, cb, state, initial); } - function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) { - if (ns && ts.hasModifier(node, 1)) { - return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps); + ts.reduceEachTrailingCommentRange = reduceEachTrailingCommentRange; + function appendCommentRange(pos, end, kind, hasTrailingNewLine, _state, comments) { + if (!comments) { + comments = []; } - return getExportName(node, allowComments, allowSourceMaps); + comments.push({ kind: kind, pos: pos, end: end, hasTrailingNewLine: hasTrailingNewLine }); + return comments; } - ts.getExternalModuleOrNamespaceExportName = getExternalModuleOrNamespaceExportName; - function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) { - var qualifiedName = ts.createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : ts.getSynthesizedClone(name)); - ts.setTextRange(qualifiedName, name); - var emitFlags; - if (!allowSourceMaps) - emitFlags |= 48; - if (!allowComments) - emitFlags |= 1536; - if (emitFlags) - ts.setEmitFlags(qualifiedName, emitFlags); - return qualifiedName; + function getLeadingCommentRanges(text, pos) { + return reduceEachLeadingCommentRange(text, pos, appendCommentRange, undefined, undefined); } - ts.getNamespaceMemberName = getNamespaceMemberName; - function convertToFunctionBody(node, multiLine) { - return ts.isBlock(node) ? node : ts.setTextRange(ts.createBlock([ts.setTextRange(ts.createReturn(node), node)], multiLine), node); + ts.getLeadingCommentRanges = getLeadingCommentRanges; + function getTrailingCommentRanges(text, pos) { + return reduceEachTrailingCommentRange(text, pos, appendCommentRange, undefined, undefined); } - ts.convertToFunctionBody = convertToFunctionBody; - function convertFunctionDeclarationToExpression(node) { - ts.Debug.assert(!!node.body); - var updated = ts.createFunctionExpression(node.modifiers, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body); - ts.setOriginalNode(updated, node); - ts.setTextRange(updated, node); - if (node.startsOnNewLine) { - updated.startsOnNewLine = true; + ts.getTrailingCommentRanges = getTrailingCommentRanges; + function getShebang(text) { + var match = shebangTriviaRegex.exec(text); + if (match) { + return match[0]; } - ts.aggregateTransformFlags(updated); - return updated; } - ts.convertFunctionDeclarationToExpression = convertFunctionDeclarationToExpression; - function isUseStrictPrologue(node) { - return node.expression.text === "use strict"; + ts.getShebang = getShebang; + function isIdentifierStart(ch, languageVersion) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierStart(ch, languageVersion); } - function addPrologue(target, source, ensureUseStrict, visitor) { - var offset = addStandardPrologue(target, source, ensureUseStrict); - return addCustomPrologue(target, source, offset, visitor); + ts.isIdentifierStart = isIdentifierStart; + function isIdentifierPart(ch, languageVersion) { + return ch >= 65 && ch <= 90 || ch >= 97 && ch <= 122 || + ch >= 48 && ch <= 57 || ch === 36 || ch === 95 || + ch > 127 && isUnicodeIdentifierPart(ch, languageVersion); } - ts.addPrologue = addPrologue; - function addStandardPrologue(target, source, ensureUseStrict) { - ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array"); - var foundUseStrict = false; - var statementOffset = 0; - var numStatements = source.length; - while (statementOffset < numStatements) { - var statement = source[statementOffset]; - if (ts.isPrologueDirective(statement)) { - if (isUseStrictPrologue(statement)) { - foundUseStrict = true; - } - target.push(statement); - } - else { - break; - } - statementOffset++; + ts.isIdentifierPart = isIdentifierPart; + function isIdentifierText(name, languageVersion) { + if (!isIdentifierStart(name.charCodeAt(0), languageVersion)) { + return false; } - if (ensureUseStrict && !foundUseStrict) { - target.push(startOnNewLine(ts.createStatement(ts.createLiteral("use strict")))); + for (var i = 1; i < name.length; i++) { + if (!isIdentifierPart(name.charCodeAt(i), languageVersion)) { + return false; + } } - return statementOffset; + return true; } - ts.addStandardPrologue = addStandardPrologue; - function addCustomPrologue(target, source, statementOffset, visitor) { - var numStatements = source.length; - while (statementOffset < numStatements) { - var statement = source[statementOffset]; - if (ts.getEmitFlags(statement) & 1048576) { - target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); - } - else { - break; + ts.isIdentifierText = isIdentifierText; + function createScanner(languageVersion, skipTrivia, languageVariant, text, onError, start, length) { + if (languageVariant === void 0) { languageVariant = 0; } + var pos; + var end; + var startPos; + var tokenPos; + var token; + var tokenValue; + var precedingLineBreak; + var hasExtendedUnicodeEscape; + var tokenIsUnterminated; + var numericLiteralFlags; + setText(text, start, length); + return { + getStartPos: function () { return startPos; }, + getTextPos: function () { return pos; }, + getToken: function () { return token; }, + getTokenPos: function () { return tokenPos; }, + getTokenText: function () { return text.substring(tokenPos, pos); }, + getTokenValue: function () { return tokenValue; }, + hasExtendedUnicodeEscape: function () { return hasExtendedUnicodeEscape; }, + hasPrecedingLineBreak: function () { return precedingLineBreak; }, + isIdentifier: function () { return token === 71 || token > 107; }, + isReservedWord: function () { return token >= 72 && token <= 107; }, + isUnterminated: function () { return tokenIsUnterminated; }, + getNumericLiteralFlags: function () { return numericLiteralFlags; }, + reScanGreaterToken: reScanGreaterToken, + reScanSlashToken: reScanSlashToken, + reScanTemplateToken: reScanTemplateToken, + scanJsxIdentifier: scanJsxIdentifier, + scanJsxAttributeValue: scanJsxAttributeValue, + reScanJsxToken: reScanJsxToken, + scanJsxToken: scanJsxToken, + scanJSDocToken: scanJSDocToken, + scan: scan, + getText: getText, + setText: setText, + setScriptTarget: setScriptTarget, + setLanguageVariant: setLanguageVariant, + setOnError: setOnError, + setTextPos: setTextPos, + tryScan: tryScan, + lookAhead: lookAhead, + scanRange: scanRange, + }; + function error(message, length) { + if (onError) { + onError(message, length || 0); } - statementOffset++; } - return statementOffset; - } - ts.addCustomPrologue = addCustomPrologue; - function startsWithUseStrict(statements) { - var firstStatement = ts.firstOrUndefined(statements); - return firstStatement !== undefined - && ts.isPrologueDirective(firstStatement) - && isUseStrictPrologue(firstStatement); - } - ts.startsWithUseStrict = startsWithUseStrict; - function ensureUseStrict(statements) { - var foundUseStrict = false; - for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { - var statement = statements_1[_i]; - if (ts.isPrologueDirective(statement)) { - if (isUseStrictPrologue(statement)) { - foundUseStrict = true; - break; + function scanNumber() { + var start = pos; + while (isDigit(text.charCodeAt(pos))) + pos++; + if (text.charCodeAt(pos) === 46) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + } + var end = pos; + if (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101) { + pos++; + numericLiteralFlags = 2; + if (text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) + pos++; + if (isDigit(text.charCodeAt(pos))) { + pos++; + while (isDigit(text.charCodeAt(pos))) + pos++; + end = pos; + } + else { + error(ts.Diagnostics.Digit_expected); } } - else { - break; + return "" + +(text.substring(start, end)); + } + function scanOctalDigits() { + var start = pos; + while (isOctalDigit(text.charCodeAt(pos))) { + pos++; } + return +(text.substring(start, pos)); } - if (!foundUseStrict) { - return ts.setTextRange(ts.createNodeArray([ - startOnNewLine(ts.createStatement(ts.createLiteral("use strict"))) - ].concat(statements)), statements); + function scanExactNumberOfHexDigits(count) { + return scanHexDigits(count, false); } - return statements; - } - ts.ensureUseStrict = ensureUseStrict; - function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var skipped = skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 185) { - return operand; + function scanMinimumNumberOfHexDigits(count) { + return scanHexDigits(count, true); } - return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) - ? ts.createParen(operand) - : operand; - } - ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; - function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var binaryOperatorPrecedence = ts.getOperatorPrecedence(194, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(194, binaryOperator); - var emittedOperand = skipPartiallyEmittedExpressions(operand); - var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); - switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { - case -1: - if (!isLeftSideOfBinary - && binaryOperatorAssociativity === 1 - && operand.kind === 197) { - return false; + function scanHexDigits(minCount, scanAsManyAsPossible) { + var digits = 0; + var value = 0; + while (digits < minCount || scanAsManyAsPossible) { + var ch = text.charCodeAt(pos); + if (ch >= 48 && ch <= 57) { + value = value * 16 + ch - 48; } - return true; - case 1: - return false; - case 0: - if (isLeftSideOfBinary) { - return binaryOperatorAssociativity === 1; + else if (ch >= 65 && ch <= 70) { + value = value * 16 + ch - 65 + 10; + } + else if (ch >= 97 && ch <= 102) { + value = value * 16 + ch - 97 + 10; } else { - if (ts.isBinaryExpression(emittedOperand) - && emittedOperand.operatorToken.kind === binaryOperator) { - if (operatorHasAssociativeProperty(binaryOperator)) { - return false; - } - if (binaryOperator === 37) { - var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0; - if (ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) { - return false; - } - } - } - var operandAssociativity = ts.getExpressionAssociativity(emittedOperand); - return operandAssociativity === 0; + break; } - } - } - function operatorHasAssociativeProperty(binaryOperator) { - return binaryOperator === 39 - || binaryOperator === 49 - || binaryOperator === 48 - || binaryOperator === 50; - } - function getLiteralKindOfBinaryPlusOperand(node) { - node = skipPartiallyEmittedExpressions(node); - if (ts.isLiteralKind(node.kind)) { - return node.kind; - } - if (node.kind === 194 && node.operatorToken.kind === 37) { - if (node.cachedLiteralKind !== undefined) { - return node.cachedLiteralKind; + pos++; + digits++; } - var leftKind = getLiteralKindOfBinaryPlusOperand(node.left); - var literalKind = ts.isLiteralKind(leftKind) - && leftKind === getLiteralKindOfBinaryPlusOperand(node.right) - ? leftKind - : 0; - node.cachedLiteralKind = literalKind; - return literalKind; - } - return 0; - } - function parenthesizeForConditionalHead(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(195, 55); - var emittedCondition = skipPartiallyEmittedExpressions(condition); - var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); - if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { - return ts.createParen(condition); - } - return condition; - } - ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; - function parenthesizeSubexpressionOfConditionalExpression(e) { - return e.kind === 194 && e.operatorToken.kind === 26 - ? ts.createParen(e) - : e; - } - ts.parenthesizeSubexpressionOfConditionalExpression = parenthesizeSubexpressionOfConditionalExpression; - function parenthesizeForNew(expression) { - var emittedExpression = skipPartiallyEmittedExpressions(expression); - switch (emittedExpression.kind) { - case 181: - return ts.createParen(expression); - case 182: - return emittedExpression.arguments - ? expression - : ts.createParen(expression); - } - return parenthesizeForAccess(expression); - } - ts.parenthesizeForNew = parenthesizeForNew; - function parenthesizeForAccess(expression) { - var emittedExpression = skipPartiallyEmittedExpressions(expression); - if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 182 || emittedExpression.arguments)) { - return expression; + if (digits < minCount) { + value = -1; + } + return value; } - return ts.setTextRange(ts.createParen(expression), expression); - } - ts.parenthesizeForAccess = parenthesizeForAccess; - function parenthesizePostfixOperand(operand) { - return ts.isLeftHandSideExpression(operand) - ? operand - : ts.setTextRange(ts.createParen(operand), operand); - } - ts.parenthesizePostfixOperand = parenthesizePostfixOperand; - function parenthesizePrefixOperand(operand) { - return ts.isUnaryExpression(operand) - ? operand - : ts.setTextRange(ts.createParen(operand), operand); - } - ts.parenthesizePrefixOperand = parenthesizePrefixOperand; - function parenthesizeListElements(elements) { - var result; - for (var i = 0; i < elements.length; i++) { - var element = parenthesizeExpressionForList(elements[i]); - if (result !== undefined || element !== elements[i]) { - if (result === undefined) { - result = elements.slice(0, i); + function scanString(allowEscapes) { + if (allowEscapes === void 0) { allowEscapes = true; } + var quote = text.charCodeAt(pos); + pos++; + var result = ""; + var start = pos; + while (true) { + if (pos >= end) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; } - result.push(element); + var ch = text.charCodeAt(pos); + if (ch === quote) { + result += text.substring(start, pos); + pos++; + break; + } + if (ch === 92 && allowEscapes) { + result += text.substring(start, pos); + result += scanEscapeSequence(); + start = pos; + continue; + } + if (isLineBreak(ch)) { + result += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_string_literal); + break; + } + pos++; } + return result; } - if (result !== undefined) { - return ts.setTextRange(ts.createNodeArray(result, elements.hasTrailingComma), elements); - } - return elements; - } - ts.parenthesizeListElements = parenthesizeListElements; - function parenthesizeExpressionForList(expression) { - var emittedExpression = skipPartiallyEmittedExpressions(expression); - var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(194, 26); - return expressionPrecedence > commaPrecedence - ? expression - : ts.setTextRange(ts.createParen(expression), expression); - } - ts.parenthesizeExpressionForList = parenthesizeExpressionForList; - function parenthesizeExpressionForExpressionStatement(expression) { - var emittedExpression = skipPartiallyEmittedExpressions(expression); - if (ts.isCallExpression(emittedExpression)) { - var callee = emittedExpression.expression; - var kind = skipPartiallyEmittedExpressions(callee).kind; - if (kind === 186 || kind === 187) { - var mutableCall = ts.getMutableClone(emittedExpression); - mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); - return recreateOuterExpressions(expression, mutableCall, 4); + function scanTemplateAndSetTokenValue() { + var startedWithBacktick = text.charCodeAt(pos) === 96; + pos++; + var start = pos; + var contents = ""; + var resultingToken; + while (true) { + if (pos >= end) { + contents += text.substring(start, pos); + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_template_literal); + resultingToken = startedWithBacktick ? 13 : 16; + break; + } + var currChar = text.charCodeAt(pos); + if (currChar === 96) { + contents += text.substring(start, pos); + pos++; + resultingToken = startedWithBacktick ? 13 : 16; + break; + } + if (currChar === 36 && pos + 1 < end && text.charCodeAt(pos + 1) === 123) { + contents += text.substring(start, pos); + pos += 2; + resultingToken = startedWithBacktick ? 14 : 15; + break; + } + if (currChar === 92) { + contents += text.substring(start, pos); + contents += scanEscapeSequence(); + start = pos; + continue; + } + if (currChar === 13) { + contents += text.substring(start, pos); + pos++; + if (pos < end && text.charCodeAt(pos) === 10) { + pos++; + } + contents += "\n"; + start = pos; + continue; + } + pos++; } + ts.Debug.assert(resultingToken !== undefined); + tokenValue = contents; + return resultingToken; } - else { - var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; - if (leftmostExpressionKind === 178 || leftmostExpressionKind === 186) { - return ts.setTextRange(ts.createParen(expression), expression); + function scanEscapeSequence() { + pos++; + if (pos >= end) { + error(ts.Diagnostics.Unexpected_end_of_text); + return ""; } - } - return expression; - } - ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement; - function parenthesizeElementTypeMember(member) { - switch (member.kind) { - case 166: - case 167: - case 160: - case 161: - return ts.createParenthesizedType(member); - } - return member; - } - ts.parenthesizeElementTypeMember = parenthesizeElementTypeMember; - function parenthesizeElementTypeMembers(members) { - return ts.createNodeArray(ts.sameMap(members, parenthesizeElementTypeMember)); - } - ts.parenthesizeElementTypeMembers = parenthesizeElementTypeMembers; - function parenthesizeTypeParameters(typeParameters) { - if (ts.some(typeParameters)) { - var nodeArray = ts.createNodeArray(); - for (var i = 0; i < typeParameters.length; ++i) { - var entry = typeParameters[i]; - nodeArray.push(i === 0 && ts.isFunctionOrConstructorTypeNode(entry) && entry.typeParameters ? - ts.createParenthesizedType(entry) : - entry); + var ch = text.charCodeAt(pos); + pos++; + switch (ch) { + case 48: + return "\0"; + case 98: + return "\b"; + case 116: + return "\t"; + case 110: + return "\n"; + case 118: + return "\v"; + case 102: + return "\f"; + case 114: + return "\r"; + case 39: + return "\'"; + case 34: + return "\""; + case 117: + if (pos < end && text.charCodeAt(pos) === 123) { + hasExtendedUnicodeEscape = true; + pos++; + return scanExtendedUnicodeEscape(); + } + return scanHexadecimalEscape(4); + case 120: + return scanHexadecimalEscape(2); + case 13: + if (pos < end && text.charCodeAt(pos) === 10) { + pos++; + } + case 10: + case 8232: + case 8233: + return ""; + default: + return String.fromCharCode(ch); } - return nodeArray; } - } - ts.parenthesizeTypeParameters = parenthesizeTypeParameters; - function getLeftmostExpression(node) { - while (true) { - switch (node.kind) { - case 193: - node = node.operand; - continue; - case 194: - node = node.left; - continue; - case 195: - node = node.condition; - continue; - case 181: - case 180: - case 179: - node = node.expression; - continue; - case 297: - node = node.expression; - continue; + function scanHexadecimalEscape(numDigits) { + var escapedValue = scanExactNumberOfHexDigits(numDigits); + if (escapedValue >= 0) { + return String.fromCharCode(escapedValue); + } + else { + error(ts.Diagnostics.Hexadecimal_digit_expected); + return ""; } - return node; - } - } - function parenthesizeConciseBody(body) { - if (!ts.isBlock(body) && getLeftmostExpression(body).kind === 178) { - return ts.setTextRange(ts.createParen(body), body); - } - return body; - } - ts.parenthesizeConciseBody = parenthesizeConciseBody; - var OuterExpressionKinds; - (function (OuterExpressionKinds) { - OuterExpressionKinds[OuterExpressionKinds["Parentheses"] = 1] = "Parentheses"; - OuterExpressionKinds[OuterExpressionKinds["Assertions"] = 2] = "Assertions"; - OuterExpressionKinds[OuterExpressionKinds["PartiallyEmittedExpressions"] = 4] = "PartiallyEmittedExpressions"; - OuterExpressionKinds[OuterExpressionKinds["All"] = 7] = "All"; - })(OuterExpressionKinds = ts.OuterExpressionKinds || (ts.OuterExpressionKinds = {})); - function isOuterExpression(node, kinds) { - if (kinds === void 0) { kinds = 7; } - switch (node.kind) { - case 185: - return (kinds & 1) !== 0; - case 184: - case 202: - case 203: - return (kinds & 2) !== 0; - case 297: - return (kinds & 4) !== 0; } - return false; - } - ts.isOuterExpression = isOuterExpression; - function skipOuterExpressions(node, kinds) { - if (kinds === void 0) { kinds = 7; } - var previousNode; - do { - previousNode = node; - if (kinds & 1) { - node = skipParentheses(node); + function scanExtendedUnicodeEscape() { + var escapedValue = scanMinimumNumberOfHexDigits(1); + var isInvalidExtendedEscape = false; + if (escapedValue < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + isInvalidExtendedEscape = true; } - if (kinds & 2) { - node = skipAssertions(node); + else if (escapedValue > 0x10FFFF) { + error(ts.Diagnostics.An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive); + isInvalidExtendedEscape = true; } - if (kinds & 4) { - node = skipPartiallyEmittedExpressions(node); + if (pos >= end) { + error(ts.Diagnostics.Unexpected_end_of_text); + isInvalidExtendedEscape = true; } - } while (previousNode !== node); - return node; - } - ts.skipOuterExpressions = skipOuterExpressions; - function skipParentheses(node) { - while (node.kind === 185) { - node = node.expression; - } - return node; - } - ts.skipParentheses = skipParentheses; - function skipAssertions(node) { - while (ts.isAssertionExpression(node) || node.kind === 203) { - node = node.expression; - } - return node; - } - ts.skipAssertions = skipAssertions; - function skipPartiallyEmittedExpressions(node) { - while (node.kind === 297) { - node = node.expression; - } - return node; - } - ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions; - function updateOuterExpression(outerExpression, expression) { - switch (outerExpression.kind) { - case 185: return ts.updateParen(outerExpression, expression); - case 184: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 202: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); - case 203: return ts.updateNonNullExpression(outerExpression, expression); - case 297: return ts.updatePartiallyEmittedExpression(outerExpression, expression); - } - } - function recreateOuterExpressions(outerExpression, innerExpression, kinds) { - if (kinds === void 0) { kinds = 7; } - if (outerExpression && isOuterExpression(outerExpression, kinds)) { - return updateOuterExpression(outerExpression, recreateOuterExpressions(outerExpression.expression, innerExpression)); - } - return innerExpression; - } - ts.recreateOuterExpressions = recreateOuterExpressions; - function startOnNewLine(node) { - node.startsOnNewLine = true; - return node; - } - ts.startOnNewLine = startOnNewLine; - function getExternalHelpersModuleName(node) { - var parseNode = ts.getOriginalNode(node, ts.isSourceFile); - var emitNode = parseNode && parseNode.emitNode; - return emitNode && emitNode.externalHelpersModuleName; - } - ts.getExternalHelpersModuleName = getExternalHelpersModuleName; - function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions, hasExportStarsToExportValues) { - if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(node, compilerOptions)) { - var externalHelpersModuleName = getExternalHelpersModuleName(node); - if (externalHelpersModuleName) { - return externalHelpersModuleName; + else if (text.charCodeAt(pos) === 125) { + pos++; } - var moduleKind = ts.getEmitModuleKind(compilerOptions); - var create = hasExportStarsToExportValues - && moduleKind !== ts.ModuleKind.System - && moduleKind !== ts.ModuleKind.ES2015; - if (!create) { - var helpers = ts.getEmitHelpers(node); - if (helpers) { - for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { - var helper = helpers_2[_i]; - if (!helper.scoped) { - create = true; - break; - } - } - } + else { + error(ts.Diagnostics.Unterminated_Unicode_escape_sequence); + isInvalidExtendedEscape = true; } - if (create) { - var parseNode = ts.getOriginalNode(node, ts.isSourceFile); - var emitNode = ts.getOrCreateEmitNode(parseNode); - return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText)); + if (isInvalidExtendedEscape) { + return ""; } + return utf16EncodeAsString(escapedValue); } - } - ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; - function getLocalNameForExternalImport(node, sourceFile) { - var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); - if (namespaceDeclaration && !ts.isDefaultImport(node)) { - var name = namespaceDeclaration.name; - return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); - } - if (node.kind === 238 && node.importClause) { - return ts.getGeneratedNameForNode(node); - } - if (node.kind === 244 && node.moduleSpecifier) { - return ts.getGeneratedNameForNode(node); - } - return undefined; - } - ts.getLocalNameForExternalImport = getLocalNameForExternalImport; - function getExternalModuleNameLiteral(importNode, sourceFile, host, resolver, compilerOptions) { - var moduleName = ts.getExternalModuleName(importNode); - if (moduleName.kind === 9) { - return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions) - || tryRenameExternalModule(moduleName, sourceFile) - || ts.getSynthesizedClone(moduleName); - } - return undefined; - } - ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral; - function tryRenameExternalModule(moduleName, sourceFile) { - var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); - return rename && ts.createLiteral(rename); - } - function tryGetModuleNameFromFile(file, host, options) { - if (!file) { - return undefined; - } - if (file.moduleName) { - return ts.createLiteral(file.moduleName); - } - if (!file.isDeclarationFile && (options.out || options.outFile)) { - return ts.createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); - } - return undefined; - } - ts.tryGetModuleNameFromFile = tryGetModuleNameFromFile; - function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) { - return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions); - } - function getInitializerOfBindingOrAssignmentElement(bindingElement) { - if (ts.isDeclarationBindingElement(bindingElement)) { - return bindingElement.initializer; - } - if (ts.isPropertyAssignment(bindingElement)) { - return ts.isAssignmentExpression(bindingElement.initializer, true) - ? bindingElement.initializer.right - : undefined; - } - if (ts.isShorthandPropertyAssignment(bindingElement)) { - return bindingElement.objectAssignmentInitializer; - } - if (ts.isAssignmentExpression(bindingElement, true)) { - return bindingElement.right; - } - if (ts.isSpreadElement(bindingElement)) { - return getInitializerOfBindingOrAssignmentElement(bindingElement.expression); - } - } - ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement; - function getTargetOfBindingOrAssignmentElement(bindingElement) { - if (ts.isDeclarationBindingElement(bindingElement)) { - return bindingElement.name; - } - if (ts.isObjectLiteralElementLike(bindingElement)) { - switch (bindingElement.kind) { - case 261: - return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 262: - return bindingElement.name; - case 263: - return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + function utf16EncodeAsString(codePoint) { + ts.Debug.assert(0x0 <= codePoint && codePoint <= 0x10FFFF); + if (codePoint <= 65535) { + return String.fromCharCode(codePoint); } - return undefined; - } - if (ts.isAssignmentExpression(bindingElement, true)) { - return getTargetOfBindingOrAssignmentElement(bindingElement.left); - } - if (ts.isSpreadElement(bindingElement)) { - return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + var codeUnit1 = Math.floor((codePoint - 65536) / 1024) + 0xD800; + var codeUnit2 = ((codePoint - 65536) % 1024) + 0xDC00; + return String.fromCharCode(codeUnit1, codeUnit2); } - return bindingElement; - } - ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; - function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { - switch (bindingElement.kind) { - case 146: - case 176: - return bindingElement.dotDotDotToken; - case 198: - case 263: - return bindingElement; + function peekUnicodeEscape() { + if (pos + 5 < end && text.charCodeAt(pos + 1) === 117) { + var start_1 = pos; + pos += 2; + var value = scanExactNumberOfHexDigits(4); + pos = start_1; + return value; + } + return -1; } - return undefined; - } - ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; - function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { - switch (bindingElement.kind) { - case 176: - if (bindingElement.propertyName) { - var propertyName = bindingElement.propertyName; - return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) - ? propertyName.expression - : propertyName; + function scanIdentifierParts() { + var result = ""; + var start = pos; + while (pos < end) { + var ch = text.charCodeAt(pos); + if (isIdentifierPart(ch, languageVersion)) { + pos++; } - break; - case 261: - if (bindingElement.name) { - var propertyName = bindingElement.name; - return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) - ? propertyName.expression - : propertyName; + else if (ch === 92) { + ch = peekUnicodeEscape(); + if (!(ch >= 0 && isIdentifierPart(ch, languageVersion))) { + break; + } + result += text.substring(start, pos); + result += String.fromCharCode(ch); + pos += 6; + start = pos; } - break; - case 263: - return bindingElement.name; - } - var target = getTargetOfBindingOrAssignmentElement(bindingElement); - if (target && ts.isPropertyName(target)) { - return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression) - ? target.expression - : target; - } - ts.Debug.fail("Invalid property name for binding element."); - } - ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; - function getElementsOfBindingOrAssignmentPattern(name) { - switch (name.kind) { - case 174: - case 175: - case 177: - return name.elements; - case 178: - return name.properties; + else { + break; + } + } + result += text.substring(start, pos); + return result; } - } - ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern; - function convertToArrayAssignmentElement(element) { - if (ts.isBindingElement(element)) { - if (element.dotDotDotToken) { - ts.Debug.assertNode(element.name, ts.isIdentifier); - return ts.setOriginalNode(ts.setTextRange(ts.createSpread(element.name), element), element); + function getIdentifierToken() { + var len = tokenValue.length; + if (len >= 2 && len <= 11) { + var ch = tokenValue.charCodeAt(0); + if (ch >= 97 && ch <= 122) { + token = textToToken.get(tokenValue); + if (token !== undefined) { + return token; + } + } } - var expression = convertToAssignmentElementTarget(element.name); - return element.initializer - ? ts.setOriginalNode(ts.setTextRange(ts.createAssignment(expression, element.initializer), element), element) - : expression; + return token = 71; } - ts.Debug.assertNode(element, ts.isExpression); - return element; - } - ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement; - function convertToObjectAssignmentElement(element) { - if (ts.isBindingElement(element)) { - if (element.dotDotDotToken) { - ts.Debug.assertNode(element.name, ts.isIdentifier); - return ts.setOriginalNode(ts.setTextRange(ts.createSpreadAssignment(element.name), element), element); + function scanBinaryOrOctalDigits(base) { + ts.Debug.assert(base === 2 || base === 8, "Expected either base 2 or base 8"); + var value = 0; + var numberOfDigits = 0; + while (true) { + var ch = text.charCodeAt(pos); + var valueOfCh = ch - 48; + if (!isDigit(ch) || valueOfCh >= base) { + break; + } + value = value * base + valueOfCh; + pos++; + numberOfDigits++; } - if (element.propertyName) { - var expression = convertToAssignmentElementTarget(element.name); - return ts.setOriginalNode(ts.setTextRange(ts.createPropertyAssignment(element.propertyName, element.initializer ? ts.createAssignment(expression, element.initializer) : expression), element), element); + if (numberOfDigits === 0) { + return -1; } - ts.Debug.assertNode(element.name, ts.isIdentifier); - return ts.setOriginalNode(ts.setTextRange(ts.createShorthandPropertyAssignment(element.name, element.initializer), element), element); - } - ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); - return element; - } - ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; - function convertToAssignmentPattern(node) { - switch (node.kind) { - case 175: - case 177: - return convertToArrayAssignmentPattern(node); - case 174: - case 178: - return convertToObjectAssignmentPattern(node); - } - } - ts.convertToAssignmentPattern = convertToAssignmentPattern; - function convertToObjectAssignmentPattern(node) { - if (ts.isObjectBindingPattern(node)) { - return ts.setOriginalNode(ts.setTextRange(ts.createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement)), node), node); - } - ts.Debug.assertNode(node, ts.isObjectLiteralExpression); - return node; - } - ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; - function convertToArrayAssignmentPattern(node) { - if (ts.isArrayBindingPattern(node)) { - return ts.setOriginalNode(ts.setTextRange(ts.createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement)), node), node); - } - ts.Debug.assertNode(node, ts.isArrayLiteralExpression); - return node; - } - ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern; - function convertToAssignmentElementTarget(node) { - if (ts.isBindingPattern(node)) { - return convertToAssignmentPattern(node); + return value; } - ts.Debug.assertNode(node, ts.isExpression); - return node; - } - ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; - function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { - var externalImports = []; - var exportSpecifiers = ts.createMultiMap(); - var exportedBindings = []; - var uniqueExports = ts.createMap(); - var exportedNames; - var hasExportDefault = false; - var exportEquals = undefined; - var hasExportStarsToExportValues = false; - for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { - var node = _a[_i]; - switch (node.kind) { - case 238: - externalImports.push(node); - break; - case 237: - if (node.moduleReference.kind === 248) { - externalImports.push(node); + function scan() { + startPos = pos; + hasExtendedUnicodeEscape = false; + precedingLineBreak = false; + tokenIsUnterminated = false; + numericLiteralFlags = 0; + while (true) { + tokenPos = pos; + if (pos >= end) { + return token = 1; + } + var ch = text.charCodeAt(pos); + if (ch === 35 && pos === 0 && isShebangTrivia(text, pos)) { + pos = scanShebangTrivia(text, pos); + if (skipTrivia) { + continue; } - break; - case 244: - if (node.moduleSpecifier) { - if (!node.exportClause) { - externalImports.push(node); - hasExportStarsToExportValues = true; + else { + return token = 6; + } + } + switch (ch) { + case 10: + case 13: + precedingLineBreak = true; + if (skipTrivia) { + pos++; + continue; } else { - externalImports.push(node); + if (ch === 13 && pos + 1 < end && text.charCodeAt(pos + 1) === 10) { + pos += 2; + } + else { + pos++; + } + return token = 4; } - } - else { - for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { - var specifier = _c[_b]; - if (!uniqueExports.get(specifier.name.text)) { - var name = specifier.propertyName || specifier.name; - exportSpecifiers.add(name.text, specifier); - var decl = resolver.getReferencedImportDeclaration(name) - || resolver.getReferencedValueDeclaration(name); - if (decl) { - multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(decl), specifier.name); + case 9: + case 11: + case 12: + case 32: + if (skipTrivia) { + pos++; + continue; + } + else { + while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) { + pos++; + } + return token = 5; + } + case 33: + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 35; + } + return pos += 2, token = 33; + } + pos++; + return token = 51; + case 34: + case 39: + tokenValue = scanString(); + return token = 9; + case 96: + return token = scanTemplateAndSetTokenValue(); + case 37: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 64; + } + pos++; + return token = 42; + case 38: + if (text.charCodeAt(pos + 1) === 38) { + return pos += 2, token = 53; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 68; + } + pos++; + return token = 48; + case 40: + pos++; + return token = 19; + case 41: + pos++; + return token = 20; + case 42: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 61; + } + if (text.charCodeAt(pos + 1) === 42) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 62; + } + return pos += 2, token = 40; + } + pos++; + return token = 39; + case 43: + if (text.charCodeAt(pos + 1) === 43) { + return pos += 2, token = 43; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 59; + } + pos++; + return token = 37; + case 44: + pos++; + return token = 26; + case 45: + if (text.charCodeAt(pos + 1) === 45) { + return pos += 2, token = 44; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 60; + } + pos++; + return token = 38; + case 46: + if (isDigit(text.charCodeAt(pos + 1))) { + tokenValue = scanNumber(); + return token = 8; + } + if (text.charCodeAt(pos + 1) === 46 && text.charCodeAt(pos + 2) === 46) { + return pos += 3, token = 24; + } + pos++; + return token = 23; + case 47: + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + while (pos < end) { + if (isLineBreak(text.charCodeAt(pos))) { + break; } - uniqueExports.set(specifier.name.text, true); - exportedNames = ts.append(exportedNames, specifier.name); + pos++; + } + if (skipTrivia) { + continue; + } + else { + return token = 2; } } - } - break; - case 243: - if (node.isExportEquals && !exportEquals) { - exportEquals = node; - } - break; - case 208: - if (ts.hasModifier(node, 1)) { - for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { - var decl = _e[_d]; - exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames); + if (text.charCodeAt(pos + 1) === 42) { + pos += 2; + var commentClosed = false; + while (pos < end) { + var ch_1 = text.charCodeAt(pos); + if (ch_1 === 42 && text.charCodeAt(pos + 1) === 47) { + pos += 2; + commentClosed = true; + break; + } + if (isLineBreak(ch_1)) { + precedingLineBreak = true; + } + pos++; + } + if (!commentClosed) { + error(ts.Diagnostics.Asterisk_Slash_expected); + } + if (skipTrivia) { + continue; + } + else { + tokenIsUnterminated = !commentClosed; + return token = 3; + } } - } - break; - case 228: - if (ts.hasModifier(node, 1)) { - if (ts.hasModifier(node, 512)) { - if (!hasExportDefault) { - multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); - hasExportDefault = true; + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 63; + } + pos++; + return token = 41; + case 48: + if (pos + 2 < end && (text.charCodeAt(pos + 1) === 88 || text.charCodeAt(pos + 1) === 120)) { + pos += 2; + var value = scanMinimumNumberOfHexDigits(1); + if (value < 0) { + error(ts.Diagnostics.Hexadecimal_digit_expected); + value = 0; } + tokenValue = "" + value; + numericLiteralFlags = 8; + return token = 8; } - else { - var name = node.name; - if (!uniqueExports.get(name.text)) { - multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); - uniqueExports.set(name.text, true); - exportedNames = ts.append(exportedNames, name); + else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 66 || text.charCodeAt(pos + 1) === 98)) { + pos += 2; + var value = scanBinaryOrOctalDigits(2); + if (value < 0) { + error(ts.Diagnostics.Binary_digit_expected); + value = 0; } + tokenValue = "" + value; + numericLiteralFlags = 16; + return token = 8; } - } - break; - case 229: - if (ts.hasModifier(node, 1)) { - if (ts.hasModifier(node, 512)) { - if (!hasExportDefault) { - multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), getDeclarationName(node)); - hasExportDefault = true; + else if (pos + 2 < end && (text.charCodeAt(pos + 1) === 79 || text.charCodeAt(pos + 1) === 111)) { + pos += 2; + var value = scanBinaryOrOctalDigits(8); + if (value < 0) { + error(ts.Diagnostics.Octal_digit_expected); + value = 0; + } + tokenValue = "" + value; + numericLiteralFlags = 32; + return token = 8; + } + if (pos + 1 < end && isOctalDigit(text.charCodeAt(pos + 1))) { + tokenValue = "" + scanOctalDigits(); + numericLiteralFlags = 4; + return token = 8; + } + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + tokenValue = scanNumber(); + return token = 8; + case 58: + pos++; + return token = 56; + case 59: + pos++; + return token = 25; + case 60: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 7; } } - else { - var name = node.name; - if (!uniqueExports.get(name.text)) { - multiMapSparseArrayAdd(exportedBindings, ts.getOriginalNodeId(node), name); - uniqueExports.set(name.text, true); - exportedNames = ts.append(exportedNames, name); + if (text.charCodeAt(pos + 1) === 60) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 65; + } + return pos += 2, token = 45; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 30; + } + if (languageVariant === 1 && + text.charCodeAt(pos + 1) === 47 && + text.charCodeAt(pos + 2) !== 42) { + return pos += 2, token = 28; + } + pos++; + return token = 27; + case 61: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 7; + } + } + if (text.charCodeAt(pos + 1) === 61) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 34; + } + return pos += 2, token = 32; + } + if (text.charCodeAt(pos + 1) === 62) { + return pos += 2, token = 36; + } + pos++; + return token = 58; + case 62: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 7; + } + } + pos++; + return token = 29; + case 63: + pos++; + return token = 55; + case 91: + pos++; + return token = 21; + case 93: + pos++; + return token = 22; + case 94: + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 70; + } + pos++; + return token = 50; + case 123: + pos++; + return token = 17; + case 124: + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + if (skipTrivia) { + continue; + } + else { + return token = 7; } } + if (text.charCodeAt(pos + 1) === 124) { + return pos += 2, token = 54; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 69; + } + pos++; + return token = 49; + case 125: + pos++; + return token = 18; + case 126: + pos++; + return token = 52; + case 64: + pos++; + return token = 57; + case 92: + var cookedChar = peekUnicodeEscape(); + if (cookedChar >= 0 && isIdentifierStart(cookedChar, languageVersion)) { + pos += 6; + tokenValue = String.fromCharCode(cookedChar) + scanIdentifierParts(); + return token = getIdentifierToken(); + } + error(ts.Diagnostics.Invalid_character); + pos++; + return token = 0; + default: + if (isIdentifierStart(ch, languageVersion)) { + pos++; + while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) + pos++; + tokenValue = text.substring(tokenPos, pos); + if (ch === 92) { + tokenValue += scanIdentifierParts(); + } + return token = getIdentifierToken(); + } + else if (isWhiteSpaceSingleLine(ch)) { + pos++; + continue; + } + else if (isLineBreak(ch)) { + precedingLineBreak = true; + pos++; + continue; + } + error(ts.Diagnostics.Invalid_character); + pos++; + return token = 0; + } + } + } + function reScanGreaterToken() { + if (token === 29) { + if (text.charCodeAt(pos) === 62) { + if (text.charCodeAt(pos + 1) === 62) { + if (text.charCodeAt(pos + 2) === 61) { + return pos += 3, token = 67; + } + return pos += 2, token = 47; + } + if (text.charCodeAt(pos + 1) === 61) { + return pos += 2, token = 66; } + pos++; + return token = 46; + } + if (text.charCodeAt(pos) === 61) { + pos++; + return token = 31; + } + } + return token; + } + function reScanSlashToken() { + if (token === 41 || token === 63) { + var p = tokenPos + 1; + var inEscape = false; + var inCharacterClass = false; + while (true) { + if (p >= end) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + var ch = text.charCodeAt(p); + if (isLineBreak(ch)) { + tokenIsUnterminated = true; + error(ts.Diagnostics.Unterminated_regular_expression_literal); + break; + } + if (inEscape) { + inEscape = false; + } + else if (ch === 47 && !inCharacterClass) { + p++; + break; + } + else if (ch === 91) { + inCharacterClass = true; + } + else if (ch === 92) { + inEscape = true; + } + else if (ch === 93) { + inCharacterClass = false; + } + p++; + } + while (p < end && isIdentifierPart(text.charCodeAt(p), languageVersion)) { + p++; + } + pos = p; + tokenValue = text.substring(tokenPos, pos); + token = 12; + } + return token; + } + function reScanTemplateToken() { + ts.Debug.assert(token === 18, "'reScanTemplateToken' should only be called on a '}'"); + pos = tokenPos; + return token = scanTemplateAndSetTokenValue(); + } + function reScanJsxToken() { + pos = tokenPos = startPos; + return token = scanJsxToken(); + } + function scanJsxToken() { + startPos = tokenPos = pos; + if (pos >= end) { + return token = 1; + } + var char = text.charCodeAt(pos); + if (char === 60) { + if (text.charCodeAt(pos + 1) === 47) { + pos += 2; + return token = 28; + } + pos++; + return token = 27; + } + if (char === 123) { + pos++; + return token = 17; + } + var firstNonWhitespace = 0; + while (pos < end) { + char = text.charCodeAt(pos); + if (char === 123) { break; + } + if (char === 60) { + if (isConflictMarkerTrivia(text, pos)) { + pos = scanConflictMarkerTrivia(text, pos, error); + return token = 7; + } + break; + } + if (isLineBreak(char) && firstNonWhitespace === 0) { + firstNonWhitespace = -1; + } + else if (!isWhiteSpaceLike(char)) { + firstNonWhitespace = pos; + } + pos++; } + return firstNonWhitespace === -1 ? 11 : 10; } - var externalHelpersModuleName = getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues); - var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); - if (externalHelpersImportDeclaration) { - externalImports.unshift(externalHelpersImportDeclaration); + function scanJsxIdentifier() { + if (tokenIsIdentifierOrKeyword(token)) { + var firstCharPosition = pos; + while (pos < end) { + var ch = text.charCodeAt(pos); + if (ch === 45 || ((firstCharPosition === pos) ? isIdentifierStart(ch, languageVersion) : isIdentifierPart(ch, languageVersion))) { + pos++; + } + else { + break; + } + } + tokenValue += text.substr(firstCharPosition, pos - firstCharPosition); + } + return token; } - return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration }; - } - ts.collectExternalModuleInfo = collectExternalModuleInfo; - function collectExportedVariableInfo(decl, uniqueExports, exportedNames) { - if (ts.isBindingPattern(decl.name)) { - for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (!ts.isOmittedExpression(element)) { - exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames); + function scanJsxAttributeValue() { + startPos = pos; + switch (text.charCodeAt(pos)) { + case 34: + case 39: + tokenValue = scanString(false); + return token = 9; + default: + return scan(); + } + } + function scanJSDocToken() { + if (pos >= end) { + return token = 1; + } + startPos = pos; + tokenPos = pos; + var ch = text.charCodeAt(pos); + switch (ch) { + case 9: + case 11: + case 12: + case 32: + while (pos < end && isWhiteSpaceSingleLine(text.charCodeAt(pos))) { + pos++; + } + return token = 5; + case 64: + pos++; + return token = 57; + case 10: + case 13: + pos++; + return token = 4; + case 42: + pos++; + return token = 39; + case 123: + pos++; + return token = 17; + case 125: + pos++; + return token = 18; + case 91: + pos++; + return token = 21; + case 93: + pos++; + return token = 22; + case 61: + pos++; + return token = 58; + case 44: + pos++; + return token = 26; + case 46: + pos++; + return token = 23; + } + if (isIdentifierStart(ch, 5)) { + pos++; + while (isIdentifierPart(text.charCodeAt(pos), 5) && pos < end) { + pos++; } + return token = 71; + } + else { + return pos += 1, token = 0; } } - else if (!ts.isGeneratedIdentifier(decl.name)) { - if (!uniqueExports.get(decl.name.text)) { - uniqueExports.set(decl.name.text, true); - exportedNames = ts.append(exportedNames, decl.name); + function speculationHelper(callback, isLookahead) { + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var saveTokenValue = tokenValue; + var savePrecedingLineBreak = precedingLineBreak; + var result = callback(); + if (!result || isLookahead) { + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + tokenValue = saveTokenValue; + precedingLineBreak = savePrecedingLineBreak; } + return result; } - return exportedNames; - } - function multiMapSparseArrayAdd(map, key, value) { - var values = map[key]; - if (values) { - values.push(value); + function scanRange(start, length, callback) { + var saveEnd = end; + var savePos = pos; + var saveStartPos = startPos; + var saveTokenPos = tokenPos; + var saveToken = token; + var savePrecedingLineBreak = precedingLineBreak; + var saveTokenValue = tokenValue; + var saveHasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + var saveTokenIsUnterminated = tokenIsUnterminated; + setText(text, start, length); + var result = callback(); + end = saveEnd; + pos = savePos; + startPos = saveStartPos; + tokenPos = saveTokenPos; + token = saveToken; + precedingLineBreak = savePrecedingLineBreak; + tokenValue = saveTokenValue; + hasExtendedUnicodeEscape = saveHasExtendedUnicodeEscape; + tokenIsUnterminated = saveTokenIsUnterminated; + return result; } - else { - map[key] = values = [value]; + function lookAhead(callback) { + return speculationHelper(callback, true); + } + function tryScan(callback) { + return speculationHelper(callback, false); + } + function getText() { + return text; + } + function setText(newText, start, length) { + text = newText || ""; + end = length === undefined ? text.length : start + length; + setTextPos(start || 0); + } + function setOnError(errorCallback) { + onError = errorCallback; + } + function setScriptTarget(scriptTarget) { + languageVersion = scriptTarget; + } + function setLanguageVariant(variant) { + languageVariant = variant; + } + function setTextPos(textPos) { + ts.Debug.assert(textPos >= 0); + pos = textPos; + startPos = textPos; + tokenPos = textPos; + token = 0; + precedingLineBreak = false; + tokenValue = undefined; + hasExtendedUnicodeEscape = false; + tokenIsUnterminated = false; } - return values; } + ts.createScanner = createScanner; })(ts || (ts = {})); var ts; (function (ts) { + var SignatureFlags; + (function (SignatureFlags) { + SignatureFlags[SignatureFlags["None"] = 0] = "None"; + SignatureFlags[SignatureFlags["Yield"] = 1] = "Yield"; + SignatureFlags[SignatureFlags["Await"] = 2] = "Await"; + SignatureFlags[SignatureFlags["Type"] = 4] = "Type"; + SignatureFlags[SignatureFlags["RequireCompleteParameterList"] = 8] = "RequireCompleteParameterList"; + SignatureFlags[SignatureFlags["IgnoreMissingOpenBrace"] = 16] = "IgnoreMissingOpenBrace"; + SignatureFlags[SignatureFlags["JSDoc"] = 32] = "JSDoc"; + })(SignatureFlags || (SignatureFlags = {})); var NodeConstructor; var TokenConstructor; var IdentifierConstructor; @@ -16291,17 +10598,13 @@ var ts; } ts.createNode = createNode; function visitNode(cbNode, node) { - if (node) { - return cbNode(node); - } + return node && cbNode(node); } - function visitNodeArray(cbNodes, nodes) { - if (nodes) { - return cbNodes(nodes); - } - } - function visitEachNode(cbNode, nodes) { + function visitNodes(cbNode, cbNodes, nodes) { if (nodes) { + if (cbNodes) { + return cbNodes(nodes); + } for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { var node = nodes_1[_i]; var result = cbNode(node); @@ -16311,12 +10614,10 @@ var ts; } } } - function forEachChild(node, cbNode, cbNodeArray) { - if (!node) { + function forEachChild(node, cbNode, cbNodes) { + if (!node || node.kind <= 142) { return; } - var visitNodes = cbNodeArray ? visitNodeArray : visitEachNode; - var cbNodes = cbNodeArray || cbNode; switch (node.kind) { case 143: return visitNode(cbNode, node.left) || @@ -16327,8 +10628,8 @@ var ts; visitNode(cbNode, node.default) || visitNode(cbNode, node.expression); case 262: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || visitNode(cbNode, node.equalsToken) || @@ -16341,8 +10642,8 @@ var ts; case 261: case 226: case 176: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.dotDotDotToken) || visitNode(cbNode, node.name) || @@ -16354,10 +10655,10 @@ var ts; case 155: case 156: case 157: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type); case 151: case 150: @@ -16367,33 +10668,33 @@ var ts; case 186: case 228: case 187: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.asteriskToken) || visitNode(cbNode, node.name) || visitNode(cbNode, node.questionToken) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.parameters) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || visitNode(cbNode, node.type) || visitNode(cbNode, node.equalsGreaterThanToken) || visitNode(cbNode, node.body); case 159: return visitNode(cbNode, node.typeName) || - visitNodes(cbNodes, node.typeArguments); + visitNodes(cbNode, cbNodes, node.typeArguments); case 158: return visitNode(cbNode, node.parameterName) || visitNode(cbNode, node.type); case 162: return visitNode(cbNode, node.exprName); case 163: - return visitNodes(cbNodes, node.members); + return visitNodes(cbNode, cbNodes, node.members); case 164: return visitNode(cbNode, node.elementType); case 165: - return visitNodes(cbNodes, node.elementTypes); + return visitNodes(cbNode, cbNodes, node.elementTypes); case 166: case 167: - return visitNodes(cbNodes, node.types); + return visitNodes(cbNode, cbNodes, node.types); case 168: case 170: return visitNode(cbNode, node.type); @@ -16409,11 +10710,11 @@ var ts; return visitNode(cbNode, node.literal); case 174: case 175: - return visitNodes(cbNodes, node.elements); + return visitNodes(cbNode, cbNodes, node.elements); case 177: - return visitNodes(cbNodes, node.elements); + return visitNodes(cbNode, cbNodes, node.elements); case 178: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNode, cbNodes, node.properties); case 179: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.name); @@ -16423,8 +10724,8 @@ var ts; case 181: case 182: return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.typeArguments) || - visitNodes(cbNodes, node.arguments); + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); case 183: return visitNode(cbNode, node.tag) || visitNode(cbNode, node.template); @@ -16469,16 +10770,16 @@ var ts; return visitNode(cbNode, node.expression); case 207: case 234: - return visitNodes(cbNodes, node.statements); + return visitNodes(cbNode, cbNodes, node.statements); case 265: - return visitNodes(cbNodes, node.statements) || + return visitNodes(cbNode, cbNodes, node.statements) || visitNode(cbNode, node.endOfFileToken); case 208: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.declarationList); case 227: - return visitNodes(cbNodes, node.declarations); + return visitNodes(cbNode, cbNodes, node.declarations); case 210: return visitNode(cbNode, node.expression); case 211: @@ -16517,12 +10818,12 @@ var ts; return visitNode(cbNode, node.expression) || visitNode(cbNode, node.caseBlock); case 235: - return visitNodes(cbNodes, node.clauses); + return visitNodes(cbNode, cbNodes, node.clauses); case 257: return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.statements); + visitNodes(cbNode, cbNodes, node.statements); case 258: - return visitNodes(cbNodes, node.statements); + return visitNodes(cbNode, cbNodes, node.statements); case 222: return visitNode(cbNode, node.label) || visitNode(cbNode, node.statement); @@ -16539,46 +10840,46 @@ var ts; return visitNode(cbNode, node.expression); case 229: case 199: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); case 230: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || - visitNodes(cbNodes, node.heritageClauses) || - visitNodes(cbNodes, node.members); + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); case 231: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.typeParameters) || visitNode(cbNode, node.type); case 232: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.members); + visitNodes(cbNode, cbNodes, node.members); case 264: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); case 233: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.body); case 237: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.name) || visitNode(cbNode, node.moduleReference); case 238: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.importClause) || visitNode(cbNode, node.moduleSpecifier); case 239: @@ -16590,10 +10891,10 @@ var ts; return visitNode(cbNode, node.name); case 241: case 245: - return visitNodes(cbNodes, node.elements); + return visitNodes(cbNode, cbNodes, node.elements); case 244: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.exportClause) || visitNode(cbNode, node.moduleSpecifier); case 242: @@ -16601,36 +10902,36 @@ var ts; return visitNode(cbNode, node.propertyName) || visitNode(cbNode, node.name); case 243: - return visitNodes(cbNodes, node.decorators) || - visitNodes(cbNodes, node.modifiers) || + return visitNodes(cbNode, cbNodes, node.decorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || visitNode(cbNode, node.expression); case 196: - return visitNode(cbNode, node.head) || visitNodes(cbNodes, node.templateSpans); + return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans); case 205: return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal); case 144: return visitNode(cbNode, node.expression); case 259: - return visitNodes(cbNodes, node.types); + return visitNodes(cbNode, cbNodes, node.types); case 201: return visitNode(cbNode, node.expression) || - visitNodes(cbNodes, node.typeArguments); + visitNodes(cbNode, cbNodes, node.typeArguments); case 248: return visitNode(cbNode, node.expression); case 247: - return visitNodes(cbNodes, node.decorators); - case 298: - return visitNodes(cbNodes, node.elements); + return visitNodes(cbNode, cbNodes, node.decorators); + case 289: + return visitNodes(cbNode, cbNodes, node.elements); case 249: return visitNode(cbNode, node.openingElement) || - visitNodes(cbNodes, node.children) || + visitNodes(cbNode, cbNodes, node.children) || visitNode(cbNode, node.closingElement); case 250: case 251: return visitNode(cbNode, node.tagName) || visitNode(cbNode, node.attributes); case 254: - return visitNodes(cbNodes, node.properties); + return visitNodes(cbNode, cbNodes, node.properties); case 253: return visitNode(cbNode, node.name) || visitNode(cbNode, node.initializer); @@ -16644,62 +10945,56 @@ var ts; case 267: return visitNode(cbNode, node.type); case 271: - return visitNodes(cbNodes, node.types); - case 272: - return visitNodes(cbNodes, node.types); + return visitNode(cbNode, node.type); case 270: - return visitNode(cbNode, node.elementType); - case 274: + return visitNode(cbNode, node.type); + case 272: return visitNode(cbNode, node.type); case 273: + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + case 274: return visitNode(cbNode, node.type); case 275: - return visitNode(cbNode, node.literal); - case 277: - return visitNode(cbNode, node.name) || - visitNodes(cbNodes, node.typeArguments); - case 278: - return visitNode(cbNode, node.type); + return visitNodes(cbNode, cbNodes, node.tags); case 279: - return visitNodes(cbNodes, node.parameters) || - visitNode(cbNode, node.type); + case 284: + if (node.isNameFirst) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.typeExpression); + } + else { + return visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.name); + } case 280: - return visitNode(cbNode, node.type); + return visitNode(cbNode, node.typeExpression); case 281: - return visitNode(cbNode, node.type); - case 282: - return visitNode(cbNode, node.type); - case 276: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.type); - case 283: - return visitNodes(cbNodes, node.tags); - case 287: - return visitNode(cbNode, node.preParameterName) || - visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.postParameterName); - case 288: return visitNode(cbNode, node.typeExpression); - case 289: + case 277: return visitNode(cbNode, node.typeExpression); + case 282: + return visitNodes(cbNode, cbNodes, node.typeParameters); + case 283: + if (node.typeExpression && + node.typeExpression.kind === 267) { + return visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName); + } + else { + return visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression); + } case 285: - return visitNode(cbNode, node.typeExpression); - case 290: - return visitNodes(cbNodes, node.typeParameters); - case 291: - return visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.jsDocTypeLiteral); - case 293: - return visitNodes(cbNodes, node.jsDocPropertyTags); - case 292: - return visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name); - case 297: + if (node.jsDocPropertyTags) { + for (var _i = 0, _a = node.jsDocPropertyTags; _i < _a.length; _i++) { + var tag = _a[_i]; + visitNode(cbNode, tag); + } + } + return; + case 288: return visitNode(cbNode, node.expression); - case 294: - return visitNode(cbNode, node.literal); } } ts.forEachChild = forEachChild; @@ -16716,6 +11011,10 @@ var ts; return Parser.parseIsolatedEntityName(text, languageVersion); } ts.parseIsolatedEntityName = parseIsolatedEntityName; + function parseJsonText(fileName, sourceText) { + return Parser.parseJsonText(fileName, sourceText); + } + ts.parseJsonText = parseJsonText; function isExternalModule(file) { return file.externalModuleIndicator !== undefined; } @@ -16774,8 +11073,29 @@ var ts; return isInvalid ? entityName : undefined; } Parser.parseIsolatedEntityName = parseIsolatedEntityName; + function parseJsonText(fileName, sourceText) { + initializeState(sourceText, 2, undefined, 6); + sourceFile = createSourceFile(fileName, 2, 6); + var result = sourceFile; + nextToken(); + if (token() === 1) { + sourceFile.endOfFileToken = parseTokenNode(); + } + else if (token() === 17 || + lookAhead(function () { return token() === 9; })) { + result.jsonObject = parseObjectLiteralExpression(); + sourceFile.endOfFileToken = parseExpectedToken(1, false, ts.Diagnostics.Unexpected_token); + } + else { + parseExpected(17); + } + sourceFile.parseDiagnostics = parseDiagnostics; + clearState(); + return result; + } + Parser.parseJsonText = parseJsonText; function getLanguageVariant(scriptKind) { - return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 ? 1 : 0; + return scriptKind === 4 || scriptKind === 2 || scriptKind === 1 || scriptKind === 6 ? 1 : 0; } function initializeState(_sourceText, languageVersion, _syntaxCursor, scriptKind) { NodeConstructor = ts.objectAllocator.getNodeConstructor(); @@ -16789,7 +11109,7 @@ var ts; identifiers = ts.createMap(); identifierCount = 0; nodeCount = 0; - contextFlags = scriptKind === 1 || scriptKind === 2 ? 65536 : 0; + contextFlags = scriptKind === 1 || scriptKind === 2 || scriptKind === 6 ? 65536 : 0; parseErrorBeforeNextFinishedNode = false; scanner.setText(sourceText); scanner.setOnError(scanError); @@ -17123,11 +11443,15 @@ var ts; parseErrorAtCurrentToken(diagnosticMessage, arg0); } var result = createNode(kind, scanner.getStartPos()); - result.text = ""; + if (kind === 71) { + result.escapedText = ""; + } + else if (ts.isLiteralKind(kind) || ts.isTemplateLiteralKind(kind)) { + result.text = ""; + } return finishNode(result); } function internIdentifier(text) { - text = ts.escapeIdentifier(text); var identifier = identifiers.get(text); if (identifier === undefined) { identifiers.set(text, identifier = text); @@ -17141,7 +11465,7 @@ var ts; if (token() !== 71) { node.originalKeywordKind = token(); } - node.text = internIdentifier(scanner.getTokenValue()); + node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node); } @@ -17160,7 +11484,9 @@ var ts; } function parsePropertyNameWorker(allowComputedPropertyNames) { if (token() === 9 || token() === 8) { - return parseLiteralNode(true); + var node = parseLiteralNode(); + node.text = internIdentifier(node.text); + return node; } if (allowComputedPropertyNames && token() === 21) { return parseComputedPropertyName(); @@ -17170,12 +11496,6 @@ var ts; function parsePropertyName() { return parsePropertyNameWorker(true); } - function parseSimplePropertyName() { - return parsePropertyNameWorker(false); - } - function isSimplePropertyName() { - return token() === 9 || token() === 8 || ts.tokenIsIdentifierOrKeyword(token()); - } function parseComputedPropertyName() { var node = createNode(144); parseExpected(21); @@ -17286,12 +11606,6 @@ var ts; return ts.tokenIsIdentifierOrKeyword(token()) || token() === 17; case 14: return true; - case 23: - case 24: - case 26: - return JSDocParser.isJSDocType(); - case 25: - return isSimplePropertyName(); } ts.Debug.fail("Non-exhaustive case in 'isListElement'."); } @@ -17361,14 +11675,6 @@ var ts; return token() === 29 || token() === 41; case 14: return token() === 27 && lookAhead(nextTokenIsSlash); - case 23: - return token() === 20 || token() === 56 || token() === 18; - case 24: - return token() === 29 || token() === 18; - case 26: - return token() === 22 || token() === 18; - case 25: - return token() === 18; } } function isVariableDeclaratorListTerminator() { @@ -17384,7 +11690,7 @@ var ts; return false; } function isInSomeParsingContext() { - for (var kind = 0; kind < 27; kind++) { + for (var kind = 0; kind < 23; kind++) { if (parsingContext & (1 << kind)) { if (isListElement(kind, true) || isListTerminator(kind)) { return true; @@ -17610,10 +11916,6 @@ var ts; case 22: return ts.Diagnostics.Identifier_expected; case 13: return ts.Diagnostics.Identifier_expected; case 14: return ts.Diagnostics.Identifier_expected; - case 23: return ts.Diagnostics.Parameter_declaration_expected; - case 24: return ts.Diagnostics.Type_argument_expected; - case 26: return ts.Diagnostics.Type_expected; - case 25: return ts.Diagnostics.Property_assignment_expected; } } function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) { @@ -17623,6 +11925,7 @@ var ts; var commaStart = -1; while (true) { if (isListElement(kind, false)) { + var startPos = scanner.getStartPos(); result.push(parseListElement(kind, parseElement)); commaStart = scanner.getTokenPos(); if (parseOptional(26)) { @@ -17636,6 +11939,9 @@ var ts; if (considerSemicolonAsDelimiter && token() === 25 && !scanner.hasPrecedingLineBreak()) { nextToken(); } + if (startPos === scanner.getStartPos()) { + nextToken(); + } continue; } if (isListTerminator(kind)) { @@ -17664,15 +11970,24 @@ var ts; return createMissingList(); } function parseEntityName(allowReservedWords, diagnosticMessage) { - var entity = parseIdentifier(diagnosticMessage); + var entity = allowReservedWords ? parseIdentifierName() : parseIdentifier(diagnosticMessage); + var dotPos = scanner.getStartPos(); while (parseOptional(23)) { - var node = createNode(143, entity.pos); - node.left = entity; - node.right = parseRightSideOfDot(allowReservedWords); - entity = finishNode(node); + if (token() === 27) { + entity.jsdocDotPos = dotPos; + break; + } + dotPos = scanner.getStartPos(); + entity = createQualifiedName(entity, parseRightSideOfDot(allowReservedWords)); } return entity; } + function createQualifiedName(entity, name) { + var node = createNode(143, entity.pos); + node.left = entity; + node.right = name; + return finishNode(node); + } function parseRightSideOfDot(allowIdentifierNames) { if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token())) { var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -17708,23 +12023,23 @@ var ts; span.literal = literal; return finishNode(span); } - function parseLiteralNode(internName) { - return parseLiteralLikeNode(token(), internName); + function parseLiteralNode() { + return parseLiteralLikeNode(token()); } function parseTemplateHead() { - var fragment = parseLiteralLikeNode(token(), false); + var fragment = parseLiteralLikeNode(token()); ts.Debug.assert(fragment.kind === 14, "Template head has wrong token kind"); return fragment; } function parseTemplateMiddleOrTemplateTail() { - var fragment = parseLiteralLikeNode(token(), false); + var fragment = parseLiteralLikeNode(token()); ts.Debug.assert(fragment.kind === 15 || fragment.kind === 16, "Template fragment has wrong token kind"); return fragment; } - function parseLiteralLikeNode(kind, internName) { + function parseLiteralLikeNode(kind) { var node = createNode(kind); var text = scanner.getTokenValue(); - node.text = internName ? internIdentifier(text) : text; + node.text = text; if (scanner.hasExtendedUnicodeEscape()) { node.hasExtendedUnicodeEscape = true; } @@ -17740,7 +12055,7 @@ var ts; } function parseTypeReference() { var node = createNode(159); - node.typeName = parseEntityName(false, ts.Diagnostics.Type_expected); + node.typeName = parseEntityName(!!(contextFlags & 1048576), ts.Diagnostics.Type_expected); if (!scanner.hasPrecedingLineBreak() && token() === 27) { node.typeArguments = parseBracketedList(19, parseType, 27, 29); } @@ -17758,6 +12073,55 @@ var ts; nextToken(); return finishNode(node); } + function parseJSDocAllType() { + var result = createNode(268); + nextToken(); + return finishNode(result); + } + function parseJSDocUnknownOrNullableType() { + var pos = scanner.getStartPos(); + nextToken(); + if (token() === 26 || + token() === 18 || + token() === 20 || + token() === 29 || + token() === 58 || + token() === 49) { + var result = createNode(269, pos); + return finishNode(result); + } + else { + var result = createNode(270, pos); + result.type = parseType(); + return finishNode(result); + } + } + function parseJSDocFunctionType() { + if (lookAhead(nextTokenIsOpenParen)) { + var result = createNode(273); + nextToken(); + fillSignature(56, 4 | 32, result); + return finishNode(result); + } + var node = createNode(159); + node.typeName = parseIdentifierName(); + return finishNode(node); + } + function parseJSDocParameter() { + var parameter = createNode(146); + if (token() === 99 || token() === 94) { + parameter.name = parseIdentifierName(); + parseExpected(56); + } + parameter.type = parseType(); + return finishNode(parameter); + } + function parseJSDocNodeWithType(kind) { + var result = createNode(kind); + nextToken(); + result.type = parseType(); + return finishNode(result); + } function parseTypeQuery() { var node = createNode(162); parseExpected(103); @@ -17792,9 +12156,13 @@ var ts; return undefined; } function isStartOfParameter() { - return token() === 24 || isIdentifierOrPattern() || ts.isModifierKind(token()) || token() === 57 || token() === 99; + return token() === 24 || + isIdentifierOrPattern() || + ts.isModifierKind(token()) || + token() === 57 || + isStartOfType(true); } - function parseParameter() { + function parseParameter(requireEqualsToken) { var node = createNode(146); if (token() === 99) { node.name = createIdentifier(true); @@ -17810,19 +12178,15 @@ var ts; } node.questionToken = parseOptionalToken(55); node.type = parseParameterType(); - node.initializer = parseBindingElementInitializer(true); + node.initializer = parseInitializer(true, requireEqualsToken); return addJSDocComment(finishNode(node)); } - function parseBindingElementInitializer(inParameter) { - return inParameter ? parseParameterInitializer() : parseNonParameterInitializer(); - } - function parseParameterInitializer() { - return parseInitializer(true); - } - function fillSignature(returnToken, yieldContext, awaitContext, requireCompleteParameterList, signature) { + function fillSignature(returnToken, flags, signature) { + if (!(flags & 32)) { + signature.typeParameters = parseTypeParameters(); + } + signature.parameters = parseParameterList(flags); var returnTokenRequired = returnToken === 36; - signature.typeParameters = parseTypeParameters(); - signature.parameters = parseParameterList(yieldContext, awaitContext, requireCompleteParameterList); if (returnTokenRequired) { parseExpected(returnToken); signature.type = parseTypeOrTypePredicate(); @@ -17830,22 +12194,31 @@ var ts; else if (parseOptional(returnToken)) { signature.type = parseTypeOrTypePredicate(); } + else if (flags & 4) { + var start = scanner.getTokenPos(); + var length_1 = scanner.getTextPos() - start; + var backwardToken = parseOptional(returnToken === 56 ? 36 : 56); + if (backwardToken) { + signature.type = parseTypeOrTypePredicate(); + parseErrorAtPosition(start, length_1, ts.Diagnostics._0_expected, ts.tokenToString(returnToken)); + } + } } - function parseParameterList(yieldContext, awaitContext, requireCompleteParameterList) { + function parseParameterList(flags) { if (parseExpected(19)) { var savedYieldContext = inYieldContext(); var savedAwaitContext = inAwaitContext(); - setYieldContext(yieldContext); - setAwaitContext(awaitContext); - var result = parseDelimitedList(16, parseParameter); + setYieldContext(!!(flags & 1)); + setAwaitContext(!!(flags & 2)); + var result = parseDelimitedList(16, flags & 32 ? parseJSDocParameter : function () { return parseParameter(!!(flags & 8)); }); setYieldContext(savedYieldContext); setAwaitContext(savedAwaitContext); - if (!parseExpected(20) && requireCompleteParameterList) { + if (!parseExpected(20) && (flags & 8)) { return undefined; } return result; } - return requireCompleteParameterList ? undefined : createMissingList(); + return (flags & 8) ? undefined : createMissingList(); } function parseTypeMemberSemicolon() { if (parseOptional(26)) { @@ -17858,7 +12231,7 @@ var ts; if (kind === 156) { parseExpected(94); } - fillSignature(56, false, false, false, node); + fillSignature(56, 4, node); parseTypeMemberSemicolon(); return addJSDocComment(finishNode(node)); } @@ -17911,7 +12284,7 @@ var ts; method.modifiers = modifiers; method.name = name; method.questionToken = questionToken; - fillSignature(56, false, false, false, method); + fillSignature(56, 4, method); parseTypeMemberSemicolon(); return addJSDocComment(finishNode(method)); } @@ -18032,18 +12405,38 @@ var ts; if (kind === 161) { parseExpected(94); } - fillSignature(36, false, false, false, node); + fillSignature(36, 4, node); return finishNode(node); } function parseKeywordAndNoDot() { var node = parseTokenNode(); return token() === 23 ? undefined : node; } - function parseLiteralTypeNode() { + function parseLiteralTypeNode(negative) { var node = createNode(173); - node.literal = parseSimpleUnaryExpression(); - finishNode(node); - return node; + var unaryMinusExpression; + if (negative) { + unaryMinusExpression = createNode(192); + unaryMinusExpression.operator = 38; + nextToken(); + } + var expression; + switch (token()) { + case 9: + case 8: + expression = parseLiteralLikeNode(token()); + break; + case 101: + case 86: + expression = parseTokenNode(); + } + if (negative) { + unaryMinusExpression.operand = expression; + finishNode(unaryMinusExpression); + expression = unaryMinusExpression; + } + node.literal = expression; + return finishNode(node); } function nextTokenIsNumericLiteral() { return nextToken() === 8; @@ -18058,15 +12451,24 @@ var ts; case 139: case 130: case 134: - var node = tryParse(parseKeywordAndNoDot); - return node || parseTypeReference(); + return tryParse(parseKeywordAndNoDot) || parseTypeReference(); + case 39: + return parseJSDocAllType(); + case 55: + return parseJSDocUnknownOrNullableType(); + case 89: + return parseJSDocFunctionType(); + case 24: + return parseJSDocNodeWithType(274); + case 51: + return parseJSDocNodeWithType(271); case 9: case 8: case 101: case 86: return parseLiteralTypeNode(); case 38: - return lookAhead(nextTokenIsNumericLiteral) ? parseLiteralTypeNode() : parseTypeReference(); + return lookAhead(nextTokenIsNumericLiteral) ? parseLiteralTypeNode(true) : parseTypeReference(); case 105: case 95: return parseTokenNode(); @@ -18091,7 +12493,7 @@ var ts; return parseTypeReference(); } } - function isStartOfType() { + function isStartOfType(inStartOfParameter) { switch (token()) { case 119: case 136: @@ -18115,11 +12517,12 @@ var ts; case 101: case 86: case 134: + case 39: return true; case 38: - return lookAhead(nextTokenIsNumericLiteral); + return !inStartOfParameter && lookAhead(nextTokenIsNumericLiteral); case 19: - return lookAhead(isStartOfParenthesizedOrFunctionType); + return !inStartOfParameter && lookAhead(isStartOfParenthesizedOrFunctionType); default: return isIdentifier(); } @@ -18128,8 +12531,28 @@ var ts; nextToken(); return token() === 20 || isStartOfParameter() || isStartOfType(); } - function parseArrayTypeOrHigher() { + function parseJSDocPostfixTypeOrHigher() { var type = parseNonArrayType(); + var kind = getKind(token()); + if (!kind) + return type; + nextToken(); + var postfix = createNode(kind, type.pos); + postfix.type = type; + return finishNode(postfix); + function getKind(tokenKind) { + switch (tokenKind) { + case 58: + return contextFlags & 1048576 ? 272 : undefined; + case 51: + return 271; + case 55: + return 270; + } + } + } + function parseArrayTypeOrHigher() { + var type = parseJSDocPostfixTypeOrHigher(); while (!scanner.hasPrecedingLineBreak() && parseOptional(21)) { if (isStartOfType()) { var node = createNode(171, type.pos); @@ -18331,11 +12754,16 @@ var ts; } return expr; } - function parseInitializer(inParameter) { + function parseInitializer(inParameter, requireEqualsToken) { if (token() !== 58) { if (scanner.hasPrecedingLineBreak() || (inParameter && token() === 17) || !isStartOfExpression()) { return undefined; } + if (inParameter && requireEqualsToken) { + var result = createMissingNode(71, true, ts.Diagnostics._0_expected, "="); + result.escapedText = "= not found"; + return result; + } } parseExpected(58); return parseAssignmentExpressionOrHigher(); @@ -18362,7 +12790,7 @@ var ts; if (inYieldContext()) { return true; } - return lookAhead(nextTokenIsIdentifierOrKeywordOrNumberOnSameLine); + return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine); } return false; } @@ -18413,7 +12841,7 @@ var ts; if (!arrowFunction) { return undefined; } - var isAsync = !!(ts.getModifierFlags(arrowFunction) & 256); + var isAsync = ts.hasModifier(arrowFunction, 256); var lastToken = token(); arrowFunction.equalsGreaterThanToken = parseExpectedToken(36, false, ts.Diagnostics._0_expected, "=>"); arrowFunction.body = (lastToken === 36 || lastToken === 17) @@ -18504,8 +12932,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression() { if (token() === 120) { - var isUnParenthesizedAsyncArrowFunction = lookAhead(isUnParenthesizedAsyncArrowFunctionWorker); - if (isUnParenthesizedAsyncArrowFunction === 1) { + if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1) { var asyncModifier = parseModifiersForArrowFunction(); var expr = parseBinaryExpressionOrHigher(0); return parseSimpleArrowFunctionExpression(expr, asyncModifier); @@ -18529,26 +12956,27 @@ var ts; function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) { var node = createNode(187); node.modifiers = parseModifiersForArrowFunction(); - var isAsync = !!(ts.getModifierFlags(node) & 256); - fillSignature(56, false, isAsync, !allowAmbiguity, node); + var isAsync = ts.hasModifier(node, 256) ? 2 : 0; + fillSignature(56, isAsync | (allowAmbiguity ? 0 : 8), node); if (!node.parameters) { return undefined; } - if (!allowAmbiguity && token() !== 36 && token() !== 17) { + if (!allowAmbiguity && ((token() !== 36 && token() !== 17) || + ts.find(node.parameters, function (p) { return p.initializer && ts.isIdentifier(p.initializer) && p.initializer.escapedText === "= not found"; }))) { return undefined; } return node; } function parseArrowFunctionExpressionBody(isAsync) { if (token() === 17) { - return parseFunctionBlock(false, isAsync, false); + return parseFunctionBlock(isAsync ? 2 : 0); } if (token() !== 25 && token() !== 89 && token() !== 75 && isStartOfStatement() && !isStartOfExpressionStatement()) { - return parseFunctionBlock(false, isAsync, true); + return parseFunctionBlock(16 | (isAsync ? 2 : 0)); } return isAsync ? doInAwaitContext(parseAssignmentExpressionOrHigher) @@ -18692,7 +13120,7 @@ var ts; if (inAwaitContext()) { return true; } - return lookAhead(nextTokenIsIdentifierOnSameLine); + return lookAhead(nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine); } return false; } @@ -18817,12 +13245,12 @@ var ts; return false; } if (lhs.kind === 71) { - return lhs.text === rhs.text; + return lhs.escapedText === rhs.escapedText; } if (lhs.kind === 99) { return true; } - return lhs.name.text === rhs.name.text && + return lhs.name.escapedText === rhs.name.escapedText && tagNamesAreEquivalent(lhs.expression, rhs.expression); } function parseJsxElementOrSelfClosingElement(inExpressionContext) { @@ -19164,7 +13592,7 @@ var ts; parseExpected(19); node.expression = allowInAnd(parseExpression); parseExpected(20); - return finishNode(node); + return addJSDocComment(finishNode(node)); } function parseSpreadElement() { var node = createNode(198); @@ -19261,15 +13689,15 @@ var ts; node.modifiers = parseModifiers(); parseExpected(89); node.asteriskToken = parseOptionalToken(39); - var isGenerator = !!node.asteriskToken; - var isAsync = !!(ts.getModifierFlags(node) & 256); + var isGenerator = node.asteriskToken ? 1 : 0; + var isAsync = ts.hasModifier(node, 256) ? 2 : 0; node.name = isGenerator && isAsync ? doInYieldAndAwaitContext(parseOptionalIdentifier) : isGenerator ? doInYieldContext(parseOptionalIdentifier) : isAsync ? doInAwaitContext(parseOptionalIdentifier) : parseOptionalIdentifier(); - fillSignature(56, isGenerator, isAsync, false, node); - node.body = parseFunctionBlock(isGenerator, isAsync, false); + fillSignature(56, isGenerator | isAsync, node); + node.body = parseFunctionBlock(isGenerator | isAsync); if (saveDecoratorContext) { setDecoratorContext(true); } @@ -19309,16 +13737,16 @@ var ts; } return finishNode(node); } - function parseFunctionBlock(allowYield, allowAwait, ignoreMissingOpenBrace, diagnosticMessage) { + function parseFunctionBlock(flags, diagnosticMessage) { var savedYieldContext = inYieldContext(); - setYieldContext(allowYield); + setYieldContext(!!(flags & 1)); var savedAwaitContext = inAwaitContext(); - setAwaitContext(allowAwait); + setAwaitContext(!!(flags & 2)); var saveDecoratorContext = inDecoratorContext(); if (saveDecoratorContext) { setDecoratorContext(false); } - var block = parseBlock(ignoreMissingOpenBrace, diagnosticMessage); + var block = parseBlock(!!(flags & 16), diagnosticMessage); if (saveDecoratorContext) { setDecoratorContext(true); } @@ -19487,10 +13915,13 @@ var ts; function parseCatchClause() { var result = createNode(260); parseExpected(74); - if (parseExpected(19)) { + if (parseOptional(19)) { result.variableDeclaration = parseVariableDeclaration(); + parseExpected(20); + } + else { + result.variableDeclaration = undefined; } - parseExpected(20); result.block = parseBlock(false); return finishNode(result); } @@ -19528,9 +13959,9 @@ var ts; nextToken(); return token() === 89 && !scanner.hasPrecedingLineBreak(); } - function nextTokenIsIdentifierOrKeywordOrNumberOnSameLine() { + function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() { nextToken(); - return (ts.tokenIsIdentifierOrKeyword(token()) || token() === 8) && !scanner.hasPrecedingLineBreak(); + return (ts.tokenIsIdentifierOrKeyword(token()) || token() === 8 || token() === 9) && !scanner.hasPrecedingLineBreak(); } function isDeclaration() { while (true) { @@ -19760,12 +14191,12 @@ var ts; nextToken(); return !scanner.hasPrecedingLineBreak() && (isIdentifier() || token() === 9); } - function parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage) { + function parseFunctionBlockOrSemicolon(flags, diagnosticMessage) { if (token() !== 17 && canParseSemicolon()) { parseSemicolon(); return; } - return parseFunctionBlock(isGenerator, isAsync, false, diagnosticMessage); + return parseFunctionBlock(flags, diagnosticMessage); } function parseArrayBindingElement() { if (token() === 26) { @@ -19774,7 +14205,7 @@ var ts; var node = createNode(176); node.dotDotDotToken = parseOptionalToken(24); node.name = parseIdentifierOrPattern(); - node.initializer = parseBindingElementInitializer(false); + node.initializer = parseInitializer(false); return finishNode(node); } function parseObjectBindingElement() { @@ -19790,7 +14221,7 @@ var ts; node.propertyName = propertyName; node.name = parseIdentifierOrPattern(); } - node.initializer = parseBindingElementInitializer(false); + node.initializer = parseInitializer(false); return finishNode(node); } function parseObjectBindingPattern() { @@ -19824,7 +14255,7 @@ var ts; node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); if (!isInOrOfKeyword(token())) { - node.initializer = parseInitializer(false); + node.initializer = parseNonParameterInitializer(); } return finishNode(node); } @@ -19872,10 +14303,10 @@ var ts; parseExpected(89); node.asteriskToken = parseOptionalToken(39); node.name = ts.hasModifier(node, 512) ? parseOptionalIdentifier() : parseIdentifier(); - var isGenerator = !!node.asteriskToken; - var isAsync = ts.hasModifier(node, 256); - fillSignature(56, isGenerator, isAsync, false, node); - node.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, ts.Diagnostics.or_expected); + var isGenerator = node.asteriskToken ? 1 : 0; + var isAsync = ts.hasModifier(node, 256) ? 2 : 0; + fillSignature(56, isGenerator | isAsync, node); + node.body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, ts.Diagnostics.or_expected); return addJSDocComment(finishNode(node)); } function parseConstructorDeclaration(pos, decorators, modifiers) { @@ -19883,8 +14314,8 @@ var ts; node.decorators = decorators; node.modifiers = modifiers; parseExpected(123); - fillSignature(56, false, false, false, node); - node.body = parseFunctionBlockOrSemicolon(false, false, ts.Diagnostics.or_expected); + fillSignature(56, 0, node); + node.body = parseFunctionBlockOrSemicolon(0, ts.Diagnostics.or_expected); return addJSDocComment(finishNode(node)); } function parseMethodDeclaration(fullStart, decorators, modifiers, asteriskToken, name, questionToken, diagnosticMessage) { @@ -19894,10 +14325,10 @@ var ts; method.asteriskToken = asteriskToken; method.name = name; method.questionToken = questionToken; - var isGenerator = !!asteriskToken; - var isAsync = ts.hasModifier(method, 256); - fillSignature(56, isGenerator, isAsync, false, method); - method.body = parseFunctionBlockOrSemicolon(isGenerator, isAsync, diagnosticMessage); + var isGenerator = asteriskToken ? 1 : 0; + var isAsync = ts.hasModifier(method, 256) ? 2 : 0; + fillSignature(56, isGenerator | isAsync, method); + method.body = parseFunctionBlockOrSemicolon(isGenerator | isAsync, diagnosticMessage); return addJSDocComment(finishNode(method)); } function parsePropertyDeclaration(fullStart, decorators, modifiers, name, questionToken) { @@ -19932,8 +14363,8 @@ var ts; node.decorators = decorators; node.modifiers = modifiers; node.name = parsePropertyName(); - fillSignature(56, false, false, false, node); - node.body = parseFunctionBlockOrSemicolon(false, false); + fillSignature(56, 0, node); + node.body = parseFunctionBlockOrSemicolon(0); return addJSDocComment(finishNode(node)); } function isClassMemberModifier(idToken) { @@ -20219,7 +14650,8 @@ var ts; node.flags |= 512; } else { - node.name = parseLiteralNode(true); + node.name = parseLiteralNode(); + node.name.text = internIdentifier(node.name.text); } if (token() === 17) { node.body = parseModuleBlock(); @@ -20325,7 +14757,7 @@ var ts; function parseModuleSpecifier() { if (token() === 9) { var result = parseLiteralNode(); - internIdentifier(result.text); + result.text = internIdentifier(result.text); return result; } else { @@ -20518,11 +14950,7 @@ var ts; ParsingContext[ParsingContext["TupleElementTypes"] = 20] = "TupleElementTypes"; ParsingContext[ParsingContext["HeritageClauses"] = 21] = "HeritageClauses"; ParsingContext[ParsingContext["ImportOrExportSpecifiers"] = 22] = "ImportOrExportSpecifiers"; - ParsingContext[ParsingContext["JSDocFunctionParameters"] = 23] = "JSDocFunctionParameters"; - ParsingContext[ParsingContext["JSDocTypeArguments"] = 24] = "JSDocTypeArguments"; - ParsingContext[ParsingContext["JSDocRecordMembers"] = 25] = "JSDocRecordMembers"; - ParsingContext[ParsingContext["JSDocTupleTypes"] = 26] = "JSDocTupleTypes"; - ParsingContext[ParsingContext["Count"] = 27] = "Count"; + ParsingContext[ParsingContext["Count"] = 23] = "Count"; })(ParsingContext || (ParsingContext = {})); var Tristate; (function (Tristate) { @@ -20532,23 +14960,6 @@ var ts; })(Tristate || (Tristate = {})); var JSDocParser; (function (JSDocParser) { - function isJSDocType() { - switch (token()) { - case 39: - case 55: - case 19: - case 21: - case 51: - case 17: - case 89: - case 24: - case 94: - case 99: - return true; - } - return ts.tokenIsIdentifierOrKeyword(token()); - } - JSDocParser.isJSDocType = isJSDocType; function parseJSDocTypeExpressionForTests(content, start, length) { initializeState(content, 5, undefined, 1); sourceFile = createSourceFile("file.js", 5, 1); @@ -20563,248 +14974,12 @@ var ts; function parseJSDocTypeExpression() { var result = createNode(267, scanner.getTokenPos()); parseExpected(17); - result.type = parseJSDocTopLevelType(); + result.type = doInsideOfContext(1048576, parseType); parseExpected(18); fixupParentReferences(result); return finishNode(result); } JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression; - function parseJSDocTopLevelType() { - var type = parseJSDocType(); - if (token() === 49) { - var unionType = createNode(271, type.pos); - unionType.types = parseJSDocTypeList(type); - type = finishNode(unionType); - } - if (token() === 58) { - var optionalType = createNode(278, type.pos); - nextToken(); - optionalType.type = type; - type = finishNode(optionalType); - } - return type; - } - function parseJSDocType() { - var type = parseBasicTypeExpression(); - while (true) { - if (token() === 21) { - var arrayType = createNode(270, type.pos); - arrayType.elementType = type; - nextToken(); - parseExpected(22); - type = finishNode(arrayType); - } - else if (token() === 55) { - var nullableType = createNode(273, type.pos); - nullableType.type = type; - nextToken(); - type = finishNode(nullableType); - } - else if (token() === 51) { - var nonNullableType = createNode(274, type.pos); - nonNullableType.type = type; - nextToken(); - type = finishNode(nonNullableType); - } - else { - break; - } - } - return type; - } - function parseBasicTypeExpression() { - switch (token()) { - case 39: - return parseJSDocAllType(); - case 55: - return parseJSDocUnknownOrNullableType(); - case 19: - return parseJSDocUnionType(); - case 21: - return parseJSDocTupleType(); - case 51: - return parseJSDocNonNullableType(); - case 17: - return parseJSDocRecordType(); - case 89: - if (lookAhead(nextTokenIsOpenParen)) { - return parseJSDocFunctionType(); - } - break; - case 24: - return parseJSDocVariadicType(); - case 94: - return parseJSDocConstructorType(); - case 99: - return parseJSDocThisType(); - case 119: - case 136: - case 133: - case 122: - case 137: - case 105: - case 95: - case 139: - case 130: - return parseTokenNode(); - case 9: - case 8: - case 101: - case 86: - return parseJSDocLiteralType(); - } - return parseJSDocTypeReference(); - } - function parseJSDocThisType() { - var result = createNode(282); - nextToken(); - parseExpected(56); - result.type = parseJSDocType(); - return finishNode(result); - } - function parseJSDocConstructorType() { - var result = createNode(281); - nextToken(); - parseExpected(56); - result.type = parseJSDocType(); - return finishNode(result); - } - function parseJSDocVariadicType() { - var result = createNode(280); - nextToken(); - result.type = parseJSDocType(); - return finishNode(result); - } - function parseJSDocFunctionType() { - var result = createNode(279); - nextToken(); - parseExpected(19); - result.parameters = parseDelimitedList(23, parseJSDocParameter); - checkForTrailingComma(result.parameters); - parseExpected(20); - if (token() === 56) { - nextToken(); - result.type = parseJSDocType(); - } - return finishNode(result); - } - function parseJSDocParameter() { - var parameter = createNode(146); - parameter.type = parseJSDocType(); - if (parseOptional(58)) { - parameter.questionToken = createNode(58); - } - return finishNode(parameter); - } - function parseJSDocTypeReference() { - var result = createNode(277); - result.name = parseSimplePropertyName(); - if (token() === 27) { - result.typeArguments = parseTypeArguments(); - } - else { - while (parseOptional(23)) { - if (token() === 27) { - result.typeArguments = parseTypeArguments(); - break; - } - else { - result.name = parseQualifiedName(result.name); - } - } - } - return finishNode(result); - } - function parseTypeArguments() { - nextToken(); - var typeArguments = parseDelimitedList(24, parseJSDocType); - checkForTrailingComma(typeArguments); - checkForEmptyTypeArgumentList(typeArguments); - parseExpected(29); - return typeArguments; - } - function checkForEmptyTypeArgumentList(typeArguments) { - if (parseDiagnostics.length === 0 && typeArguments && typeArguments.length === 0) { - var start = typeArguments.pos - "<".length; - var end = ts.skipTrivia(sourceText, typeArguments.end) + ">".length; - return parseErrorAtPosition(start, end - start, ts.Diagnostics.Type_argument_list_cannot_be_empty); - } - } - function parseQualifiedName(left) { - var result = createNode(143, left.pos); - result.left = left; - result.right = parseIdentifierName(); - return finishNode(result); - } - function parseJSDocRecordType() { - var result = createNode(275); - result.literal = parseTypeLiteral(); - return finishNode(result); - } - function parseJSDocNonNullableType() { - var result = createNode(274); - nextToken(); - result.type = parseJSDocType(); - return finishNode(result); - } - function parseJSDocTupleType() { - var result = createNode(272); - nextToken(); - result.types = parseDelimitedList(26, parseJSDocType); - checkForTrailingComma(result.types); - parseExpected(22); - return finishNode(result); - } - function checkForTrailingComma(list) { - if (parseDiagnostics.length === 0 && list.hasTrailingComma) { - var start = list.end - ",".length; - parseErrorAtPosition(start, ",".length, ts.Diagnostics.Trailing_comma_not_allowed); - } - } - function parseJSDocUnionType() { - var result = createNode(271); - nextToken(); - result.types = parseJSDocTypeList(parseJSDocType()); - parseExpected(20); - return finishNode(result); - } - function parseJSDocTypeList(firstType) { - ts.Debug.assert(!!firstType); - var types = createNodeArray([firstType], firstType.pos); - while (parseOptional(49)) { - types.push(parseJSDocType()); - } - types.end = scanner.getStartPos(); - return types; - } - function parseJSDocAllType() { - var result = createNode(268); - nextToken(); - return finishNode(result); - } - function parseJSDocLiteralType() { - var result = createNode(294); - result.literal = parseLiteralTypeNode(); - return finishNode(result); - } - function parseJSDocUnknownOrNullableType() { - var pos = scanner.getStartPos(); - nextToken(); - if (token() === 26 || - token() === 18 || - token() === 20 || - token() === 29 || - token() === 58 || - token() === 49) { - var result = createNode(269, pos); - return finishNode(result); - } - else { - var result = createNode(273, pos); - result.type = parseJSDocType(); - return finishNode(result); - } - } function parseIsolatedJSDocComment(content, start, length) { initializeState(content, 5, undefined, 1); sourceFile = { languageVariant: 0, text: content }; @@ -20841,6 +15016,11 @@ var ts; JSDocState[JSDocState["SawAsterisk"] = 1] = "SawAsterisk"; JSDocState[JSDocState["SavingComments"] = 2] = "SavingComments"; })(JSDocState || (JSDocState = {})); + var PropertyLikeParse; + (function (PropertyLikeParse) { + PropertyLikeParse[PropertyLikeParse["Property"] = 0] = "Property"; + PropertyLikeParse[PropertyLikeParse["Parameter"] = 1] = "Parameter"; + })(PropertyLikeParse || (PropertyLikeParse = {})); function parseJSDocCommentWorker(start, length) { var content = sourceText; start = start || 0; @@ -20957,7 +15137,7 @@ var ts; content.charCodeAt(start + 3) !== 42; } function createJSDocComment() { - var result = createNode(283, start); + var result = createNode(275, start); result.tags = tags; result.comment = comments.length ? comments.join("") : undefined; return finishNode(result, end); @@ -20979,7 +15159,7 @@ var ts; } var tag; if (tagName) { - switch (tagName.text) { + switch (tagName.escapedText) { case "augments": tag = parseAugmentsTag(atToken, tagName); break; @@ -20990,7 +15170,7 @@ var ts; case "arg": case "argument": case "param": - tag = parseParameterOrPropertyTag(atToken, tagName, true); + tag = parseParameterOrPropertyTag(atToken, tagName, 1); break; case "return": case "returns": @@ -21073,7 +15253,7 @@ var ts; return comments; } function parseUnknownTag(atToken, tagName) { - var result = createNode(284, atToken.pos); + var result = createNode(276, atToken.pos); result.atToken = atToken; result.tagName = tagName; return finishNode(result); @@ -21099,7 +15279,7 @@ var ts; } function parseBracketNameInPropertyAndParamTag() { var isBracketed = parseOptional(21); - var name = parseJSDocIdentifierName(true); + var name = parseJSDocEntityName(); if (isBracketed) { skipWhitespace(); if (parseOptionalToken(58)) { @@ -21109,48 +15289,80 @@ var ts; } return { name: name, isBracketed: isBracketed }; } - function parseParameterOrPropertyTag(atToken, tagName, shouldParseParamTag) { + function isObjectOrObjectArrayTypeReference(node) { + switch (node.kind) { + case 134: + return true; + case 164: + return isObjectOrObjectArrayTypeReference(node.elementType); + default: + return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object"; + } + } + function parseParameterOrPropertyTag(atToken, tagName, target) { var typeExpression = tryParseTypeExpression(); + var isNameFirst = !typeExpression; skipWhitespace(); var _a = parseBracketNameInPropertyAndParamTag(), name = _a.name, isBracketed = _a.isBracketed; skipWhitespace(); - var preName, postName; - if (typeExpression) { - postName = name; - } - else { - preName = name; - } - if (!typeExpression) { + if (isNameFirst) { typeExpression = tryParseTypeExpression(); } - var result = shouldParseParamTag ? - createNode(287, atToken.pos) : - createNode(292, atToken.pos); + var result = target === 1 ? + createNode(279, atToken.pos) : + createNode(284, atToken.pos); + var nestedTypeLiteral = parseNestedTypeLiteral(typeExpression, name); + if (nestedTypeLiteral) { + typeExpression = nestedTypeLiteral; + isNameFirst = true; + } result.atToken = atToken; result.tagName = tagName; - result.preParameterName = preName; result.typeExpression = typeExpression; - result.postParameterName = postName; - result.name = postName || preName; + result.name = name; + result.isNameFirst = isNameFirst; result.isBracketed = isBracketed; return finishNode(result); } + function parseNestedTypeLiteral(typeExpression, name) { + if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) { + var typeLiteralExpression = createNode(267, scanner.getTokenPos()); + var child = void 0; + var jsdocTypeLiteral = void 0; + var start_2 = scanner.getStartPos(); + var children = void 0; + while (child = tryParse(function () { return parseChildParameterOrPropertyTag(1, name); })) { + if (!children) { + children = []; + } + children.push(child); + } + if (children) { + jsdocTypeLiteral = createNode(285, start_2); + jsdocTypeLiteral.jsDocPropertyTags = children; + if (typeExpression.type.kind === 164) { + jsdocTypeLiteral.isArrayType = true; + } + typeLiteralExpression.type = finishNode(jsdocTypeLiteral); + return finishNode(typeLiteralExpression); + } + } + } function parseReturnTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 288; })) { - parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 280; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(288, atToken.pos); + var result = createNode(280, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); return finishNode(result); } function parseTypeTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 289; })) { - parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 281; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } - var result = createNode(289, atToken.pos); + var result = createNode(281, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = tryParseTypeExpression(); @@ -21158,14 +15370,14 @@ var ts; } function parseAugmentsTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); - var result = createNode(285, atToken.pos); + var result = createNode(277, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeExpression = typeExpression; return finishNode(result); } function parseClassTag(atToken, tagName) { - var tag = createNode(286, atToken.pos); + var tag = createNode(278, atToken.pos); tag.atToken = atToken; tag.tagName = tagName; return finishNode(tag); @@ -21173,7 +15385,7 @@ var ts; function parseTypedefTag(atToken, tagName) { var typeExpression = tryParseTypeExpression(); skipWhitespace(); - var typedefTag = createNode(291, atToken.pos); + var typedefTag = createNode(283, atToken.pos); typedefTag.atToken = atToken; typedefTag.tagName = tagName; typedefTag.fullName = parseJSDocTypeNameWithNamespace(0); @@ -21187,65 +15399,42 @@ var ts; rightNode = rightNode.body; } } - typedefTag.typeExpression = typeExpression; skipWhitespace(); - if (typeExpression) { - if (typeExpression.type.kind === 277) { - var jsDocTypeReference = typeExpression.type; - if (jsDocTypeReference.name.kind === 71) { - var name = jsDocTypeReference.name; - if (name.text === "Object" || name.text === "object") { - typedefTag.jsDocTypeLiteral = scanChildTags(); + typedefTag.typeExpression = typeExpression; + if (!typeExpression || isObjectOrObjectArrayTypeReference(typeExpression.type)) { + var child = void 0; + var jsdocTypeLiteral = void 0; + var childTypeTag = void 0; + var start_3 = scanner.getStartPos(); + while (child = tryParse(function () { return parseChildParameterOrPropertyTag(0); })) { + if (!jsdocTypeLiteral) { + jsdocTypeLiteral = createNode(285, start_3); + } + if (child.kind === 281) { + if (childTypeTag) { + break; + } + else { + childTypeTag = child; } } + else { + if (!jsdocTypeLiteral.jsDocPropertyTags) { + jsdocTypeLiteral.jsDocPropertyTags = []; + } + jsdocTypeLiteral.jsDocPropertyTags.push(child); + } } - if (!typedefTag.jsDocTypeLiteral) { - typedefTag.jsDocTypeLiteral = typeExpression.type; - } - } - else { - typedefTag.jsDocTypeLiteral = scanChildTags(); - } - return finishNode(typedefTag); - function scanChildTags() { - var jsDocTypeLiteral = createNode(293, scanner.getStartPos()); - var resumePos = scanner.getStartPos(); - var canParseTag = true; - var seenAsterisk = false; - var parentTagTerminated = false; - while (token() !== 1 && !parentTagTerminated) { - nextJSDocToken(); - switch (token()) { - case 57: - if (canParseTag) { - parentTagTerminated = !tryParseChildTag(jsDocTypeLiteral); - if (!parentTagTerminated) { - resumePos = scanner.getStartPos(); - } - } - seenAsterisk = false; - break; - case 4: - resumePos = scanner.getStartPos() - 1; - canParseTag = true; - seenAsterisk = false; - break; - case 39: - if (seenAsterisk) { - canParseTag = false; - } - seenAsterisk = true; - break; - case 71: - canParseTag = false; - break; - case 1: - break; + if (jsdocTypeLiteral) { + if (typeExpression && typeExpression.type.kind === 164) { + jsdocTypeLiteral.isArrayType = true; } + typedefTag.typeExpression = childTypeTag && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? + childTypeTag.typeExpression : + finishNode(jsdocTypeLiteral); } - scanner.setTextPos(resumePos); - return finishNode(jsDocTypeLiteral); } + return finishNode(typedefTag); function parseJSDocTypeNameWithNamespace(flags) { var pos = scanner.getTokenPos(); var typeNameOrNamespaceName = parseJSDocIdentifierName(); @@ -21262,7 +15451,54 @@ var ts; return typeNameOrNamespaceName; } } - function tryParseChildTag(parentTag) { + function escapedTextsEqual(a, b) { + while (!ts.isIdentifier(a) || !ts.isIdentifier(b)) { + if (!ts.isIdentifier(a) && !ts.isIdentifier(b) && a.right.escapedText === b.right.escapedText) { + a = a.left; + b = b.left; + } + else { + return false; + } + } + return a.escapedText === b.escapedText; + } + function parseChildParameterOrPropertyTag(target, name) { + var canParseTag = true; + var seenAsterisk = false; + while (true) { + nextJSDocToken(); + switch (token()) { + case 57: + if (canParseTag) { + var child = tryParseChildTag(target); + if (child && child.kind === 279 && + (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { + return false; + } + return child; + } + seenAsterisk = false; + break; + case 4: + canParseTag = true; + seenAsterisk = false; + break; + case 39: + if (seenAsterisk) { + canParseTag = false; + } + seenAsterisk = true; + break; + case 71: + canParseTag = false; + break; + case 1: + return false; + } + } + } + function tryParseChildTag(target) { ts.Debug.assert(token() === 57); var atToken = createNode(57, scanner.getStartPos()); atToken.end = scanner.getTextPos(); @@ -21272,30 +15508,22 @@ var ts; if (!tagName) { return false; } - switch (tagName.text) { + switch (tagName.escapedText) { case "type": - if (parentTag.jsDocTypeTag) { - return false; - } - parentTag.jsDocTypeTag = parseTypeTag(atToken, tagName); - return true; + return target === 0 && parseTypeTag(atToken, tagName); case "prop": case "property": - var propertyTag = parseParameterOrPropertyTag(atToken, tagName, false); - if (propertyTag) { - if (!parentTag.jsDocPropertyTags) { - parentTag.jsDocPropertyTags = []; - } - parentTag.jsDocPropertyTags.push(propertyTag); - return true; - } - return false; + return target === 0 && parseParameterOrPropertyTag(atToken, tagName, target); + case "arg": + case "argument": + case "param": + return target === 1 && parseParameterOrPropertyTag(atToken, tagName, target); } return false; } function parseTemplateTag(atToken, tagName) { - if (ts.forEach(tags, function (t) { return t.kind === 290; })) { - parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.text); + if (ts.forEach(tags, function (t) { return t.kind === 282; })) { + parseErrorAtPosition(tagName.pos, scanner.getTokenPos() - tagName.pos, ts.Diagnostics._0_tag_already_specified, tagName.escapedText); } var typeParameters = createNodeArray(); while (true) { @@ -21317,7 +15545,7 @@ var ts; break; } } - var result = createNode(290, atToken.pos); + var result = createNode(282, atToken.pos); result.atToken = atToken; result.tagName = tagName; result.typeParameters = typeParameters; @@ -21328,12 +15556,23 @@ var ts; function nextJSDocToken() { return currentToken = scanner.scanJSDocToken(); } + function parseJSDocEntityName() { + var entity = parseJSDocIdentifierName(true); + if (parseOptional(21)) { + parseExpected(22); + } + while (parseOptional(23)) { + var name = parseJSDocIdentifierName(true); + if (parseOptional(21)) { + parseExpected(22); + } + entity = createQualifiedName(entity, name); + } + return entity; + } function parseJSDocIdentifierName(createIfMissing) { if (createIfMissing === void 0) { createIfMissing = false; } - return createJSDocIdentifier(ts.tokenIsIdentifierOrKeyword(token()), createIfMissing); - } - function createJSDocIdentifier(isIdentifier, createIfMissing) { - if (!isIdentifier) { + if (!ts.tokenIsIdentifierOrKeyword(token())) { if (createIfMissing) { return createMissingNode(71, true, ts.Diagnostics.Identifier_expected); } @@ -21345,7 +15584,7 @@ var ts; var pos = scanner.getTokenPos(); var end = scanner.getTextPos(); var result = createNode(71, pos); - result.text = content.substring(pos, end); + result.escapedText = ts.escapeLeadingUnderscores(content.substring(pos, end)); finishNode(result, end); nextJSDocToken(); return result; @@ -21415,8 +15654,8 @@ var ts; array._children = undefined; array.pos += delta; array.end += delta; - for (var _i = 0, array_9 = array; _i < array_9.length; _i++) { - var node = array_9[_i]; + for (var _i = 0, array_8 = array; _i < array_8.length; _i++) { + var node = array_8[_i]; visitNode(node); } } @@ -21488,8 +15727,8 @@ var ts; array.intersectsChange = true; array._children = undefined; adjustIntersectingElement(array, changeStart, changeRangeOldEnd, changeRangeNewEnd, delta); - for (var _i = 0, array_10 = array; _i < array_10.length; _i++) { - var node = array_10[_i]; + for (var _i = 0, array_9 = array; _i < array_9.length; _i++) { + var node = array_9[_i]; visitNode(node); } return; @@ -21645,6 +15884,2535 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + ts.compileOnSaveCommandLineOption = { name: "compileOnSave", type: "boolean" }; + ts.optionDeclarations = [ + { + name: "help", + shortName: "h", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Print_this_message, + }, + { + name: "help", + shortName: "?", + type: "boolean" + }, + { + name: "all", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Show_all_compiler_options, + }, + { + name: "version", + shortName: "v", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Print_the_compiler_s_version, + }, + { + name: "init", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Initializes_a_TypeScript_project_and_creates_a_tsconfig_json_file, + }, + { + name: "project", + shortName: "p", + type: "string", + isFilePath: true, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + paramType: ts.Diagnostics.FILE_OR_DIRECTORY, + description: ts.Diagnostics.Compile_the_project_given_the_path_to_its_configuration_file_or_to_a_folder_with_a_tsconfig_json, + }, + { + name: "pretty", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Stylize_errors_and_messages_using_color_and_context_experimental + }, + { + name: "watch", + shortName: "w", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Command_line_Options, + description: ts.Diagnostics.Watch_input_files, + }, + { + name: "target", + shortName: "t", + type: ts.createMapFromTemplate({ + "es3": 0, + "es5": 1, + "es6": 2, + "es2015": 2, + "es2016": 3, + "es2017": 4, + "esnext": 5, + }), + paramType: ts.Diagnostics.VERSION, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_ECMAScript_target_version_Colon_ES3_default_ES5_ES2015_ES2016_ES2017_or_ESNEXT, + }, + { + name: "module", + shortName: "m", + type: ts.createMapFromTemplate({ + "none": ts.ModuleKind.None, + "commonjs": ts.ModuleKind.CommonJS, + "amd": ts.ModuleKind.AMD, + "system": ts.ModuleKind.System, + "umd": ts.ModuleKind.UMD, + "es6": ts.ModuleKind.ES2015, + "es2015": ts.ModuleKind.ES2015, + "esnext": ts.ModuleKind.ESNext + }), + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_module_code_generation_Colon_none_commonjs_amd_system_umd_es2015_or_ESNext, + }, + { + name: "lib", + type: "list", + element: { + name: "lib", + type: ts.createMapFromTemplate({ + "es5": "lib.es5.d.ts", + "es6": "lib.es2015.d.ts", + "es2015": "lib.es2015.d.ts", + "es7": "lib.es2016.d.ts", + "es2016": "lib.es2016.d.ts", + "es2017": "lib.es2017.d.ts", + "esnext": "lib.esnext.d.ts", + "dom": "lib.dom.d.ts", + "dom.iterable": "lib.dom.iterable.d.ts", + "webworker": "lib.webworker.d.ts", + "scripthost": "lib.scripthost.d.ts", + "es2015.core": "lib.es2015.core.d.ts", + "es2015.collection": "lib.es2015.collection.d.ts", + "es2015.generator": "lib.es2015.generator.d.ts", + "es2015.iterable": "lib.es2015.iterable.d.ts", + "es2015.promise": "lib.es2015.promise.d.ts", + "es2015.proxy": "lib.es2015.proxy.d.ts", + "es2015.reflect": "lib.es2015.reflect.d.ts", + "es2015.symbol": "lib.es2015.symbol.d.ts", + "es2015.symbol.wellknown": "lib.es2015.symbol.wellknown.d.ts", + "es2016.array.include": "lib.es2016.array.include.d.ts", + "es2017.object": "lib.es2017.object.d.ts", + "es2017.sharedmemory": "lib.es2017.sharedmemory.d.ts", + "es2017.string": "lib.es2017.string.d.ts", + "es2017.intl": "lib.es2017.intl.d.ts", + "esnext.asynciterable": "lib.esnext.asynciterable.d.ts", + }), + }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_library_files_to_be_included_in_the_compilation_Colon + }, + { + name: "allowJs", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Allow_javascript_files_to_be_compiled + }, + { + name: "checkJs", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Report_errors_in_js_files + }, + { + name: "jsx", + type: ts.createMapFromTemplate({ + "preserve": 1, + "react-native": 3, + "react": 2 + }), + paramType: ts.Diagnostics.KIND, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_JSX_code_generation_Colon_preserve_react_native_or_react, + }, + { + name: "declaration", + shortName: "d", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_d_ts_file, + }, + { + name: "sourceMap", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Generates_corresponding_map_file, + }, + { + name: "outFile", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.FILE, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Concatenate_and_emit_output_to_single_file, + }, + { + name: "outDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Redirect_output_structure_to_the_directory, + }, + { + name: "rootDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Specify_the_root_directory_of_input_files_Use_to_control_the_output_directory_structure_with_outDir, + }, + { + name: "removeComments", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_comments_to_output, + }, + { + name: "noEmit", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Do_not_emit_outputs, + }, + { + name: "importHelpers", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Import_emit_helpers_from_tslib + }, + { + name: "downlevelIteration", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3 + }, + { + name: "isolatedModules", + type: "boolean", + category: ts.Diagnostics.Basic_Options, + description: ts.Diagnostics.Transpile_each_file_as_a_separate_module_similar_to_ts_transpileModule + }, + { + name: "strict", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_all_strict_type_checking_options + }, + { + name: "noImplicitAny", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_expressions_and_declarations_with_an_implied_any_type, + }, + { + name: "strictNullChecks", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Enable_strict_null_checks + }, + { + name: "noImplicitThis", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Raise_error_on_this_expressions_with_an_implied_any_type, + }, + { + name: "alwaysStrict", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Strict_Type_Checking_Options, + description: ts.Diagnostics.Parse_in_strict_mode_and_emit_use_strict_for_each_source_file + }, + { + name: "noUnusedLocals", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_locals, + }, + { + name: "noUnusedParameters", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_on_unused_parameters, + }, + { + name: "noImplicitReturns", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_error_when_not_all_code_paths_in_function_return_a_value + }, + { + name: "noFallthroughCasesInSwitch", + type: "boolean", + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Additional_Checks, + description: ts.Diagnostics.Report_errors_for_fallthrough_cases_in_switch_statement + }, + { + name: "moduleResolution", + type: ts.createMapFromTemplate({ + "node": ts.ModuleResolutionKind.NodeJs, + "classic": ts.ModuleResolutionKind.Classic, + }), + paramType: ts.Diagnostics.STRATEGY, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Specify_module_resolution_strategy_Colon_node_Node_js_or_classic_TypeScript_pre_1_6, + }, + { + name: "baseUrl", + type: "string", + isFilePath: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Base_directory_to_resolve_non_absolute_module_names + }, + { + name: "paths", + type: "object", + isTSConfigOnly: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.A_series_of_entries_which_re_map_imports_to_lookup_locations_relative_to_the_baseUrl + }, + { + name: "rootDirs", + type: "list", + isTSConfigOnly: true, + element: { + name: "rootDirs", + type: "string", + isFilePath: true + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_root_folders_whose_combined_content_represents_the_structure_of_the_project_at_runtime + }, + { + name: "typeRoots", + type: "list", + element: { + name: "typeRoots", + type: "string", + isFilePath: true + }, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.List_of_folders_to_include_type_definitions_from + }, + { + name: "types", + type: "list", + element: { + name: "types", + type: "string" + }, + showInSimplifiedHelpView: true, + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Type_declaration_files_to_be_included_in_compilation + }, + { + name: "allowSyntheticDefaultImports", + type: "boolean", + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Allow_default_imports_from_modules_with_no_default_export_This_does_not_affect_code_emit_just_typechecking + }, + { + name: "preserveSymlinks", + type: "boolean", + category: ts.Diagnostics.Module_Resolution_Options, + description: ts.Diagnostics.Do_not_resolve_the_real_path_of_symlinks, + }, + { + name: "sourceRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations, + }, + { + name: "mapRoot", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.LOCATION, + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations, + }, + { + name: "inlineSourceMap", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file + }, + { + name: "inlineSources", + type: "boolean", + category: ts.Diagnostics.Source_Map_Options, + description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set + }, + { + name: "experimentalDecorators", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_ES7_decorators + }, + { + name: "emitDecoratorMetadata", + type: "boolean", + category: ts.Diagnostics.Experimental_Options, + description: ts.Diagnostics.Enables_experimental_support_for_emitting_type_metadata_for_decorators + }, + { + name: "jsxFactory", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_JSX_factory_function_to_use_when_targeting_react_JSX_emit_e_g_React_createElement_or_h + }, + { + name: "diagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_diagnostic_information + }, + { + name: "extendedDiagnostics", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Show_verbose_diagnostic_information + }, + { + name: "traceResolution", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Enable_tracing_of_the_name_resolution_process + }, + { + name: "listFiles", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_files_part_of_the_compilation + }, + { + name: "listEmittedFiles", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Print_names_of_generated_files_part_of_the_compilation + }, + { + name: "out", + type: "string", + isFilePath: false, + category: ts.Diagnostics.Advanced_Options, + paramType: ts.Diagnostics.FILE, + description: ts.Diagnostics.Deprecated_Use_outFile_instead_Concatenate_and_emit_output_to_single_file, + }, + { + name: "reactNamespace", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit + }, + { + name: "skipDefaultLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Deprecated_Use_skipLibCheck_instead_Skip_type_checking_of_default_library_declaration_files + }, + { + name: "charset", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_character_set_of_the_input_files + }, + { + name: "emitBOM", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files + }, + { + name: "locale", + type: "string", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_locale_used_when_displaying_messages_to_the_user_e_g_en_us + }, + { + name: "newLine", + type: ts.createMapFromTemplate({ + "crlf": 0, + "lf": 1 + }), + paramType: ts.Diagnostics.NEWLINE, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix, + }, + { + name: "noErrorTruncation", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_truncate_error_messages + }, + { + name: "noLib", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_include_the_default_library_file_lib_d_ts + }, + { + name: "noResolve", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_add_triple_slash_references_or_imported_modules_to_the_list_of_compiled_files + }, + { + name: "stripInternal", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation, + }, + { + name: "disableSizeLimit", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disable_size_limitations_on_JavaScript_projects + }, + { + name: "noImplicitUseStrict", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_use_strict_directives_in_module_output + }, + { + name: "noEmitHelpers", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output + }, + { + name: "noEmitOnError", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported, + }, + { + name: "preserveConstEnums", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code + }, + { + name: "declarationDir", + type: "string", + isFilePath: true, + paramType: ts.Diagnostics.DIRECTORY, + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Output_directory_for_generated_declaration_files + }, + { + name: "skipLibCheck", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Skip_type_checking_of_declaration_files, + }, + { + name: "allowUnusedLabels", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unused_labels + }, + { + name: "allowUnreachableCode", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Do_not_report_errors_on_unreachable_code + }, + { + name: "suppressExcessPropertyErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_excess_property_checks_for_object_literals, + }, + { + name: "suppressImplicitAnyIndexErrors", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures, + }, + { + name: "forceConsistentCasingInFileNames", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disallow_inconsistently_cased_references_to_the_same_file + }, + { + name: "maxNodeModuleJsDepth", + type: "number", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files + }, + { + name: "noStrictGenericChecks", + type: "boolean", + category: ts.Diagnostics.Advanced_Options, + description: ts.Diagnostics.Disable_strict_checking_of_generic_signatures_in_function_types, + }, + { + name: "plugins", + type: "list", + isTSConfigOnly: true, + element: { + name: "plugin", + type: "object" + }, + description: ts.Diagnostics.List_of_language_service_plugins + } + ]; + ts.typeAcquisitionDeclarations = [ + { + name: "enableAutoDiscovery", + type: "boolean", + }, + { + name: "enable", + type: "boolean", + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } + } + ]; + ts.defaultInitCompilerOptions = { + module: ts.ModuleKind.CommonJS, + target: 1, + strict: true + }; + var optionNameMapCache; + function convertEnableAutoDiscoveryToEnable(typeAcquisition) { + if (typeAcquisition && typeAcquisition.enableAutoDiscovery !== undefined && typeAcquisition.enable === undefined) { + var result = { + enable: typeAcquisition.enableAutoDiscovery, + include: typeAcquisition.include || [], + exclude: typeAcquisition.exclude || [] + }; + return result; + } + return typeAcquisition; + } + ts.convertEnableAutoDiscoveryToEnable = convertEnableAutoDiscoveryToEnable; + function getOptionNameMap() { + if (optionNameMapCache) { + return optionNameMapCache; + } + var optionNameMap = ts.createMap(); + var shortOptionNames = ts.createMap(); + ts.forEach(ts.optionDeclarations, function (option) { + optionNameMap.set(option.name.toLowerCase(), option); + if (option.shortName) { + shortOptionNames.set(option.shortName, option.name); + } + }); + optionNameMapCache = { optionNameMap: optionNameMap, shortOptionNames: shortOptionNames }; + return optionNameMapCache; + } + function createCompilerDiagnosticForInvalidCustomType(opt) { + return createDiagnosticForInvalidCustomType(opt, ts.createCompilerDiagnostic); + } + ts.createCompilerDiagnosticForInvalidCustomType = createCompilerDiagnosticForInvalidCustomType; + function createDiagnosticForInvalidCustomType(opt, createDiagnostic) { + var namesOfType = ts.arrayFrom(opt.type.keys()).map(function (key) { return "'" + key + "'"; }).join(", "); + return createDiagnostic(ts.Diagnostics.Argument_for_0_option_must_be_Colon_1, "--" + opt.name, namesOfType); + } + function parseCustomTypeOption(opt, value, errors) { + return convertJsonOptionOfCustomType(opt, trimString(value || ""), errors); + } + ts.parseCustomTypeOption = parseCustomTypeOption; + function parseListTypeOption(opt, value, errors) { + if (value === void 0) { value = ""; } + value = trimString(value); + if (ts.startsWith(value, "-")) { + return undefined; + } + if (value === "") { + return []; + } + var values = value.split(","); + switch (opt.element.type) { + case "number": + return ts.map(values, parseInt); + case "string": + return ts.map(values, function (v) { return v || ""; }); + default: + return ts.filter(ts.map(values, function (v) { return parseCustomTypeOption(opt.element, v, errors); }), function (v) { return !!v; }); + } + } + ts.parseListTypeOption = parseListTypeOption; + function parseCommandLine(commandLine, readFile) { + var options = {}; + var fileNames = []; + var errors = []; + parseStrings(commandLine); + return { + options: options, + fileNames: fileNames, + errors: errors + }; + function parseStrings(args) { + var i = 0; + while (i < args.length) { + var s = args[i]; + i++; + if (s.charCodeAt(0) === 64) { + parseResponseFile(s.slice(1)); + } + else if (s.charCodeAt(0) === 45) { + var opt = getOptionFromName(s.slice(s.charCodeAt(1) === 45 ? 2 : 1), true); + if (opt) { + if (opt.isTSConfigOnly) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_specified_in_tsconfig_json_file, opt.name)); + } + else { + if (!args[i] && opt.type !== "boolean") { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_expects_an_argument, opt.name)); + } + switch (opt.type) { + case "number": + options[opt.name] = parseInt(args[i]); + i++; + break; + case "boolean": + var optValue = args[i]; + options[opt.name] = optValue !== "false"; + if (optValue === "false" || optValue === "true") { + i++; + } + break; + case "string": + options[opt.name] = args[i] || ""; + i++; + break; + case "list": + var result = parseListTypeOption(opt, args[i], errors); + options[opt.name] = result || []; + if (result) { + i++; + } + break; + default: + options[opt.name] = parseCustomTypeOption(opt, args[i], errors); + i++; + break; + } + } + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_compiler_option_0, s)); + } + } + else { + fileNames.push(s); + } + } + } + function parseResponseFile(fileName) { + var text = readFile ? readFile(fileName) : ts.sys.readFile(fileName); + if (!text) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_not_found, fileName)); + return; + } + var args = []; + var pos = 0; + while (true) { + while (pos < text.length && text.charCodeAt(pos) <= 32) + pos++; + if (pos >= text.length) + break; + var start = pos; + if (text.charCodeAt(start) === 34) { + pos++; + while (pos < text.length && text.charCodeAt(pos) !== 34) + pos++; + if (pos < text.length) { + args.push(text.substring(start + 1, pos)); + pos++; + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unterminated_quoted_string_in_response_file_0, fileName)); + } + } + else { + while (text.charCodeAt(pos) > 32) + pos++; + args.push(text.substring(start, pos)); + } + } + parseStrings(args); + } + } + ts.parseCommandLine = parseCommandLine; + function getOptionFromName(optionName, allowShort) { + if (allowShort === void 0) { allowShort = false; } + optionName = optionName.toLowerCase(); + var _a = getOptionNameMap(), optionNameMap = _a.optionNameMap, shortOptionNames = _a.shortOptionNames; + if (allowShort) { + var short = shortOptionNames.get(optionName); + if (short !== undefined) { + optionName = short; + } + } + return optionNameMap.get(optionName); + } + function readConfigFile(fileName, readFile) { + var textOrDiagnostic = tryReadFile(fileName, readFile); + return typeof textOrDiagnostic === "string" ? parseConfigFileTextToJson(fileName, textOrDiagnostic) : { config: {}, error: textOrDiagnostic }; + } + ts.readConfigFile = readConfigFile; + function parseConfigFileTextToJson(fileName, jsonText) { + var jsonSourceFile = ts.parseJsonText(fileName, jsonText); + return { + config: convertToObject(jsonSourceFile, jsonSourceFile.parseDiagnostics), + error: jsonSourceFile.parseDiagnostics.length ? jsonSourceFile.parseDiagnostics[0] : undefined + }; + } + ts.parseConfigFileTextToJson = parseConfigFileTextToJson; + function readJsonConfigFile(fileName, readFile) { + var textOrDiagnostic = tryReadFile(fileName, readFile); + return typeof textOrDiagnostic === "string" ? ts.parseJsonText(fileName, textOrDiagnostic) : { parseDiagnostics: [textOrDiagnostic] }; + } + ts.readJsonConfigFile = readJsonConfigFile; + function tryReadFile(fileName, readFile) { + var text; + try { + text = readFile(fileName); + } + catch (e) { + return ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message); + } + return text === undefined ? ts.createCompilerDiagnostic(ts.Diagnostics.The_specified_path_does_not_exist_Colon_0, fileName) : text; + } + function commandLineOptionsToMap(options) { + return ts.arrayToMap(options, function (option) { return option.name; }); + } + var _tsconfigRootOptions; + function getTsconfigRootOptionsMap() { + if (_tsconfigRootOptions === undefined) { + _tsconfigRootOptions = commandLineOptionsToMap([ + { + name: "compilerOptions", + type: "object", + elementOptions: commandLineOptionsToMap(ts.optionDeclarations), + extraKeyDiagnosticMessage: ts.Diagnostics.Unknown_compiler_option_0 + }, + { + name: "typingOptions", + type: "object", + elementOptions: commandLineOptionsToMap(ts.typeAcquisitionDeclarations), + extraKeyDiagnosticMessage: ts.Diagnostics.Unknown_type_acquisition_option_0 + }, + { + name: "typeAcquisition", + type: "object", + elementOptions: commandLineOptionsToMap(ts.typeAcquisitionDeclarations), + extraKeyDiagnosticMessage: ts.Diagnostics.Unknown_type_acquisition_option_0 + }, + { + name: "extends", + type: "string" + }, + { + name: "files", + type: "list", + element: { + name: "files", + type: "string" + } + }, + { + name: "include", + type: "list", + element: { + name: "include", + type: "string" + } + }, + { + name: "exclude", + type: "list", + element: { + name: "exclude", + type: "string" + } + }, + ts.compileOnSaveCommandLineOption + ]); + } + return _tsconfigRootOptions; + } + function convertToObject(sourceFile, errors) { + return convertToObjectWorker(sourceFile, errors, undefined, undefined); + } + ts.convertToObject = convertToObject; + function convertToObjectWorker(sourceFile, errors, knownRootOptions, jsonConversionNotifier) { + if (!sourceFile.jsonObject) { + return {}; + } + return convertObjectLiteralExpressionToJson(sourceFile.jsonObject, knownRootOptions, undefined, undefined); + function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnosticMessage, parentOption) { + var result = {}; + for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { + var element = _a[_i]; + if (element.kind !== 261) { + errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); + continue; + } + if (element.questionToken) { + errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element.questionToken, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?")); + } + if (!isDoubleQuotedString(element.name)) { + errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element.name, ts.Diagnostics.String_literal_with_double_quotes_expected)); + } + var keyText = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(element.name)); + var option = knownOptions ? knownOptions.get(keyText) : undefined; + if (extraKeyDiagnosticMessage && !option) { + errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element.name, extraKeyDiagnosticMessage, keyText)); + } + var value = convertPropertyValueToJson(element.initializer, option); + if (typeof keyText !== "undefined" && typeof value !== "undefined") { + result[keyText] = value; + if (jsonConversionNotifier && + (parentOption || knownOptions === knownRootOptions)) { + var isValidOptionValue = isCompilerOptionsValue(option, value); + if (parentOption) { + if (isValidOptionValue) { + jsonConversionNotifier.onSetValidOptionKeyValueInParent(parentOption, option, value); + } + } + else if (knownOptions === knownRootOptions) { + if (isValidOptionValue) { + jsonConversionNotifier.onSetValidOptionKeyValueInRoot(keyText, element.name, value, element.initializer); + } + else if (!option) { + jsonConversionNotifier.onSetUnknownOptionKeyValueInRoot(keyText, element.name, value, element.initializer); + } + } + } + } + } + return result; + } + function convertArrayLiteralExpressionToJson(elements, elementOption) { + return elements.map(function (element) { return convertPropertyValueToJson(element, elementOption); }); + } + function convertPropertyValueToJson(valueExpression, option) { + switch (valueExpression.kind) { + case 101: + reportInvalidOptionValue(option && option.type !== "boolean"); + return true; + case 86: + reportInvalidOptionValue(option && option.type !== "boolean"); + return false; + case 95: + reportInvalidOptionValue(!!option); + return null; + case 9: + if (!isDoubleQuotedString(valueExpression)) { + errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts.Diagnostics.String_literal_with_double_quotes_expected)); + } + reportInvalidOptionValue(option && (typeof option.type === "string" && option.type !== "string")); + var text = valueExpression.text; + if (option && typeof option.type !== "string") { + var customOption = option; + if (!customOption.type.has(text.toLowerCase())) { + errors.push(createDiagnosticForInvalidCustomType(customOption, function (message, arg0, arg1) { return ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, message, arg0, arg1); })); + } + } + return text; + case 8: + reportInvalidOptionValue(option && option.type !== "number"); + return Number(valueExpression.text); + case 178: + reportInvalidOptionValue(option && option.type !== "object"); + var objectLiteralExpression = valueExpression; + if (option) { + var _a = option, elementOptions = _a.elementOptions, extraKeyDiagnosticMessage = _a.extraKeyDiagnosticMessage, optionName = _a.name; + return convertObjectLiteralExpressionToJson(objectLiteralExpression, elementOptions, extraKeyDiagnosticMessage, optionName); + } + else { + return convertObjectLiteralExpressionToJson(objectLiteralExpression, undefined, undefined, undefined); + } + case 177: + reportInvalidOptionValue(option && option.type !== "list"); + return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element); + } + if (option) { + reportInvalidOptionValue(true); + } + else { + errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts.Diagnostics.Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_literal)); + } + return undefined; + function reportInvalidOptionValue(isError) { + if (isError) { + errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, valueExpression, ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, option.name, getCompilerOptionValueTypeString(option))); + } + } + } + function isDoubleQuotedString(node) { + return node.kind === 9 && ts.getSourceTextOfNodeFromSourceFile(sourceFile, node).charCodeAt(0) === 34; + } + } + function getCompilerOptionValueTypeString(option) { + return option.type === "list" ? + "Array" : + typeof option.type === "string" ? option.type : "string"; + } + function isCompilerOptionsValue(option, value) { + if (option) { + if (option.type === "list") { + return ts.isArray(value); + } + var expectedType = typeof option.type === "string" ? option.type : "string"; + return typeof value === expectedType; + } + } + function generateTSConfig(options, fileNames, newLine) { + var compilerOptions = ts.extend(options, ts.defaultInitCompilerOptions); + var compilerOptionsMap = serializeCompilerOptions(compilerOptions); + return writeConfigurations(); + function getCustomTypeMapOfCommandLineOption(optionDefinition) { + if (optionDefinition.type === "string" || optionDefinition.type === "number" || optionDefinition.type === "boolean") { + return undefined; + } + else if (optionDefinition.type === "list") { + return getCustomTypeMapOfCommandLineOption(optionDefinition.element); + } + else { + return optionDefinition.type; + } + } + function getNameOfCompilerOptionValue(value, customTypeMap) { + return ts.forEachEntry(customTypeMap, function (mapValue, key) { + if (mapValue === value) { + return key; + } + }); + } + function serializeCompilerOptions(options) { + var result = ts.createMap(); + var optionsNameMap = getOptionNameMap().optionNameMap; + var _loop_3 = function (name) { + if (ts.hasProperty(options, name)) { + if (optionsNameMap.has(name) && optionsNameMap.get(name).category === ts.Diagnostics.Command_line_Options) { + return "continue"; + } + var value = options[name]; + var optionDefinition = optionsNameMap.get(name.toLowerCase()); + if (optionDefinition) { + var customTypeMap_1 = getCustomTypeMapOfCommandLineOption(optionDefinition); + if (!customTypeMap_1) { + result.set(name, value); + } + else { + if (optionDefinition.type === "list") { + result.set(name, value.map(function (element) { return getNameOfCompilerOptionValue(element, customTypeMap_1); })); + } + else { + result.set(name, getNameOfCompilerOptionValue(value, customTypeMap_1)); + } + } + } + } + }; + for (var name in options) { + _loop_3(name); + } + return result; + } + function getDefaultValueForOption(option) { + switch (option.type) { + case "number": + return 1; + case "boolean": + return true; + case "string": + return option.isFilePath ? "./" : ""; + case "list": + return []; + case "object": + return {}; + default: + return option.type.keys().next().value; + } + } + function makePadding(paddingLength) { + return Array(paddingLength + 1).join(" "); + } + function writeConfigurations() { + var categorizedOptions = ts.createMultiMap(); + for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { + var option = optionDeclarations_1[_i]; + var category = option.category; + if (category !== undefined && category !== ts.Diagnostics.Command_line_Options && category !== ts.Diagnostics.Advanced_Options) { + categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); + } + } + var marginLength = 0; + var seenKnownKeys = 0; + var nameColumn = []; + var descriptionColumn = []; + categorizedOptions.forEach(function (options, category) { + if (nameColumn.length !== 0) { + nameColumn.push(""); + descriptionColumn.push(""); + } + nameColumn.push("/* " + category + " */"); + descriptionColumn.push(""); + for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { + var option = options_1[_i]; + var optionName = void 0; + if (compilerOptionsMap.has(option.name)) { + optionName = "\"" + option.name + "\": " + JSON.stringify(compilerOptionsMap.get(option.name)) + ((seenKnownKeys += 1) === compilerOptionsMap.size ? "" : ","); + } + else { + optionName = "// \"" + option.name + "\": " + JSON.stringify(getDefaultValueForOption(option)) + ","; + } + nameColumn.push(optionName); + descriptionColumn.push("/* " + (option.description && ts.getLocaleSpecificMessage(option.description) || option.name) + " */"); + marginLength = Math.max(optionName.length, marginLength); + } + }); + var tab = makePadding(2); + var result = []; + result.push("{"); + result.push(tab + "\"compilerOptions\": {"); + for (var i = 0; i < nameColumn.length; i++) { + var optionName = nameColumn[i]; + var description = descriptionColumn[i]; + result.push(optionName && "" + tab + tab + optionName + (description && (makePadding(marginLength - optionName.length + 2) + description))); + } + if (fileNames.length) { + result.push(tab + "},"); + result.push(tab + "\"files\": ["); + for (var i = 0; i < fileNames.length; i++) { + result.push("" + tab + tab + JSON.stringify(fileNames[i]) + (i === fileNames.length - 1 ? "" : ",")); + } + result.push(tab + "]"); + } + else { + result.push(tab + "}"); + } + result.push("}"); + return result.join(newLine); + } + } + ts.generateTSConfig = generateTSConfig; + function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { + return parseJsonConfigFileContentWorker(json, undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions); + } + ts.parseJsonConfigFileContent = parseJsonConfigFileContent; + function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { + return parseJsonConfigFileContentWorker(undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions); + } + ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent; + function setConfigFileInOptions(options, configFile) { + if (configFile) { + Object.defineProperty(options, "configFile", { enumerable: false, writable: false, value: configFile }); + } + } + ts.setConfigFileInOptions = setConfigFileInOptions; + function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) { + if (existingOptions === void 0) { existingOptions = {}; } + if (resolutionStack === void 0) { resolutionStack = []; } + if (extraFileExtensions === void 0) { extraFileExtensions = []; } + ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined)); + var errors = []; + var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors); + var raw = parsedConfig.raw; + var options = ts.extend(existingOptions, parsedConfig.options || {}); + options.configFilePath = configFileName; + setConfigFileInOptions(options, sourceFile); + var _a = getFileNames(), fileNames = _a.fileNames, wildcardDirectories = _a.wildcardDirectories; + return { + options: options, + fileNames: fileNames, + typeAcquisition: parsedConfig.typeAcquisition || getDefaultTypeAcquisition(), + raw: raw, + errors: errors, + wildcardDirectories: wildcardDirectories, + compileOnSave: !!raw.compileOnSave + }; + function getFileNames() { + var fileNames; + if (ts.hasProperty(raw, "files")) { + if (ts.isArray(raw["files"])) { + fileNames = raw["files"]; + if (fileNames.length === 0) { + createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json"); + } + } + else { + createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "files", "Array"); + } + } + var includeSpecs; + if (ts.hasProperty(raw, "include")) { + if (ts.isArray(raw["include"])) { + includeSpecs = raw["include"]; + } + else { + createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "include", "Array"); + } + } + var excludeSpecs; + if (ts.hasProperty(raw, "exclude")) { + if (ts.isArray(raw["exclude"])) { + excludeSpecs = raw["exclude"]; + } + else { + createCompilerDiagnosticOnlyIfJson(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "exclude", "Array"); + } + } + else { + var outDir = raw["compilerOptions"] && raw["compilerOptions"]["outDir"]; + if (outDir) { + excludeSpecs = [outDir]; + } + } + if (fileNames === undefined && includeSpecs === undefined) { + includeSpecs = ["**/*"]; + } + var result = matchFileNames(fileNames, includeSpecs, excludeSpecs, basePath, options, host, errors, extraFileExtensions, sourceFile); + if (result.fileNames.length === 0 && !ts.hasProperty(raw, "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 || []))); + } + return result; + } + function createCompilerDiagnosticOnlyIfJson(message, arg0, arg1) { + if (!sourceFile) { + errors.push(ts.createCompilerDiagnostic(message, arg0, arg1)); + } + } + } + function isSuccessfulParsedTsconfig(value) { + return !!value.options; + } + function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors) { + basePath = ts.normalizeSlashes(basePath); + var getCanonicalFileName = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); + var resolvedPath = ts.toPath(configFileName || "", basePath, getCanonicalFileName); + if (resolutionStack.indexOf(resolvedPath) >= 0) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Circularity_detected_while_resolving_configuration_Colon_0, resolutionStack.concat([resolvedPath]).join(" -> "))); + return { raw: json || convertToObject(sourceFile, errors) }; + } + var ownConfig = json ? + parseOwnConfigOfJson(json, host, basePath, getCanonicalFileName, configFileName, errors) : + parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, getCanonicalFileName, configFileName, errors); + if (ownConfig.extendedConfigPath) { + resolutionStack = resolutionStack.concat([resolvedPath]); + var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, getCanonicalFileName, resolutionStack, errors); + if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) { + var baseRaw_1 = extendedConfig.raw; + var raw_1 = ownConfig.raw; + var setPropertyInRawIfNotUndefined = function (propertyName) { + var value = raw_1[propertyName] || baseRaw_1[propertyName]; + if (value) { + raw_1[propertyName] = value; + } + }; + setPropertyInRawIfNotUndefined("include"); + setPropertyInRawIfNotUndefined("exclude"); + setPropertyInRawIfNotUndefined("files"); + if (raw_1.compileOnSave === undefined) { + raw_1.compileOnSave = baseRaw_1.compileOnSave; + } + ownConfig.options = ts.assign({}, extendedConfig.options, ownConfig.options); + } + } + return ownConfig; + } + function parseOwnConfigOfJson(json, host, basePath, getCanonicalFileName, configFileName, errors) { + if (ts.hasProperty(json, "excludes")) { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } + var options = convertCompilerOptionsFromJsonWorker(json.compilerOptions, basePath, errors, configFileName); + var typeAcquisition = convertTypeAcquisitionFromJsonWorker(json["typeAcquisition"] || json["typingOptions"], basePath, errors, configFileName); + json.compileOnSave = convertCompileOnSaveOptionFromJson(json, basePath, errors); + var extendedConfigPath; + if (json.extends) { + if (typeof json.extends !== "string") { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, "extends", "string")); + } + else { + extendedConfigPath = getExtendsConfigPath(json.extends, host, basePath, getCanonicalFileName, errors, ts.createCompilerDiagnostic); + } + } + return { raw: json, options: options, typeAcquisition: typeAcquisition, extendedConfigPath: extendedConfigPath }; + } + function parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, getCanonicalFileName, configFileName, errors) { + var options = getDefaultCompilerOptions(configFileName); + var typeAcquisition, typingOptionstypeAcquisition; + var extendedConfigPath; + var optionsIterator = { + onSetValidOptionKeyValueInParent: function (parentOption, option, value) { + ts.Debug.assert(parentOption === "compilerOptions" || parentOption === "typeAcquisition" || parentOption === "typingOptions"); + var currentOption = parentOption === "compilerOptions" ? + options : + parentOption === "typeAcquisition" ? + (typeAcquisition || (typeAcquisition = getDefaultTypeAcquisition(configFileName))) : + (typingOptionstypeAcquisition || (typingOptionstypeAcquisition = getDefaultTypeAcquisition(configFileName))); + currentOption[option.name] = normalizeOptionValue(option, basePath, value); + }, + onSetValidOptionKeyValueInRoot: function (key, _keyNode, value, valueNode) { + switch (key) { + case "extends": + extendedConfigPath = getExtendsConfigPath(value, host, basePath, getCanonicalFileName, errors, function (message, arg0) { + return ts.createDiagnosticForNodeInSourceFile(sourceFile, valueNode, message, arg0); + }); + return; + case "files": + if (value.length === 0) { + errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, valueNode, ts.Diagnostics.The_files_list_in_config_file_0_is_empty, configFileName || "tsconfig.json")); + } + return; + } + }, + onSetUnknownOptionKeyValueInRoot: function (key, keyNode, _value, _valueNode) { + if (key === "excludes") { + errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, keyNode, ts.Diagnostics.Unknown_option_excludes_Did_you_mean_exclude)); + } + } + }; + var json = convertToObjectWorker(sourceFile, errors, getTsconfigRootOptionsMap(), optionsIterator); + if (!typeAcquisition) { + if (typingOptionstypeAcquisition) { + typeAcquisition = (typingOptionstypeAcquisition.enableAutoDiscovery !== undefined) ? + { + enable: typingOptionstypeAcquisition.enableAutoDiscovery, + include: typingOptionstypeAcquisition.include, + exclude: typingOptionstypeAcquisition.exclude + } : + typingOptionstypeAcquisition; + } + else { + typeAcquisition = getDefaultTypeAcquisition(configFileName); + } + } + return { raw: json, options: options, typeAcquisition: typeAcquisition, extendedConfigPath: extendedConfigPath }; + } + function getExtendsConfigPath(extendedConfig, host, basePath, getCanonicalFileName, errors, createDiagnostic) { + extendedConfig = ts.normalizeSlashes(extendedConfig); + if (!(ts.isRootedDiskPath(extendedConfig) || ts.startsWith(extendedConfig, "./") || ts.startsWith(extendedConfig, "../"))) { + errors.push(createDiagnostic(ts.Diagnostics.A_path_in_an_extends_option_must_be_relative_or_rooted_but_0_is_not, extendedConfig)); + return undefined; + } + var extendedConfigPath = ts.toPath(extendedConfig, basePath, getCanonicalFileName); + if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json")) { + extendedConfigPath = extendedConfigPath + ".json"; + if (!host.fileExists(extendedConfigPath)) { + errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig)); + return undefined; + } + } + return extendedConfigPath; + } + function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, getCanonicalFileName, resolutionStack, errors) { + var extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); }); + if (sourceFile) { + (sourceFile.extendedSourceFiles || (sourceFile.extendedSourceFiles = [])).push(extendedResult.fileName); + } + if (extendedResult.parseDiagnostics.length) { + errors.push.apply(errors, extendedResult.parseDiagnostics); + return undefined; + } + var extendedDirname = ts.getDirectoryPath(extendedConfigPath); + var extendedConfig = parseConfig(undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors); + if (sourceFile) { + (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles); + } + if (isSuccessfulParsedTsconfig(extendedConfig)) { + var relativeDifference_1 = ts.convertToRelativePath(extendedDirname, basePath, getCanonicalFileName); + var updatePath_1 = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference_1, path); }; + var mapPropertiesInRawIfNotUndefined = function (propertyName) { + if (raw_2[propertyName]) { + raw_2[propertyName] = ts.map(raw_2[propertyName], updatePath_1); + } + }; + var raw_2 = extendedConfig.raw; + mapPropertiesInRawIfNotUndefined("include"); + mapPropertiesInRawIfNotUndefined("exclude"); + mapPropertiesInRawIfNotUndefined("files"); + } + return extendedConfig; + var _a; + } + function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) { + if (!ts.hasProperty(jsonOption, ts.compileOnSaveCommandLineOption.name)) { + return undefined; + } + var result = convertJsonOption(ts.compileOnSaveCommandLineOption, jsonOption["compileOnSave"], basePath, errors); + if (typeof result === "boolean" && result) { + return result; + } + return false; + } + function convertCompilerOptionsFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertCompilerOptionsFromJson = convertCompilerOptionsFromJson; + function convertTypeAcquisitionFromJson(jsonOptions, basePath, configFileName) { + var errors = []; + var options = convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName); + return { options: options, errors: errors }; + } + ts.convertTypeAcquisitionFromJson = convertTypeAcquisitionFromJson; + function getDefaultCompilerOptions(configFileName) { + var options = ts.getBaseFileName(configFileName) === "jsconfig.json" + ? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true } + : {}; + return options; + } + function convertCompilerOptionsFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = getDefaultCompilerOptions(configFileName); + convertOptionsFromJson(ts.optionDeclarations, jsonOptions, basePath, options, ts.Diagnostics.Unknown_compiler_option_0, errors); + return options; + } + function getDefaultTypeAcquisition(configFileName) { + var options = { enable: ts.getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] }; + return options; + } + function convertTypeAcquisitionFromJsonWorker(jsonOptions, basePath, errors, configFileName) { + var options = getDefaultTypeAcquisition(configFileName); + var typeAcquisition = convertEnableAutoDiscoveryToEnable(jsonOptions); + convertOptionsFromJson(ts.typeAcquisitionDeclarations, typeAcquisition, basePath, options, ts.Diagnostics.Unknown_type_acquisition_option_0, errors); + return options; + } + function convertOptionsFromJson(optionDeclarations, jsonOptions, basePath, defaultOptions, diagnosticMessage, errors) { + if (!jsonOptions) { + return; + } + var optionNameMap = commandLineOptionsToMap(optionDeclarations); + for (var id in jsonOptions) { + var opt = optionNameMap.get(id); + if (opt) { + defaultOptions[opt.name] = convertJsonOption(opt, jsonOptions[id], basePath, errors); + } + else { + errors.push(ts.createCompilerDiagnostic(diagnosticMessage, id)); + } + } + } + function convertJsonOption(opt, value, basePath, errors) { + if (isCompilerOptionsValue(opt, value)) { + var optType = opt.type; + if (optType === "list" && ts.isArray(value)) { + return convertJsonOptionOfListType(opt, value, basePath, errors); + } + else if (typeof optType !== "string") { + return convertJsonOptionOfCustomType(opt, value, errors); + } + return normalizeNonListOptionValue(opt, basePath, value); + } + else { + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.Compiler_option_0_requires_a_value_of_type_1, opt.name, getCompilerOptionValueTypeString(opt))); + } + } + function normalizeOptionValue(option, basePath, value) { + if (option.type === "list") { + var listOption_1 = option; + if (listOption_1.element.isFilePath || typeof listOption_1.element.type !== "string") { + return ts.filter(ts.map(value, function (v) { return normalizeOptionValue(listOption_1.element, basePath, v); }), function (v) { return !!v; }); + } + return value; + } + else if (typeof option.type !== "string") { + return option.type.get(typeof value === "string" ? value.toLowerCase() : value); + } + return normalizeNonListOptionValue(option, basePath, value); + } + function normalizeNonListOptionValue(option, basePath, value) { + if (option.isFilePath) { + value = ts.normalizePath(ts.combinePaths(basePath, value)); + if (value === "") { + value = "."; + } + } + return value; + } + function convertJsonOptionOfCustomType(opt, value, errors) { + var key = value.toLowerCase(); + var val = opt.type.get(key); + if (val !== undefined) { + return val; + } + else { + errors.push(createCompilerDiagnosticForInvalidCustomType(opt)); + } + } + function convertJsonOptionOfListType(option, values, basePath, errors) { + return ts.filter(ts.map(values, function (v) { return convertJsonOption(option.element, v, basePath, errors); }), function (v) { return !!v; }); + } + function trimString(s) { + return typeof s.trim === "function" ? s.trim() : s.replace(/^[\s]+|[\s]+$/g, ""); + } + var invalidTrailingRecursionPattern = /(^|\/)\*\*\/?$/; + var invalidMultipleRecursionPatterns = /(^|\/)\*\*\/(.*\/)?\*\*($|\/)/; + var invalidDotDotAfterRecursiveWildcardPattern = /(^|\/)\*\*\/(.*\/)?\.\.($|\/)/; + var watchRecursivePattern = /\/[^/]*?[*?][^/]*\//; + var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/; + function matchFileNames(fileNames, include, exclude, basePath, options, host, errors, extraFileExtensions, jsonSourceFile) { + basePath = ts.normalizePath(basePath); + var keyMapper = host.useCaseSensitiveFileNames ? caseSensitiveKeyMapper : caseInsensitiveKeyMapper; + var literalFileMap = ts.createMap(); + var wildcardFileMap = ts.createMap(); + if (include) { + include = validateSpecs(include, errors, false, jsonSourceFile, "include"); + } + if (exclude) { + exclude = validateSpecs(exclude, errors, true, jsonSourceFile, "exclude"); + } + var wildcardDirectories = getWildcardDirectories(include, exclude, basePath, host.useCaseSensitiveFileNames); + 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]; + var file = ts.combinePaths(basePath, fileName); + literalFileMap.set(keyMapper(file), file); + } + } + if (include && include.length > 0) { + for (var _a = 0, _b = host.readDirectory(basePath, supportedExtensions, exclude, include, undefined); _a < _b.length; _a++) { + var file = _b[_a]; + if (hasFileWithHigherPriorityExtension(file, literalFileMap, wildcardFileMap, supportedExtensions, keyMapper)) { + continue; + } + removeWildcardFilesWithLowerPriorityExtension(file, wildcardFileMap, supportedExtensions, keyMapper); + var key = keyMapper(file); + if (!literalFileMap.has(key) && !wildcardFileMap.has(key)) { + wildcardFileMap.set(key, file); + } + } + } + var literalFiles = ts.arrayFrom(literalFileMap.values()); + var wildcardFiles = ts.arrayFrom(wildcardFileMap.values()); + return { + fileNames: literalFiles.concat(wildcardFiles), + wildcardDirectories: wildcardDirectories + }; + } + function validateSpecs(specs, errors, allowTrailingRecursion, jsonSourceFile, specKey) { + return specs.filter(function (spec) { + var diag = specToDiagnostic(spec, allowTrailingRecursion); + if (diag !== undefined) { + errors.push(createDiagnostic(diag, spec)); + } + return diag === undefined; + }); + function createDiagnostic(message, spec) { + if (jsonSourceFile && jsonSourceFile.jsonObject) { + for (var _i = 0, _a = ts.getPropertyAssignment(jsonSourceFile.jsonObject, specKey); _i < _a.length; _i++) { + var property = _a[_i]; + if (ts.isArrayLiteralExpression(property.initializer)) { + for (var _b = 0, _c = property.initializer.elements; _b < _c.length; _b++) { + var element = _c[_b]; + if (ts.isStringLiteral(element) && element.text === spec) { + return ts.createDiagnosticForNodeInSourceFile(jsonSourceFile, element, message, spec); + } + } + } + } + } + return ts.createCompilerDiagnostic(message, spec); + } + } + function specToDiagnostic(spec, allowTrailingRecursion) { + if (!allowTrailingRecursion && invalidTrailingRecursionPattern.test(spec)) { + return ts.Diagnostics.File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0; + } + else if (invalidMultipleRecursionPatterns.test(spec)) { + return ts.Diagnostics.File_specification_cannot_contain_multiple_recursive_directory_wildcards_Asterisk_Asterisk_Colon_0; + } + else if (invalidDotDotAfterRecursiveWildcardPattern.test(spec)) { + return ts.Diagnostics.File_specification_cannot_contain_a_parent_directory_that_appears_after_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0; + } + } + function getWildcardDirectories(include, exclude, path, useCaseSensitiveFileNames) { + var rawExcludeRegex = ts.getRegularExpressionForWildcard(exclude, path, "exclude"); + var excludeRegex = rawExcludeRegex && new RegExp(rawExcludeRegex, useCaseSensitiveFileNames ? "" : "i"); + var wildcardDirectories = {}; + if (include !== undefined) { + var recursiveKeys = []; + for (var _i = 0, include_1 = include; _i < include_1.length; _i++) { + var file = include_1[_i]; + var spec = ts.normalizePath(ts.combinePaths(path, file)); + if (excludeRegex && excludeRegex.test(spec)) { + continue; + } + var match = getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames); + if (match) { + var key = match.key, flags = match.flags; + var existingFlags = wildcardDirectories[key]; + if (existingFlags === undefined || existingFlags < flags) { + wildcardDirectories[key] = flags; + if (flags === 1) { + recursiveKeys.push(key); + } + } + } + } + for (var key in wildcardDirectories) { + if (ts.hasProperty(wildcardDirectories, key)) { + for (var _a = 0, recursiveKeys_1 = recursiveKeys; _a < recursiveKeys_1.length; _a++) { + var recursiveKey = recursiveKeys_1[_a]; + if (key !== recursiveKey && ts.containsPath(recursiveKey, key, path, !useCaseSensitiveFileNames)) { + delete wildcardDirectories[key]; + } + } + } + } + } + return wildcardDirectories; + } + function getWildcardDirectoryFromSpec(spec, useCaseSensitiveFileNames) { + var match = wildcardDirectoryPattern.exec(spec); + if (match) { + return { + key: useCaseSensitiveFileNames ? match[0] : match[0].toLowerCase(), + flags: watchRecursivePattern.test(spec) ? 1 : 0 + }; + } + if (ts.isImplicitGlob(spec)) { + return { key: spec, flags: 1 }; + } + return undefined; + } + function hasFileWithHigherPriorityExtension(file, literalFiles, wildcardFiles, extensions, keyMapper) { + var extensionPriority = ts.getExtensionPriority(file, extensions); + var adjustedExtensionPriority = ts.adjustExtensionPriority(extensionPriority, extensions); + for (var i = 0; i < adjustedExtensionPriority; i++) { + var higherPriorityExtension = extensions[i]; + var higherPriorityPath = keyMapper(ts.changeExtension(file, higherPriorityExtension)); + if (literalFiles.has(higherPriorityPath) || wildcardFiles.has(higherPriorityPath)) { + return true; + } + } + return false; + } + function removeWildcardFilesWithLowerPriorityExtension(file, wildcardFiles, extensions, keyMapper) { + var extensionPriority = ts.getExtensionPriority(file, extensions); + var nextExtensionPriority = ts.getNextLowestExtensionPriority(extensionPriority, extensions); + for (var i = nextExtensionPriority; i < extensions.length; i++) { + var lowerPriorityExtension = extensions[i]; + var lowerPriorityPath = keyMapper(ts.changeExtension(file, lowerPriorityExtension)); + wildcardFiles.delete(lowerPriorityPath); + } + } + function caseSensitiveKeyMapper(key) { + return key; + } + function caseInsensitiveKeyMapper(key) { + return key.toLowerCase(); + } + function convertCompilerOptionsForTelemetry(opts) { + var out = {}; + for (var key in opts) { + if (opts.hasOwnProperty(key)) { + var type = getOptionFromName(key); + if (type !== undefined) { + out[key] = getOptionValueWithEmptyStrings(opts[key], type); + } + } + } + return out; + } + ts.convertCompilerOptionsForTelemetry = convertCompilerOptionsForTelemetry; + function getOptionValueWithEmptyStrings(value, option) { + switch (option.type) { + case "object": + return ""; + case "string": + return ""; + case "number": + return typeof value === "number" ? value : ""; + case "boolean": + return typeof value === "boolean" ? value : ""; + case "list": + var elementType_1 = option.element; + return ts.isArray(value) ? value.map(function (v) { return getOptionValueWithEmptyStrings(v, elementType_1); }) : ""; + default: + return ts.forEachEntry(option.type, function (optionEnumValue, optionStringValue) { + if (optionEnumValue === value) { + return optionStringValue; + } + }); + } + } +})(ts || (ts = {})); +var ts; +(function (ts) { + function trace(host) { + host.trace(ts.formatMessage.apply(undefined, arguments)); + } + ts.trace = trace; + function isTraceEnabled(compilerOptions, host) { + return compilerOptions.traceResolution && host.trace !== undefined; + } + ts.isTraceEnabled = isTraceEnabled; + function withPackageId(packageId, r) { + return r && { path: r.path, extension: r.ext, packageId: packageId }; + } + function noPackageId(r) { + return withPackageId(undefined, r); + } + var Extensions; + (function (Extensions) { + Extensions[Extensions["TypeScript"] = 0] = "TypeScript"; + Extensions[Extensions["JavaScript"] = 1] = "JavaScript"; + Extensions[Extensions["DtsOnly"] = 2] = "DtsOnly"; + })(Extensions || (Extensions = {})); + function resolvedTypeScriptOnly(resolved) { + if (!resolved) { + return undefined; + } + ts.Debug.assert(ts.extensionIsTypeScript(resolved.extension)); + return { fileName: resolved.path, packageId: resolved.packageId }; + } + function createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations) { + return { + resolvedModule: resolved && { resolvedFileName: resolved.path, extension: resolved.extension, isExternalLibraryImport: isExternalLibraryImport, packageId: resolved.packageId }, + failedLookupLocations: failedLookupLocations + }; + } + function tryReadPackageJsonFields(readTypes, jsonContent, baseDirectory, state) { + return readTypes ? tryReadFromField("typings") || tryReadFromField("types") : tryReadFromField("main"); + function tryReadFromField(fieldName) { + if (!ts.hasProperty(jsonContent, fieldName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_does_not_have_a_0_field, fieldName); + } + return; + } + var fileName = jsonContent[fieldName]; + if (typeof fileName !== "string") { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Expected_type_of_0_field_in_package_json_to_be_string_got_1, fieldName, typeof fileName); + } + return; + } + var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path); + } + return path; + } + } + function readJson(path, host) { + try { + var jsonText = host.readFile(path); + return jsonText ? JSON.parse(jsonText) : {}; + } + catch (e) { + return {}; + } + } + function getEffectiveTypeRoots(options, host) { + if (options.typeRoots) { + return options.typeRoots; + } + var currentDirectory; + if (options.configFilePath) { + currentDirectory = ts.getDirectoryPath(options.configFilePath); + } + else if (host.getCurrentDirectory) { + currentDirectory = host.getCurrentDirectory(); + } + if (currentDirectory !== undefined) { + return getDefaultTypeRoots(currentDirectory, host); + } + } + ts.getEffectiveTypeRoots = getEffectiveTypeRoots; + function getDefaultTypeRoots(currentDirectory, host) { + if (!host.directoryExists) { + return [ts.combinePaths(currentDirectory, nodeModulesAtTypes)]; + } + var typeRoots; + forEachAncestorDirectory(ts.normalizePath(currentDirectory), function (directory) { + var atTypes = ts.combinePaths(directory, nodeModulesAtTypes); + if (host.directoryExists(atTypes)) { + (typeRoots || (typeRoots = [])).push(atTypes); + } + return undefined; + }); + return typeRoots; + } + var nodeModulesAtTypes = ts.combinePaths("node_modules", "@types"); + function resolveTypeReferenceDirective(typeReferenceDirectiveName, containingFile, options, host) { + var traceEnabled = isTraceEnabled(options, host); + var moduleResolutionState = { compilerOptions: options, host: host, traceEnabled: traceEnabled }; + var typeRoots = getEffectiveTypeRoots(options, host); + if (traceEnabled) { + if (containingFile === undefined) { + if (typeRoots === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_not_set, typeReferenceDirectiveName); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_not_set_root_directory_1, typeReferenceDirectiveName, typeRoots); + } + } + else { + if (typeRoots === undefined) { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_not_set, typeReferenceDirectiveName, containingFile); + } + else { + trace(host, ts.Diagnostics.Resolving_type_reference_directive_0_containing_file_1_root_directory_2, typeReferenceDirectiveName, containingFile, typeRoots); + } + } + } + var failedLookupLocations = []; + var resolved = primaryLookup(); + var primary = true; + if (!resolved) { + resolved = secondaryLookup(); + primary = false; + } + var resolvedTypeReferenceDirective; + if (resolved) { + if (!options.preserveSymlinks) { + resolved = __assign({}, resolved, { fileName: realpath(resolved.fileName, host, traceEnabled) }); + } + if (traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolved.fileName, primary); + } + resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolved.fileName, packageId: resolved.packageId }; + } + return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations }; + function primaryLookup() { + if (typeRoots && typeRoots.length) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_with_primary_search_path_0, typeRoots.join(", ")); + } + return ts.forEach(typeRoots, function (typeRoot) { + var candidate = ts.combinePaths(typeRoot, typeReferenceDirectiveName); + var candidateDirectory = ts.getDirectoryPath(candidate); + var directoryExists = directoryProbablyExists(candidateDirectory, host); + if (!directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidateDirectory); + } + return resolvedTypeScriptOnly(loadNodeModuleFromDirectory(Extensions.DtsOnly, candidate, failedLookupLocations, !directoryExists, moduleResolutionState)); + }); + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Root_directory_cannot_be_determined_skipping_primary_search_paths); + } + } + } + function secondaryLookup() { + var resolvedFile; + var initialLocationForSecondaryLookup = containingFile && ts.getDirectoryPath(containingFile); + if (initialLocationForSecondaryLookup !== undefined) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Looking_up_in_node_modules_folder_initial_location_0, initialLocationForSecondaryLookup); + } + var result = loadModuleFromNodeModules(Extensions.DtsOnly, typeReferenceDirectiveName, initialLocationForSecondaryLookup, failedLookupLocations, moduleResolutionState, undefined); + resolvedFile = resolvedTypeScriptOnly(result && result.value); + if (!resolvedFile && traceEnabled) { + trace(host, ts.Diagnostics.Type_reference_directive_0_was_not_resolved, typeReferenceDirectiveName); + } + return resolvedFile; + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Containing_file_is_not_specified_and_root_directory_cannot_be_determined_skipping_lookup_in_node_modules_folder); + } + } + } + } + ts.resolveTypeReferenceDirective = resolveTypeReferenceDirective; + function getAutomaticTypeDirectiveNames(options, host) { + if (options.types) { + return options.types; + } + var result = []; + if (host.directoryExists && host.getDirectories) { + var typeRoots = getEffectiveTypeRoots(options, host); + if (typeRoots) { + for (var _i = 0, typeRoots_1 = typeRoots; _i < typeRoots_1.length; _i++) { + var root = typeRoots_1[_i]; + if (host.directoryExists(root)) { + for (var _a = 0, _b = host.getDirectories(root); _a < _b.length; _a++) { + var typeDirectivePath = _b[_a]; + var normalized = ts.normalizePath(typeDirectivePath); + var packageJsonPath = pathToPackageJson(ts.combinePaths(root, normalized)); + var isNotNeededPackage = host.fileExists(packageJsonPath) && readJson(packageJsonPath, host).typings === null; + if (!isNotNeededPackage) { + result.push(ts.getBaseFileName(normalized)); + } + } + } + } + } + } + return result; + } + ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames; + function createModuleResolutionCache(currentDirectory, getCanonicalFileName) { + var directoryToModuleNameMap = ts.createMap(); + var moduleNameToDirectoryMap = ts.createMap(); + return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName }; + function getOrCreateCacheForDirectory(directoryName) { + var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName); + var perFolderCache = directoryToModuleNameMap.get(path); + if (!perFolderCache) { + perFolderCache = ts.createMap(); + directoryToModuleNameMap.set(path, perFolderCache); + } + return perFolderCache; + } + function getOrCreateCacheForModuleName(nonRelativeModuleName) { + if (ts.isExternalModuleNameRelative(nonRelativeModuleName)) { + return undefined; + } + var perModuleNameCache = moduleNameToDirectoryMap.get(nonRelativeModuleName); + if (!perModuleNameCache) { + perModuleNameCache = createPerModuleNameCache(); + moduleNameToDirectoryMap.set(nonRelativeModuleName, perModuleNameCache); + } + return perModuleNameCache; + } + function createPerModuleNameCache() { + var directoryPathMap = ts.createMap(); + return { get: get, set: set }; + function get(directory) { + return directoryPathMap.get(ts.toPath(directory, currentDirectory, getCanonicalFileName)); + } + function set(directory, result) { + var path = ts.toPath(directory, currentDirectory, getCanonicalFileName); + if (directoryPathMap.has(path)) { + return; + } + directoryPathMap.set(path, result); + var resolvedFileName = result.resolvedModule && result.resolvedModule.resolvedFileName; + var commonPrefix = getCommonPrefix(path, resolvedFileName); + var current = path; + while (true) { + var parent = ts.getDirectoryPath(current); + if (parent === current || directoryPathMap.has(parent)) { + break; + } + directoryPathMap.set(parent, result); + current = parent; + if (current === commonPrefix) { + break; + } + } + } + function getCommonPrefix(directory, resolution) { + if (resolution === undefined) { + return undefined; + } + var resolutionDirectory = ts.toPath(ts.getDirectoryPath(resolution), currentDirectory, getCanonicalFileName); + var i = 0; + while (i < Math.min(directory.length, resolutionDirectory.length) && directory.charCodeAt(i) === resolutionDirectory.charCodeAt(i)) { + i++; + } + var sep = directory.lastIndexOf(ts.directorySeparator, i); + if (sep < 0) { + return undefined; + } + return directory.substr(0, sep); + } + } + } + ts.createModuleResolutionCache = createModuleResolutionCache; + function resolveModuleName(moduleName, containingFile, compilerOptions, host, cache) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_module_0_from_1, moduleName, containingFile); + } + var containingDirectory = ts.getDirectoryPath(containingFile); + var perFolderCache = cache && cache.getOrCreateCacheForDirectory(containingDirectory); + var result = perFolderCache && perFolderCache.get(moduleName); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + } + else { + var moduleResolution = compilerOptions.moduleResolution; + if (moduleResolution === undefined) { + moduleResolution = ts.getEmitModuleKind(compilerOptions) === ts.ModuleKind.CommonJS ? ts.ModuleResolutionKind.NodeJs : ts.ModuleResolutionKind.Classic; + if (traceEnabled) { + trace(host, ts.Diagnostics.Module_resolution_kind_is_not_specified_using_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + else { + if (traceEnabled) { + trace(host, ts.Diagnostics.Explicitly_specified_module_resolution_kind_Colon_0, ts.ModuleResolutionKind[moduleResolution]); + } + } + switch (moduleResolution) { + case ts.ModuleResolutionKind.NodeJs: + result = nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + case ts.ModuleResolutionKind.Classic: + result = classicNameResolver(moduleName, containingFile, compilerOptions, host, cache); + break; + default: + ts.Debug.fail("Unexpected moduleResolution: " + moduleResolution); + } + if (perFolderCache) { + perFolderCache.set(moduleName, result); + var perModuleNameCache = cache.getOrCreateCacheForModuleName(moduleName); + if (perModuleNameCache) { + perModuleNameCache.set(containingDirectory, result); + } + } + } + if (traceEnabled) { + if (result.resolvedModule) { + trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName); + } + else { + trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName); + } + } + return result; + } + ts.resolveModuleName = resolveModuleName; + function tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { + if (!ts.isExternalModuleNameRelative(moduleName)) { + return tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state); + } + else { + return tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); + } + } + function tryLoadModuleUsingRootDirs(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state) { + if (!state.compilerOptions.rootDirs) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0, moduleName); + } + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + var matchedRootDir; + var matchedNormalizedPrefix; + for (var _i = 0, _a = state.compilerOptions.rootDirs; _i < _a.length; _i++) { + var rootDir = _a[_i]; + var normalizedRoot = ts.normalizePath(rootDir); + if (!ts.endsWith(normalizedRoot, ts.directorySeparator)) { + normalizedRoot += ts.directorySeparator; + } + var isLongestMatchingPrefix = ts.startsWith(candidate, normalizedRoot) && + (matchedNormalizedPrefix === undefined || matchedNormalizedPrefix.length < normalizedRoot.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Checking_if_0_is_the_longest_matching_prefix_for_1_2, normalizedRoot, candidate, isLongestMatchingPrefix); + } + if (isLongestMatchingPrefix) { + matchedNormalizedPrefix = normalizedRoot; + matchedRootDir = rootDir; + } + } + if (matchedNormalizedPrefix) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Longest_matching_prefix_for_0_is_1, candidate, matchedNormalizedPrefix); + } + var suffix = candidate.substr(matchedNormalizedPrefix.length); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, matchedNormalizedPrefix, candidate); + } + var resolvedFileName = loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(containingDirectory, state.host), state); + if (resolvedFileName) { + return resolvedFileName; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_other_entries_in_rootDirs); + } + for (var _b = 0, _c = state.compilerOptions.rootDirs; _b < _c.length; _b++) { + var rootDir = _c[_b]; + if (rootDir === matchedRootDir) { + continue; + } + var candidate_1 = ts.combinePaths(ts.normalizePath(rootDir), suffix); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_0_from_the_root_dir_1_candidate_location_2, suffix, rootDir, candidate_1); + } + var baseDirectory = ts.getDirectoryPath(candidate_1); + var resolvedFileName_1 = loader(extensions, candidate_1, failedLookupLocations, !directoryProbablyExists(baseDirectory, state.host), state); + if (resolvedFileName_1) { + return resolvedFileName_1; + } + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_resolution_using_rootDirs_has_failed); + } + } + return undefined; + } + function tryLoadModuleUsingBaseUrl(extensions, moduleName, loader, failedLookupLocations, state) { + if (!state.compilerOptions.baseUrl) { + return undefined; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.baseUrl_option_is_set_to_0_using_this_value_to_resolve_non_relative_module_name_1, state.compilerOptions.baseUrl, moduleName); + } + var matchedPattern = undefined; + if (state.compilerOptions.paths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0, moduleName); + } + matchedPattern = ts.matchPatternOrExact(ts.getOwnKeys(state.compilerOptions.paths), moduleName); + } + if (matchedPattern) { + var matchedStar_1 = typeof matchedPattern === "string" ? undefined : ts.matchedText(matchedPattern, moduleName); + var matchedPatternText = typeof matchedPattern === "string" ? matchedPattern : ts.patternText(matchedPattern); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Module_name_0_matched_pattern_1, moduleName, matchedPatternText); + } + return ts.forEach(state.compilerOptions.paths[matchedPatternText], function (subst) { + var path = matchedStar_1 ? subst.replace("*", matchedStar_1) : subst; + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, path)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Trying_substitution_0_candidate_module_location_Colon_1, subst, path); + } + var extension = ts.tryGetExtensionFromPath(candidate); + if (extension !== undefined) { + var path_1 = tryFile(candidate, failedLookupLocations, false, state); + if (path_1 !== undefined) { + return noPackageId({ path: path_1, ext: extension }); + } + } + return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + }); + } + else { + var candidate = ts.normalizePath(ts.combinePaths(state.compilerOptions.baseUrl, moduleName)); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Resolving_module_name_0_relative_to_base_url_1_2, moduleName, state.compilerOptions.baseUrl, candidate); + } + return loader(extensions, candidate, failedLookupLocations, !directoryProbablyExists(ts.getDirectoryPath(candidate), state.host), state); + } + } + function nodeModuleNameResolver(moduleName, containingFile, compilerOptions, host, cache) { + return nodeModuleNameResolverWorker(moduleName, ts.getDirectoryPath(containingFile), compilerOptions, host, cache, false); + } + ts.nodeModuleNameResolver = nodeModuleNameResolver; + function resolveJavaScriptModule(moduleName, initialDir, host) { + var _a = nodeModuleNameResolverWorker(moduleName, initialDir, { moduleResolution: ts.ModuleResolutionKind.NodeJs, allowJs: true }, host, undefined, true), resolvedModule = _a.resolvedModule, failedLookupLocations = _a.failedLookupLocations; + if (!resolvedModule) { + throw new Error("Could not resolve JS module '" + moduleName + "' starting at '" + initialDir + "'. Looked in: " + failedLookupLocations.join(", ")); + } + return resolvedModule.resolvedFileName; + } + ts.resolveJavaScriptModule = resolveJavaScriptModule; + function nodeModuleNameResolverWorker(moduleName, containingDirectory, compilerOptions, host, cache, jsOnly) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + var failedLookupLocations = []; + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; + var result = jsOnly ? tryResolve(Extensions.JavaScript) : (tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript)); + if (result && result.value) { + var _a = result.value, resolved = _a.resolved, isExternalLibraryImport = _a.isExternalLibraryImport; + return createResolvedModuleWithFailedLookupLocations(resolved, isExternalLibraryImport, failedLookupLocations); + } + return { resolvedModule: undefined, failedLookupLocations: failedLookupLocations }; + function tryResolve(extensions) { + var loader = function (extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { return nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, true); }; + var resolved = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loader, failedLookupLocations, state); + if (resolved) { + return toSearchResult({ resolved: resolved, isExternalLibraryImport: false }); + } + if (!ts.isExternalModuleNameRelative(moduleName)) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Loading_module_0_from_node_modules_folder_target_file_type_1, moduleName, Extensions[extensions]); + } + var resolved_1 = loadModuleFromNodeModules(extensions, moduleName, containingDirectory, failedLookupLocations, state, cache); + if (!resolved_1) + return undefined; + var resolvedValue = resolved_1.value; + if (!compilerOptions.preserveSymlinks) { + resolvedValue = resolvedValue && __assign({}, resolved_1.value, { path: realpath(resolved_1.value.path, host, traceEnabled), extension: resolved_1.value.extension }); + } + return { value: resolvedValue && { resolved: resolvedValue, isExternalLibraryImport: true } }; + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + var resolved_2 = nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, false, state, true); + return resolved_2 && toSearchResult({ resolved: resolved_2, isExternalLibraryImport: false }); + } + } + } + function realpath(path, host, traceEnabled) { + if (!host.realpath) { + return path; + } + var real = ts.normalizePath(host.realpath(path)); + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolving_real_path_for_0_result_1, path, real); + } + return real; + } + function nodeLoadModuleByRelativeName(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Loading_module_as_file_Slash_folder_candidate_module_location_0_target_file_type_1, candidate, Extensions[extensions]); + } + if (!ts.pathEndsWithDirectorySeparator(candidate)) { + if (!onlyRecordFailures) { + var parentOfCandidate = ts.getDirectoryPath(candidate); + if (!directoryProbablyExists(parentOfCandidate, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, parentOfCandidate); + } + onlyRecordFailures = true; + } + } + var resolvedFromFile = loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state); + if (resolvedFromFile) { + return noPackageId(resolvedFromFile); + } + } + if (!onlyRecordFailures) { + var candidateExists = directoryProbablyExists(candidate, state.host); + if (!candidateExists) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, candidate); + } + onlyRecordFailures = true; + } + } + return loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson); + } + function directoryProbablyExists(directoryName, host) { + return !host.directoryExists || host.directoryExists(directoryName); + } + ts.directoryProbablyExists = directoryProbablyExists; + function loadModuleFromFileNoPackageId(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { + return noPackageId(loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state)); + } + function loadModuleFromFile(extensions, candidate, failedLookupLocations, onlyRecordFailures, state) { + var resolvedByAddingExtension = tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state); + if (resolvedByAddingExtension) { + return resolvedByAddingExtension; + } + if (ts.hasJavaScriptFileExtension(candidate)) { + var extensionless = ts.removeFileExtension(candidate); + if (state.traceEnabled) { + var extension = candidate.substring(extensionless.length); + trace(state.host, ts.Diagnostics.File_name_0_has_a_1_extension_stripping_it, candidate, extension); + } + return tryAddingExtensions(extensionless, extensions, failedLookupLocations, onlyRecordFailures, state); + } + } + function tryAddingExtensions(candidate, extensions, failedLookupLocations, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + var directory = ts.getDirectoryPath(candidate); + if (directory) { + onlyRecordFailures = !directoryProbablyExists(directory, state.host); + } + } + switch (extensions) { + case Extensions.DtsOnly: + return tryExtension(".d.ts"); + case Extensions.TypeScript: + return tryExtension(".ts") || tryExtension(".tsx") || tryExtension(".d.ts"); + case Extensions.JavaScript: + return tryExtension(".js") || tryExtension(".jsx"); + } + function tryExtension(ext) { + var path = tryFile(candidate + ext, failedLookupLocations, onlyRecordFailures, state); + return path && { path: path, ext: ext }; + } + } + function tryFile(fileName, failedLookupLocations, onlyRecordFailures, state) { + if (!onlyRecordFailures) { + if (state.host.fileExists(fileName)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_exist_use_it_as_a_name_resolution_result, fileName); + } + return fileName; + } + else { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_does_not_exist, fileName); + } + } + } + failedLookupLocations.push(fileName); + return undefined; + } + function loadNodeModuleFromDirectory(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, considerPackageJson) { + if (considerPackageJson === void 0) { considerPackageJson = true; } + var _a = considerPackageJson + ? getPackageJsonInfo(candidate, "", failedLookupLocations, onlyRecordFailures, state) + : { packageJsonContent: undefined, packageId: undefined }, packageJsonContent = _a.packageJsonContent, packageId = _a.packageId; + return withPackageId(packageId, loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, packageJsonContent)); + } + function loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, onlyRecordFailures, state, packageJsonContent) { + var fromPackageJson = packageJsonContent && loadModuleFromPackageJson(packageJsonContent, extensions, candidate, failedLookupLocations, state); + if (fromPackageJson) { + return fromPackageJson; + } + var directoryExists = !onlyRecordFailures && directoryProbablyExists(candidate, state.host); + return loadModuleFromFile(extensions, ts.combinePaths(candidate, "index"), failedLookupLocations, !directoryExists, state); + } + function getPackageJsonInfo(nodeModuleDirectory, subModuleName, failedLookupLocations, onlyRecordFailures, _a) { + var host = _a.host, traceEnabled = _a.traceEnabled; + var directoryExists = !onlyRecordFailures && directoryProbablyExists(nodeModuleDirectory, host); + var packageJsonPath = pathToPackageJson(nodeModuleDirectory); + if (directoryExists && host.fileExists(packageJsonPath)) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath); + } + var packageJsonContent = readJson(packageJsonPath, host); + var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string" + ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version } + : undefined; + return { packageJsonContent: packageJsonContent, packageId: packageId }; + } + else { + if (directoryExists && traceEnabled) { + trace(host, ts.Diagnostics.File_0_does_not_exist, packageJsonPath); + } + failedLookupLocations.push(packageJsonPath); + return { packageJsonContent: undefined, packageId: undefined }; + } + } + function loadModuleFromPackageJson(jsonContent, extensions, candidate, failedLookupLocations, state) { + var file = tryReadPackageJsonFields(extensions !== Extensions.JavaScript, jsonContent, candidate, state); + if (!file) { + return undefined; + } + var onlyRecordFailures = !directoryProbablyExists(ts.getDirectoryPath(file), state.host); + var fromFile = tryFile(file, failedLookupLocations, onlyRecordFailures, state); + if (fromFile) { + var resolved = fromFile && resolvedIfExtensionMatches(extensions, fromFile); + if (resolved) { + return resolved; + } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.File_0_has_an_unsupported_extension_so_skipping_it, fromFile); + } + } + var nextExtensions = extensions === Extensions.DtsOnly ? Extensions.TypeScript : extensions; + var result = nodeLoadModuleByRelativeName(nextExtensions, file, failedLookupLocations, onlyRecordFailures, state, false); + if (result) { + ts.Debug.assert(result.packageId === undefined); + return { path: result.path, ext: result.extension }; + } + } + function resolvedIfExtensionMatches(extensions, path) { + var ext = ts.tryGetExtensionFromPath(path); + return ext !== undefined && extensionIsOk(extensions, ext) ? { path: path, ext: ext } : undefined; + } + function extensionIsOk(extensions, extension) { + switch (extensions) { + case Extensions.JavaScript: + return extension === ".js" || extension === ".jsx"; + case Extensions.TypeScript: + return extension === ".ts" || extension === ".tsx" || extension === ".d.ts"; + case Extensions.DtsOnly: + return extension === ".d.ts"; + } + } + function pathToPackageJson(directory) { + return ts.combinePaths(directory, "package.json"); + } + function loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state) { + var _a = getPackageName(moduleName), packageName = _a.packageName, rest = _a.rest; + var packageRootPath = ts.combinePaths(nodeModulesFolder, packageName); + var _b = getPackageJsonInfo(packageRootPath, rest, failedLookupLocations, !nodeModulesFolderExists, state), packageJsonContent = _b.packageJsonContent, packageId = _b.packageId; + var candidate = ts.normalizePath(ts.combinePaths(nodeModulesFolder, moduleName)); + var pathAndExtension = loadModuleFromFile(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state) || + loadNodeModuleFromDirectoryWorker(extensions, candidate, failedLookupLocations, !nodeModulesFolderExists, state, packageJsonContent); + return withPackageId(packageId, pathAndExtension); + } + function getPackageName(moduleName) { + var idx = moduleName.indexOf(ts.directorySeparator); + if (moduleName[0] === "@") { + idx = moduleName.indexOf(ts.directorySeparator, idx + 1); + } + return idx === -1 ? { packageName: moduleName, rest: "" } : { packageName: moduleName.slice(0, idx), rest: moduleName.slice(idx + 1) }; + } + function loadModuleFromNodeModules(extensions, moduleName, directory, failedLookupLocations, state, cache) { + return loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, false, cache); + } + function loadModuleFromNodeModulesAtTypes(moduleName, directory, failedLookupLocations, state) { + return loadModuleFromNodeModulesWorker(Extensions.DtsOnly, moduleName, directory, failedLookupLocations, state, true, undefined); + } + function loadModuleFromNodeModulesWorker(extensions, moduleName, directory, failedLookupLocations, state, typesOnly, cache) { + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); + return forEachAncestorDirectory(ts.normalizeSlashes(directory), function (ancestorDirectory) { + if (ts.getBaseFileName(ancestorDirectory) !== "node_modules") { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, ancestorDirectory, state.traceEnabled, state.host); + if (resolutionFromCache) { + return resolutionFromCache; + } + return toSearchResult(loadModuleFromNodeModulesOneLevel(extensions, moduleName, ancestorDirectory, failedLookupLocations, state, typesOnly)); + } + }); + } + function loadModuleFromNodeModulesOneLevel(extensions, moduleName, directory, failedLookupLocations, state, typesOnly) { + if (typesOnly === void 0) { typesOnly = false; } + var nodeModulesFolder = ts.combinePaths(directory, "node_modules"); + var nodeModulesFolderExists = directoryProbablyExists(nodeModulesFolder, state.host); + if (!nodeModulesFolderExists && state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesFolder); + } + var packageResult = typesOnly ? undefined : loadModuleFromNodeModulesFolder(extensions, moduleName, nodeModulesFolder, nodeModulesFolderExists, failedLookupLocations, state); + if (packageResult) { + return packageResult; + } + if (extensions !== Extensions.JavaScript) { + var nodeModulesAtTypes_1 = ts.combinePaths(nodeModulesFolder, "@types"); + var nodeModulesAtTypesExists = nodeModulesFolderExists; + if (nodeModulesFolderExists && !directoryProbablyExists(nodeModulesAtTypes_1, state.host)) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Directory_0_does_not_exist_skipping_all_lookups_in_it, nodeModulesAtTypes_1); + } + nodeModulesAtTypesExists = false; + } + return loadModuleFromNodeModulesFolder(Extensions.DtsOnly, mangleScopedPackage(moduleName, state), nodeModulesAtTypes_1, nodeModulesAtTypesExists, failedLookupLocations, state); + } + } + var mangledScopedPackageSeparator = "__"; + function mangleScopedPackage(moduleName, state) { + if (ts.startsWith(moduleName, "@")) { + var replaceSlash = moduleName.replace(ts.directorySeparator, mangledScopedPackageSeparator); + if (replaceSlash !== moduleName) { + var mangled = replaceSlash.slice(1); + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Scoped_package_detected_looking_in_0, mangled); + } + return mangled; + } + } + return moduleName; + } + function getPackageNameFromAtTypesDirectory(mangledName) { + var withoutAtTypePrefix = ts.removePrefix(mangledName, "@types/"); + if (withoutAtTypePrefix !== mangledName) { + return withoutAtTypePrefix.indexOf(mangledScopedPackageSeparator) !== -1 ? + "@" + withoutAtTypePrefix.replace(mangledScopedPackageSeparator, ts.directorySeparator) : + withoutAtTypePrefix; + } + return mangledName; + } + ts.getPackageNameFromAtTypesDirectory = getPackageNameFromAtTypesDirectory; + function tryFindNonRelativeModuleNameInCache(cache, moduleName, containingDirectory, traceEnabled, host) { + var result = cache && cache.get(containingDirectory); + if (result) { + if (traceEnabled) { + trace(host, ts.Diagnostics.Resolution_for_module_0_was_found_in_cache, moduleName); + } + return { value: result.resolvedModule && { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId } }; + } + } + function classicNameResolver(moduleName, containingFile, compilerOptions, host, cache) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; + var failedLookupLocations = []; + var containingDirectory = ts.getDirectoryPath(containingFile); + var resolved = tryResolve(Extensions.TypeScript) || tryResolve(Extensions.JavaScript); + return createResolvedModuleWithFailedLookupLocations(resolved && resolved.value, false, failedLookupLocations); + function tryResolve(extensions) { + var resolvedUsingSettings = tryLoadModuleUsingOptionalResolutionSettings(extensions, moduleName, containingDirectory, loadModuleFromFileNoPackageId, failedLookupLocations, state); + if (resolvedUsingSettings) { + return { value: resolvedUsingSettings }; + } + var perModuleNameCache = cache && cache.getOrCreateCacheForModuleName(moduleName); + if (!ts.isExternalModuleNameRelative(moduleName)) { + var resolved_3 = forEachAncestorDirectory(containingDirectory, function (directory) { + var resolutionFromCache = tryFindNonRelativeModuleNameInCache(perModuleNameCache, moduleName, directory, traceEnabled, host); + if (resolutionFromCache) { + return resolutionFromCache; + } + var searchName = ts.normalizePath(ts.combinePaths(directory, moduleName)); + return toSearchResult(loadModuleFromFileNoPackageId(extensions, searchName, failedLookupLocations, false, state)); + }); + if (resolved_3) { + return resolved_3; + } + if (extensions === Extensions.TypeScript) { + return loadModuleFromNodeModulesAtTypes(moduleName, containingDirectory, failedLookupLocations, state); + } + } + else { + var candidate = ts.normalizePath(ts.combinePaths(containingDirectory, moduleName)); + return toSearchResult(loadModuleFromFileNoPackageId(extensions, candidate, failedLookupLocations, false, state)); + } + } + } + ts.classicNameResolver = classicNameResolver; + function loadModuleFromGlobalCache(moduleName, projectName, compilerOptions, host, globalCache) { + var traceEnabled = isTraceEnabled(compilerOptions, host); + if (traceEnabled) { + trace(host, ts.Diagnostics.Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using_cache_location_2, projectName, moduleName, globalCache); + } + var state = { compilerOptions: compilerOptions, host: host, traceEnabled: traceEnabled }; + var failedLookupLocations = []; + var resolved = loadModuleFromNodeModulesOneLevel(Extensions.DtsOnly, moduleName, globalCache, failedLookupLocations, state); + return createResolvedModuleWithFailedLookupLocations(resolved, true, failedLookupLocations); + } + ts.loadModuleFromGlobalCache = loadModuleFromGlobalCache; + function toSearchResult(value) { + return value !== undefined ? { value: value } : undefined; + } + function forEachAncestorDirectory(directory, callback) { + while (true) { + var result = callback(directory); + if (result !== undefined) { + return result; + } + var parentPath = ts.getDirectoryPath(directory); + if (parentPath === directory) { + return undefined; + } + directory = parentPath; + } + } +})(ts || (ts = {})); +var ts; +(function (ts) { var ModuleInstanceState; (function (ModuleInstanceState) { ModuleInstanceState[ModuleInstanceState["NonInstantiated"] = 0] = "NonInstantiated"; @@ -21741,7 +18509,7 @@ var ts; options = opts; languageVersion = ts.getEmitScriptTarget(options); inStrictMode = bindInStrictMode(file, opts); - classifiableNames = ts.createMap(); + classifiableNames = ts.createUnderscoreEscapedMap(); symbolCount = 0; skipTransformFlagAggregation = file.isDeclarationFile; Symbol = ts.objectAllocator.getSymbolConstructor(); @@ -21790,10 +18558,10 @@ var ts; } symbol.declarations.push(node); if (symbolFlags & 1952 && !symbol.exports) { - symbol.exports = ts.createMap(); + symbol.exports = ts.createSymbolTable(); } if (symbolFlags & 6240 && !symbol.members) { - symbol.members = ts.createMap(); + symbol.members = ts.createSymbolTable(); } if (symbolFlags & 107455) { var valueDeclaration = symbol.valueDeclaration; @@ -21807,17 +18575,18 @@ var ts; var name = ts.getNameOfDeclaration(node); if (name) { if (ts.isAmbientModule(node)) { - return ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + name.text + "\""; + var moduleName = ts.getTextOfIdentifierOrLiteral(name); + return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\""); } if (name.kind === 144) { var nameExpression = name.expression; if (ts.isStringOrNumericLiteral(nameExpression)) { - return nameExpression.text; + return ts.escapeLeadingUnderscores(nameExpression.text); } ts.Debug.assert(ts.isWellKnownSymbolSyntactically(nameExpression)); - return ts.getPropertyNameForKnownSymbolName(nameExpression.name.text); + return ts.getPropertyNameForKnownSymbolName(ts.unescapeLeadingUnderscores(nameExpression.name.escapedText)); } - return name.text; + return ts.getEscapedTextOfIdentifierOrLiteral(name); } switch (node.kind) { case 152: @@ -21842,22 +18611,22 @@ var ts; break; case 228: case 229: - return ts.hasModifier(node, 512) ? "default" : undefined; - case 279: - return ts.isJSDocConstructSignature(node) ? "__new" : "__call"; + return (ts.hasModifier(node, 512) ? "default" : undefined); + case 273: + return (ts.isJSDocConstructSignature(node) ? "__new" : "__call"); case 146: - ts.Debug.assert(node.parent.kind === 279); + ts.Debug.assert(node.parent.kind === 273); var functionType = node.parent; var index = ts.indexOf(functionType.parameters, node); return "arg" + index; - case 291: + case 283: var parentNode = node.parent && node.parent.parent; var nameFromParentNode = void 0; if (parentNode && parentNode.kind === 208) { if (parentNode.declarationList.declarations.length > 0) { var nameIdentifier = parentNode.declarationList.declarations[0].name; - if (nameIdentifier.kind === 71) { - nameFromParentNode = nameIdentifier.text; + if (ts.isIdentifier(nameIdentifier)) { + nameFromParentNode = nameIdentifier.escapedText; } } } @@ -21865,9 +18634,9 @@ var ts; } } function getDisplayName(node) { - return node.name ? ts.declarationNameToString(node.name) : getDeclarationName(node); + return node.name ? ts.declarationNameToString(node.name) : ts.unescapeLeadingUnderscores(getDeclarationName(node)); } - function declareSymbol(symbolTable, parent, node, includes, excludes) { + function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod) { ts.Debug.assert(!ts.hasDynamicName(node)); var isDefaultExport = ts.hasModifier(node, 512); var name = isDefaultExport && parent ? "default" : getDeclarationName(node); @@ -21877,13 +18646,18 @@ var ts; } else { symbol = symbolTable.get(name); + if (includes & 788448) { + classifiableNames.set(name, true); + } if (!symbol) { symbolTable.set(name, symbol = createSymbol(0, name)); + if (isReplaceableByMethod) + symbol.isReplaceableByMethod = true; } - if (name && (includes & 788448)) { - classifiableNames.set(name, name); + else if (isReplaceableByMethod && !symbol.isReplaceableByMethod) { + return symbol; } - if (symbol.flags & excludes) { + else if (symbol.flags & excludes) { if (symbol.isReplaceableByMethod) { symbolTable.set(name, symbol = createSymbol(0, name)); } @@ -21919,7 +18693,7 @@ var ts; } function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = ts.getCombinedModifierFlags(node) & 1; - if (symbolFlags & 8388608) { + if (symbolFlags & 2097152) { if (node.kind === 246 || (node.kind === 237 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } @@ -21928,16 +18702,14 @@ var ts; } } else { - if (node.kind === 291) + if (node.kind === 283) ts.Debug.assert(ts.isInJavaScriptFile(node)); - var isJSDocTypedefInJSDocNamespace = node.kind === 291 && + var isJSDocTypedefInJSDocNamespace = node.kind === 283 && node.name && node.name.kind === 71 && node.name.isInJSDocNamespace; if ((!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 32)) || isJSDocTypedefInJSDocNamespace) { - var exportKind = (symbolFlags & 107455 ? 1048576 : 0) | - (symbolFlags & 793064 ? 2097152 : 0) | - (symbolFlags & 1920 ? 4194304 : 0); + var exportKind = symbolFlags & 107455 ? 1048576 : 0; var local = declareSymbol(container.locals, undefined, node, exportKind, symbolExcludes); local.exportSymbol = declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); node.localSymbol = local; @@ -21954,7 +18726,7 @@ var ts; if (containerFlags & 1) { container = blockScopeContainer = node; if (containerFlags & 32) { - container.locals = ts.createMap(); + container.locals = ts.createSymbolTable(); } addToContainerChain(container); } @@ -22138,10 +18910,10 @@ var ts; case 181: bindCallExpressionFlow(node); break; - case 283: + case 275: bindJSDocComment(node); break; - case 291: + case 283: bindJSDocTypedefTag(node); break; default: @@ -22257,40 +19029,23 @@ var ts; return antecedent; } setFlowNodeReferenced(antecedent); - return { - flags: flags, - expression: expression, - antecedent: antecedent - }; + return { flags: flags, expression: expression, antecedent: antecedent }; } function createFlowSwitchClause(antecedent, switchStatement, clauseStart, clauseEnd) { if (!isNarrowingExpression(switchStatement.expression)) { return antecedent; } setFlowNodeReferenced(antecedent); - return { - flags: 128, - switchStatement: switchStatement, - clauseStart: clauseStart, - clauseEnd: clauseEnd, - antecedent: antecedent - }; + return { flags: 128, switchStatement: switchStatement, clauseStart: clauseStart, clauseEnd: clauseEnd, antecedent: antecedent }; } function createFlowAssignment(antecedent, node) { setFlowNodeReferenced(antecedent); - return { - flags: 16, - antecedent: antecedent, - node: node - }; + return { flags: 16, antecedent: antecedent, node: node }; } function createFlowArrayMutation(antecedent, node) { setFlowNodeReferenced(antecedent); - return { - flags: 256, - antecedent: antecedent, - node: node - }; + var res = { flags: 256, antecedent: antecedent, node: node }; + return res; } function finishFlowLabel(flow) { var antecedents = flow.antecedents; @@ -22462,7 +19217,7 @@ var ts; function bindBreakOrContinueStatement(node) { bind(node.label); if (node.label) { - var activeLabel = findActiveLabel(node.label.text); + var activeLabel = findActiveLabel(node.label.escapedText); if (activeLabel) { activeLabel.referenced = true; bindBreakOrContinueFlow(node, activeLabel.breakTarget, activeLabel.continueTarget); @@ -22575,7 +19330,7 @@ var ts; var postStatementLabel = createBranchLabel(); bind(node.label); addAntecedent(preStatementLabel, currentFlow); - var activeLabel = pushActiveLabel(node.label.text, postStatementLabel, preStatementLabel); + var activeLabel = pushActiveLabel(node.label.escapedText, postStatementLabel, preStatementLabel); bind(node.statement); popActiveLabel(); if (!activeLabel.referenced && !options.allowUnusedLabels) { @@ -22724,7 +19479,7 @@ var ts; } function bindJSDocComment(node) { ts.forEachChild(node, function (n) { - if (n.kind !== 291) { + if (n.kind !== 283) { bind(n); } }); @@ -22764,13 +19519,11 @@ var ts; case 232: case 178: case 163: - case 293: - case 275: + case 285: case 254: return 1; case 230: return 1 | 64; - case 279: case 233: case 231: case 172: @@ -22787,9 +19540,10 @@ var ts; case 153: case 154: case 155: + case 273: + case 160: case 156: case 157: - case 160: case 161: return 1 | 4 | 32 | 8; case 186: @@ -22831,10 +19585,9 @@ var ts; case 232: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); case 163: + case 285: case 178: case 230: - case 275: - case 293: case 254: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); case 160: @@ -22850,7 +19603,7 @@ var ts; case 228: case 186: case 187: - case 279: + case 273: case 231: case 172: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); @@ -22941,8 +19694,8 @@ var ts; addDeclarationToSymbol(symbol, node, 131072); var typeLiteralSymbol = createSymbol(2048, "__type"); addDeclarationToSymbol(typeLiteralSymbol, node, 2048); - typeLiteralSymbol.members = ts.createMap(); - typeLiteralSymbol.members.set(symbol.name, symbol); + typeLiteralSymbol.members = ts.createSymbolTable(); + typeLiteralSymbol.members.set(symbol.escapedName, symbol); } function bindObjectLiteralExpression(node) { var ElementKind; @@ -22951,7 +19704,7 @@ var ts; ElementKind[ElementKind["Accessor"] = 2] = "Accessor"; })(ElementKind || (ElementKind = {})); if (inStrictMode) { - var seen = ts.createMap(); + var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; if (prop.kind === 263 || prop.name.kind !== 71) { @@ -22961,9 +19714,9 @@ var ts; var currentKind = prop.kind === 261 || prop.kind === 262 || prop.kind === 151 ? 1 : 2; - var existingKind = seen.get(identifier.text); + var existingKind = seen.get(identifier.escapedText); if (!existingKind) { - seen.set(identifier.text, currentKind); + seen.set(identifier.escapedText, currentKind); continue; } if (currentKind === 1 && existingKind === 1) { @@ -22996,7 +19749,7 @@ var ts; } default: if (!blockScopeContainer.locals) { - blockScopeContainer.locals = ts.createMap(); + blockScopeContainer.locals = ts.createSymbolTable(); addToContainerChain(blockScopeContainer); } declareSymbol(blockScopeContainer.locals, undefined, node, symbolFlags, symbolExcludes); @@ -23042,15 +19795,14 @@ var ts; } } function isEvalOrArgumentsIdentifier(node) { - return node.kind === 71 && - (node.text === "eval" || node.text === "arguments"); + return ts.isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === "arguments"); } function checkStrictModeEvalOrArguments(contextNode, name) { if (name && name.kind === 71) { var identifier = name; if (isEvalOrArgumentsIdentifier(identifier)) { var span_3 = ts.getErrorSpanForNode(file, name); - file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_3.start, span_3.length, getStrictModeEvalOrArgumentsMessage(contextNode), identifier.text)); + file.bindDiagnostics.push(ts.createFileDiagnostic(file, span_3.start, span_3.length, getStrictModeEvalOrArgumentsMessage(contextNode), ts.unescapeLeadingUnderscores(identifier.escapedText))); } } } @@ -23113,9 +19865,6 @@ var ts; var span = ts.getSpanOfTokenAtPosition(file, node.pos); file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, message, arg0, arg1, arg2)); } - function getDestructuringParameterName(node) { - return "__" + ts.indexOf(node.parent.parameters, node); - } function bind(node) { if (!node) { return; @@ -23153,7 +19902,7 @@ var ts; } for (var _b = 0, _c = jsDoc.tags; _b < _c.length; _b++) { var tag = _c[_b]; - if (tag.kind === 291) { + if (tag.kind === 283) { var savedParent = parent; parent = jsDoc; bind(tag); @@ -23164,8 +19913,8 @@ var ts; } function updateStrictModeStatementList(statements) { if (!inStrictMode) { - for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { - var statement = statements_2[_i]; + for (var _i = 0, statements_1 = statements; _i < statements_1.length; _i++) { + var statement = statements_1[_i]; if (!ts.isPrologueDirective(statement)) { return; } @@ -23185,7 +19934,7 @@ var ts; case 71: if (node.isInJSDocNamespace) { var parentNode = node.parent; - while (parentNode && parentNode.kind !== 291) { + while (parentNode && parentNode.kind !== 283) { parentNode = parentNode.parent; } bindBlockScopedDeclaration(parentNode, 524288, 793064); @@ -23247,7 +19996,9 @@ var ts; case 146: return bindParameter(node); case 226: + return bindVariableDeclarationOrBindingElement(node); case 176: + node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); case 149: case 148: @@ -23257,28 +20008,13 @@ var ts; return bindPropertyOrMethodOrAccessor(node, 4, 0); case 264: return bindPropertyOrMethodOrAccessor(node, 8, 900095); - case 263: - case 255: - var root = container; - var hasRest = false; - while (root.parent) { - if (root.kind === 178 && - root.parent.kind === 194 && - root.parent.operatorToken.kind === 58 && - root.parent.left === root) { - hasRest = true; - break; - } - root = root.parent; - } - return; case 155: case 156: case 157: return declareSymbolAndAddToSymbolTable(node, 131072, 0); case 151: case 150: - return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 67108864 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); + return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 16777216 : 0), ts.isObjectLiteralMethod(node) ? 0 : 99263); case 228: return bindFunctionDeclaration(node); case 152: @@ -23288,9 +20024,11 @@ var ts; case 154: return bindPropertyOrMethodOrAccessor(node, 65536, 74687); case 160: + case 273: case 161: return bindFunctionOrConstructorType(node); case 163: + case 285: case 172: return bindAnonymousTypeWorker(node); case 178: @@ -23323,7 +20061,7 @@ var ts; case 240: case 242: case 246: - return declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + return declareSymbolAndAddToSymbolTable(node, 2097152, 2097152); case 236: return bindNamespaceExportDeclaration(node); case 239: @@ -23341,17 +20079,17 @@ var ts; } case 234: return updateStrictModeStatementList(node.statements); - case 276: - return bindPropertyWorker(node); - case 292: - return declareSymbolAndAddToSymbolTable(node, node.isBracketed || (node.typeExpression && node.typeExpression.type.kind === 278) ? - 4 | 67108864 : 4, 0); case 279: - return bindFunctionOrConstructorType(node); - case 293: - case 275: - return bindAnonymousTypeWorker(node); - case 291: { + if (node.parent.kind !== 285) { + break; + } + case 284: + var propTag = node; + var flags = propTag.isBracketed || propTag.typeExpression.type.kind === 272 ? + 4 | 16777216 : + 4; + return declareSymbolAndAddToSymbolTable(propTag, flags, 0); + case 283: { var fullName = node.fullName; if (!fullName || fullName.kind === 71) { return bindBlockScopedDeclaration(node, 524288, 793064); @@ -23361,7 +20099,7 @@ var ts; } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 67108864 : 0), 0); + return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 16777216 : 0), 0); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048, "__type"); @@ -23387,13 +20125,13 @@ var ts; } function bindExportAssignment(node) { if (!container.symbol || !container.symbol.exports) { - bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); + bindAnonymousDeclaration(node, 2097152, getDeclarationName(node)); } else { var flags = node.kind === 243 && ts.exportAssignmentIsAlias(node) - ? 8388608 + ? 2097152 : 4; - declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 8388608 | 32 | 16); + declareSymbol(container.symbol.exports, container.symbol, node, flags, 4 | 2097152 | 32 | 16); } } function bindNamespaceExportDeclaration(node) { @@ -23415,20 +20153,20 @@ var ts; return; } } - file.symbol.globalExports = file.symbol.globalExports || ts.createMap(); - declareSymbol(file.symbol.globalExports, file.symbol, node, 8388608, 8388608); + file.symbol.globalExports = file.symbol.globalExports || ts.createSymbolTable(); + declareSymbol(file.symbol.globalExports, file.symbol, node, 2097152, 2097152); } function bindExportDeclaration(node) { if (!container.symbol || !container.symbol.exports) { - bindAnonymousDeclaration(node, 33554432, getDeclarationName(node)); + bindAnonymousDeclaration(node, 8388608, getDeclarationName(node)); } else if (!node.exportClause) { - declareSymbol(container.symbol.exports, container.symbol, node, 33554432, 0); + declareSymbol(container.symbol.exports, container.symbol, node, 8388608, 0); } } function bindImportClause(node) { if (node.name) { - declareSymbolAndAddToSymbolTable(node, 8388608, 8388608); + declareSymbolAndAddToSymbolTable(node, 2097152, 2097152); } } function setCommonJsModuleIndicator(node) { @@ -23441,7 +20179,7 @@ var ts; } function bindExportsPropertyAssignment(node) { setCommonJsModuleIndicator(node); - declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 7340032, 0); + declareSymbol(file.symbol.exports, file.symbol, node.left, 4 | 1048576, 0); } function isExportsOrModuleExportsOrAlias(node) { return ts.isExportsIdentifier(node) || @@ -23449,20 +20187,16 @@ var ts; isNameOfExportsOrModuleExportsAliasDeclaration(node); } function isNameOfExportsOrModuleExportsAliasDeclaration(node) { - if (node.kind === 71) { - var symbol = lookupSymbolForName(node.text); - if (symbol && symbol.valueDeclaration && symbol.valueDeclaration.kind === 226) { - var declaration = symbol.valueDeclaration; - if (declaration.initializer) { - return isExportsOrModuleExportsOrAliasOrAssignemnt(declaration.initializer); - } - } + if (ts.isIdentifier(node)) { + var symbol = lookupSymbolForName(node.escapedText); + return symbol && symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && + symbol.valueDeclaration.initializer && isExportsOrModuleExportsOrAliasOrAssignment(symbol.valueDeclaration.initializer); } return false; } - function isExportsOrModuleExportsOrAliasOrAssignemnt(node) { + function isExportsOrModuleExportsOrAliasOrAssignment(node) { return isExportsOrModuleExportsOrAlias(node) || - (ts.isAssignmentExpression(node, true) && (isExportsOrModuleExportsOrAliasOrAssignemnt(node.left) || isExportsOrModuleExportsOrAliasOrAssignemnt(node.right))); + (ts.isAssignmentExpression(node, true) && (isExportsOrModuleExportsOrAliasOrAssignment(node.left) || isExportsOrModuleExportsOrAliasOrAssignment(node.right))); } function bindModuleExportsAssignment(node) { var assignedExpression = ts.getRightMostAssignedExpression(node.right); @@ -23471,7 +20205,7 @@ var ts; return; } setCommonJsModuleIndicator(node); - declareSymbol(file.symbol.exports, file.symbol, node, 4 | 7340032 | 512, 0); + declareSymbol(file.symbol.exports, file.symbol, node, 4 | 1048576 | 512, 0); } function bindThisPropertyAssignment(node) { ts.Debug.assert(ts.isInJavaScriptFile(node)); @@ -23479,7 +20213,7 @@ var ts; switch (container.kind) { case 228: case 186: - container.symbol.members = container.symbol.members || ts.createMap(); + container.symbol.members = container.symbol.members || ts.createSymbolTable(); declareSymbol(container.symbol.members, container.symbol, node, 4, 0 & ~4); break; case 152: @@ -23488,10 +20222,8 @@ var ts; case 153: case 154: var containingClass = container.parent; - var symbol = declareSymbol(ts.hasModifier(container, 32) ? containingClass.symbol.exports : containingClass.symbol.members, containingClass.symbol, node, 4, 0); - if (symbol) { - symbol.isReplaceableByMethod = true; - } + var symbolTable = ts.hasModifier(container, 32) ? containingClass.symbol.exports : containingClass.symbol.members; + declareSymbol(symbolTable, containingClass.symbol, node, 4, 0, true); break; } } @@ -23502,7 +20234,7 @@ var ts; leftSideOfAssignment.parent = node; constructorFunction.parent = classPrototype; classPrototype.parent = leftSideOfAssignment; - bindPropertyAssignment(constructorFunction.text, leftSideOfAssignment, true); + bindPropertyAssignment(constructorFunction.escapedText, leftSideOfAssignment, true); } function bindStaticPropertyAssignment(node) { var leftSideOfAssignment = node.left; @@ -23513,7 +20245,7 @@ var ts; bindExportsPropertyAssignment(node); } else { - bindPropertyAssignment(target.text, leftSideOfAssignment, false); + bindPropertyAssignment(target.escapedText, leftSideOfAssignment, false); } } function lookupSymbolForName(name) { @@ -23528,8 +20260,8 @@ var ts; return; } var symbolTable = isPrototypeProperty ? - (targetSymbol.members || (targetSymbol.members = ts.createMap())) : - (targetSymbol.exports || (targetSymbol.exports = ts.createMap())); + (targetSymbol.members || (targetSymbol.members = ts.createSymbolTable())) : + (targetSymbol.exports || (targetSymbol.exports = ts.createSymbolTable())); declareSymbol(symbolTable, targetSymbol, propertyAccessExpression, 4, 0); } function bindCallExpression(node) { @@ -23542,22 +20274,22 @@ var ts; bindBlockScopedDeclaration(node, 32, 899519); } else { - var bindingName = node.name ? node.name.text : "__class"; + var bindingName = node.name ? node.name.escapedText : "__class"; bindAnonymousDeclaration(node, 32, bindingName); if (node.name) { - classifiableNames.set(node.name.text, node.name.text); + classifiableNames.set(node.name.escapedText, true); } } var symbol = node.symbol; - var prototypeSymbol = createSymbol(4 | 16777216, "prototype"); - var symbolExport = symbol.exports.get(prototypeSymbol.name); + var prototypeSymbol = createSymbol(4 | 4194304, "prototype"); + var symbolExport = symbol.exports.get(prototypeSymbol.escapedName); if (symbolExport) { if (node.name) { node.name.parent = node; } - file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, prototypeSymbol.name)); + file.bindDiagnostics.push(ts.createDiagnosticForNode(symbolExport.declarations[0], ts.Diagnostics.Duplicate_identifier_0, ts.unescapeLeadingUnderscores(prototypeSymbol.escapedName))); } - symbol.exports.set(prototypeSymbol.name, prototypeSymbol); + symbol.exports.set(prototypeSymbol.escapedName, prototypeSymbol); prototypeSymbol.parent = symbol; } function bindEnumDeclaration(node) { @@ -23586,14 +20318,14 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (ts.isBindingPattern(node.name)) { - bindAnonymousDeclaration(node, 1, getDestructuringParameterName(node)); + bindAnonymousDeclaration(node, 1, "__" + ts.indexOf(node.parent.parameters, node)); } else { declareSymbolAndAddToSymbolTable(node, 1, 107455); } if (ts.isParameterPropertyDeclaration(node)) { var classDeclaration = node.parent.parent; - declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 67108864 : 0), 0); + declareSymbol(classDeclaration.symbol.members, classDeclaration.symbol, node, 4 | (node.questionToken ? 16777216 : 0), 0); } } function bindFunctionDeclaration(node) { @@ -23621,7 +20353,7 @@ var ts; node.flowNode = currentFlow; } checkStrictModeFunctionName(node); - var bindingName = node.name ? node.name.text : "__function"; + var bindingName = node.name ? node.name.escapedText : "__function"; return bindAnonymousDeclaration(node, 16, bindingName); } function bindPropertyOrMethodOrAccessor(node, symbolFlags, symbolExcludes) { @@ -23781,7 +20513,6 @@ var ts; } function computeParameter(node, subtreeFlags) { var transformFlags = subtreeFlags; - var modifierFlags = ts.getModifierFlags(node); var name = node.name; var initializer = node.initializer; var dotDotDotToken = node.dotDotDotToken; @@ -23791,7 +20522,7 @@ var ts; || ts.isThisIdentifier(name)) { transformFlags |= 3; } - if (modifierFlags & 92) { + if (ts.hasModifier(node, 92)) { transformFlags |= 3 | 262144; } if (subtreeFlags & 1048576) { @@ -23820,8 +20551,7 @@ var ts; } function computeClassDeclaration(node, subtreeFlags) { var transformFlags; - var modifierFlags = ts.getModifierFlags(node); - if (modifierFlags & 2) { + if (ts.hasModifier(node, 2)) { transformFlags = 3; } else { @@ -23867,7 +20597,10 @@ var ts; } function computeCatchClause(node, subtreeFlags) { var transformFlags = subtreeFlags; - if (node.variableDeclaration && ts.isBindingPattern(node.variableDeclaration.name)) { + if (!node.variableDeclaration) { + transformFlags |= 8; + } + else if (ts.isBindingPattern(node.variableDeclaration.name)) { transformFlags |= 192; } node.transformFlags = transformFlags | 536870912; @@ -24031,9 +20764,8 @@ var ts; } function computeVariableStatement(node, subtreeFlags) { var transformFlags; - var modifierFlags = ts.getModifierFlags(node); var declarationListTransformFlags = node.declarationList.transformFlags; - if (modifierFlags & 2) { + if (ts.hasModifier(node, 2)) { transformFlags = 3; } else { @@ -24354,6 +21086,12 @@ var ts; return symbol.id; } ts.getSymbolId = getSymbolId; + function isInstantiatedModule(node, preserveConstEnums) { + var moduleState = ts.getModuleInstanceState(node); + return moduleState === 1 || + (preserveConstEnums && moduleState === 2); + } + ts.isInstantiatedModule = isInstantiatedModule; function createTypeChecker(host, produceDiagnostics) { var cancellationToken; var requestedExternalEmitHelpers; @@ -24365,8 +21103,7 @@ var ts; var symbolCount = 0; var enumCount = 0; var symbolInstantiationDepth = 0; - var emptyArray = []; - var emptySymbols = ts.createMap(); + var emptySymbols = ts.createSymbolTable(); var compilerOptions = host.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var modulekind = ts.getEmitModuleKind(compilerOptions); @@ -24380,6 +21117,7 @@ var ts; var undefinedSymbol = createSymbol(4, "undefined"); undefinedSymbol.declarations = []; var argumentsSymbol = createSymbol(4, "arguments"); + var apparentArgumentCount; var checker = { getNodeCount: function () { return ts.sum(host.getSourceFiles(), "nodeCount"); }, getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); }, @@ -24398,11 +21136,11 @@ var ts; getSymbolsOfParameterPropertyDeclaration: function (parameter, parameterName) { parameter = ts.getParseTreeNode(parameter, ts.isParameter); ts.Debug.assert(parameter !== undefined, "Cannot get symbols of a synthetic parameter that cannot be resolved to a parse-tree node."); - return getSymbolsOfParameterPropertyDeclaration(parameter, parameterName); + return getSymbolsOfParameterPropertyDeclaration(parameter, ts.escapeLeadingUnderscores(parameterName)); }, getDeclaredTypeOfSymbol: getDeclaredTypeOfSymbol, getPropertiesOfType: getPropertiesOfType, - getPropertyOfType: getPropertyOfType, + getPropertyOfType: function (type, name) { return getPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: getIndexInfoOfType, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: getIndexTypeOfType, @@ -24415,6 +21153,7 @@ var ts; }, getParameterType: getTypeAtPosition, getReturnTypeOfSignature: getReturnTypeOfSignature, + getNullableType: getNullableType, getNonNullableType: getNonNullableType, typeToTypeNode: nodeBuilder.typeToTypeNode, indexInfoToIndexSignatureDeclaration: nodeBuilder.indexInfoToIndexSignatureDeclaration, @@ -24460,9 +21199,12 @@ var ts; return node ? getContextualType(node) : undefined; }, getFullyQualifiedName: getFullyQualifiedName, - getResolvedSignature: function (node, candidatesOutArray) { + getResolvedSignature: function (node, candidatesOutArray, theArgumentCount) { node = ts.getParseTreeNode(node, ts.isCallLikeExpression); - return node ? getResolvedSignature(node, candidatesOutArray) : undefined; + apparentArgumentCount = theArgumentCount; + var res = node ? getResolvedSignature(node, candidatesOutArray) : undefined; + apparentArgumentCount = undefined; + return res; }, getConstantValue: function (node) { node = ts.getParseTreeNode(node, canHaveConstantValue); @@ -24470,18 +21212,18 @@ var ts; }, isValidPropertyAccess: function (node, propertyName) { node = ts.getParseTreeNode(node, ts.isPropertyAccessOrQualifiedName); - return node ? isValidPropertyAccess(node, propertyName) : false; + return node ? isValidPropertyAccess(node, ts.escapeLeadingUnderscores(propertyName)) : false; }, getSignatureFromDeclaration: function (declaration) { declaration = ts.getParseTreeNode(declaration, ts.isFunctionLike); return declaration ? getSignatureFromDeclaration(declaration) : undefined; }, isImplementationOfOverload: function (node) { - node = ts.getParseTreeNode(node, ts.isFunctionLike); - return node ? isImplementationOfOverload(node) : undefined; + var parsed = ts.getParseTreeNode(node, ts.isFunctionLike); + return parsed ? isImplementationOfOverload(parsed) : undefined; }, getImmediateAliasedSymbol: function (symbol) { - ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Alias here."); + ts.Debug.assert((symbol.flags & 2097152) !== 0, "Should only get Alias here."); var links = getSymbolLinks(symbol); if (!links.immediateTarget) { var node = getDeclarationOfAliasSymbol(symbol); @@ -24504,20 +21246,20 @@ var ts; node = ts.getParseTreeNode(node, ts.isParameter); return node ? isOptionalParameter(node) : false; }, - tryGetMemberInModuleExports: tryGetMemberInModuleExports, + tryGetMemberInModuleExports: function (name, symbol) { return tryGetMemberInModuleExports(ts.escapeLeadingUnderscores(name), symbol); }, + tryGetMemberInModuleExportsAndProperties: function (name, symbol) { return tryGetMemberInModuleExportsAndProperties(ts.escapeLeadingUnderscores(name), symbol); }, tryFindAmbientModuleWithoutAugmentations: function (moduleName) { return tryFindAmbientModule(moduleName, false); }, getApparentType: getApparentType, getAllPossiblePropertiesOfType: getAllPossiblePropertiesOfType, - getSuggestionForNonexistentProperty: getSuggestionForNonexistentProperty, - getSuggestionForNonexistentSymbol: getSuggestionForNonexistentSymbol, + getSuggestionForNonexistentProperty: function (node, type) { return ts.unescapeLeadingUnderscores(getSuggestionForNonexistentProperty(node, type)); }, + getSuggestionForNonexistentSymbol: function (location, name, meaning) { return ts.unescapeLeadingUnderscores(getSuggestionForNonexistentSymbol(location, ts.escapeLeadingUnderscores(name), meaning)); }, getBaseConstraintOfType: getBaseConstraintOfType, - getJsxNamespace: getJsxNamespace, - resolveNameAtLocation: function (location, name, meaning) { - location = ts.getParseTreeNode(location); - return resolveName(location, name, meaning, undefined, name); + resolveName: function (name, location, meaning) { + return resolveName(location, ts.escapeLeadingUnderscores(name), meaning, undefined, undefined); }, + getJsxNamespace: function () { return ts.unescapeLeadingUnderscores(getJsxNamespace()); }, }; var tupleTypes = []; var unionTypes = ts.createMap(); @@ -24544,23 +21286,23 @@ var ts; var neverType = createIntrinsicType(8192, "never"); var silentNeverType = createIntrinsicType(8192, "never"); var nonPrimitiveType = createIntrinsicType(16777216, "object"); - var emptyObjectType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); var emptyTypeLiteralSymbol = createSymbol(2048, "__type"); - emptyTypeLiteralSymbol.members = ts.createMap(); - var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var emptyGenericType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + emptyTypeLiteralSymbol.members = ts.createSymbolTable(); + var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); + var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); emptyGenericType.instantiations = ts.createMap(); - var anyFunctionType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); anyFunctionType.flags |= 8388608; - var noConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var circularConstraintType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); - var anySignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); - var unknownSignature = createSignature(undefined, undefined, undefined, emptyArray, unknownType, undefined, 0, false, false); - var resolvingSignature = createSignature(undefined, undefined, undefined, emptyArray, anyType, undefined, 0, false, false); - var silentNeverSignature = createSignature(undefined, undefined, undefined, emptyArray, silentNeverType, undefined, 0, false, false); + var noConstraintType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); + var circularConstraintType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); + var anySignature = createSignature(undefined, undefined, undefined, ts.emptyArray, anyType, undefined, 0, false, false); + var unknownSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, unknownType, undefined, 0, false, false); + var resolvingSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, anyType, undefined, 0, false, false); + var silentNeverSignature = createSignature(undefined, undefined, undefined, ts.emptyArray, silentNeverType, undefined, 0, false, false); var enumNumberIndexInfo = createIndexInfo(stringType, true); var jsObjectLiteralIndexInfo = createIndexInfo(anyType, false); - var globals = ts.createMap(); + var globals = ts.createSymbolTable(); var patternAmbientModules; var globalObjectType; var globalFunctionType; @@ -24707,7 +21449,7 @@ var ts; var _hasComputedJsxElementPropertiesName = false; var _jsxElementChildrenPropertyName; var _hasComputedJsxElementChildrenPropertyName = false; - var jsxTypes = ts.createMap(); + var jsxTypes = ts.createUnderscoreEscapedMap(); var JsxNames = { JSX: "JSX", IntrinsicElements: "IntrinsicElements", @@ -24737,8 +21479,8 @@ var ts; CheckMode[CheckMode["SkipContextSensitive"] = 1] = "SkipContextSensitive"; CheckMode[CheckMode["Inferential"] = 2] = "Inferential"; })(CheckMode || (CheckMode = {})); - var builtinGlobals = ts.createMap(); - builtinGlobals.set(undefinedSymbol.name, undefinedSymbol); + var builtinGlobals = ts.createSymbolTable(); + builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol); initializeTypeChecker(); return checker; function getJsxNamespace() { @@ -24747,11 +21489,11 @@ var ts; if (compilerOptions.jsxFactory) { _jsxFactoryEntity = ts.parseIsolatedEntityName(compilerOptions.jsxFactory, languageVersion); if (_jsxFactoryEntity) { - _jsxNamespace = getFirstIdentifier(_jsxFactoryEntity).text; + _jsxNamespace = getFirstIdentifier(_jsxFactoryEntity).escapedText; } } else if (compilerOptions.reactNamespace) { - _jsxNamespace = compilerOptions.reactNamespace; + _jsxNamespace = ts.escapeLeadingUnderscores(compilerOptions.reactNamespace); } } return _jsxNamespace; @@ -24768,12 +21510,12 @@ var ts; } function createSymbol(flags, name) { symbolCount++; - var symbol = (new Symbol(flags | 134217728, name)); + var symbol = (new Symbol(flags | 33554432, name)); symbol.checkFlags = 0; return symbol; } function isTransientSymbol(symbol) { - return (symbol.flags & 134217728) !== 0; + return (symbol.flags & 33554432) !== 0; } function getExcludedSymbolFlags(flags) { var result = 0; @@ -24807,8 +21549,8 @@ var ts; result |= 530920; if (flags & 524288) result |= 793064; - if (flags & 8388608) - result |= 8388608; + if (flags & 2097152) + result |= 2097152; return result; } function recordMergedSymbol(target, source) { @@ -24819,7 +21561,7 @@ var ts; mergedSymbols[source.mergeId] = target; } function cloneSymbol(symbol) { - var result = createSymbol(symbol.flags, symbol.name); + var result = createSymbol(symbol.flags, symbol.escapedName); result.declarations = symbol.declarations.slice(0); result.parent = symbol.parent; if (symbol.valueDeclaration) @@ -24847,12 +21589,12 @@ var ts; ts.addRange(target.declarations, source.declarations); if (source.members) { if (!target.members) - target.members = ts.createMap(); + target.members = ts.createSymbolTable(); mergeSymbolTable(target.members, source.members); } if (source.exports) { if (!target.exports) - target.exports = ts.createMap(); + target.exports = ts.createSymbolTable(); mergeSymbolTable(target.exports, source.exports); } recordMergedSymbol(target, source); @@ -24878,7 +21620,7 @@ var ts; target.set(id, sourceSymbol); } else { - if (!(targetSymbol.flags & 134217728)) { + if (!(targetSymbol.flags & 33554432)) { targetSymbol = cloneSymbol(targetSymbol); target.set(id, targetSymbol); } @@ -24905,7 +21647,7 @@ var ts; } mainModule = resolveExternalModuleSymbol(mainModule); if (mainModule.flags & 1920) { - mainModule = mainModule.flags & 134217728 ? mainModule : cloneSymbol(mainModule); + mainModule = mainModule.flags & 33554432 ? mainModule : cloneSymbol(mainModule); mergeSymbol(mainModule, moduleAugmentation.symbol); } else { @@ -24917,7 +21659,7 @@ var ts; source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); if (targetSymbol) { - ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(id, message)); + ts.forEach(targetSymbol.declarations, addDeclarationDiagnostic(ts.unescapeLeadingUnderscores(id), message)); } else { target.set(id, sourceSymbol); @@ -24928,7 +21670,7 @@ var ts; } } function getSymbolLinks(symbol) { - if (symbol.flags & 134217728) + if (symbol.flags & 33554432) return symbol; var id = getSymbolId(symbol); return symbolLinks[id] || (symbolLinks[id] = {}); @@ -24951,7 +21693,7 @@ var ts; if (symbol.flags & meaning) { return symbol; } - if (symbol.flags & 8388608) { + if (symbol.flags & 2097152) { var target = resolveAlias(symbol); if (target === unknownSymbol || target.flags & meaning) { return symbol; @@ -25000,7 +21742,10 @@ var ts; } return true; } - if (usage.parent.kind === 246) { + if (usage.parent.kind === 246 || (usage.parent.kind === 243 && usage.parent.isExportEquals)) { + return true; + } + if (usage.kind === 243 && usage.isExportEquals) { return true; } var container = ts.getEnclosingBlockScopeContainer(declaration); @@ -25030,13 +21775,13 @@ var ts; current.parent.kind === 149 && current.parent.initializer === current; if (initializerOfProperty) { - if (ts.getModifierFlags(current.parent) & 32) { + if (ts.hasModifier(current.parent, 32)) { if (declaration.kind === 151) { return true; } } else { - var isDeclarationInstanceProperty = declaration.kind === 149 && !(ts.getModifierFlags(declaration) & 32); + var isDeclarationInstanceProperty = declaration.kind === 149 && !ts.hasModifier(declaration, 32); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -25061,7 +21806,7 @@ var ts; if (result = lookup(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 793064 && lastLocation.kind !== 283) { + if (meaning & result.flags & 793064 && lastLocation.kind !== 275) { useResult = result.flags & 262144 ? lastLocation === location.type || lastLocation.kind === 146 || @@ -25093,19 +21838,19 @@ var ts; if (location.kind === 265 || ts.isAmbientModule(location)) { if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); - if (localSymbol && (result.flags & meaning) && localSymbol.name === name) { + if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) { break loop; } result = undefined; } var moduleExport = moduleExports.get(name); if (moduleExport && - moduleExport.flags === 8388608 && + moduleExport.flags === 2097152 && ts.getDeclarationOfKind(moduleExport, 246)) { break; } } - if (result = lookup(moduleExports, name, meaning & 8914931)) { + if (result = lookup(moduleExports, name, meaning & 2623475)) { break loop; } break; @@ -25116,7 +21861,7 @@ var ts; break; case 149: case 148: - if (ts.isClassLike(location.parent) && !(ts.getModifierFlags(location) & 32)) { + if (ts.isClassLike(location.parent) && !ts.hasModifier(location, 32)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { if (lookup(ctor.locals, name, meaning & 107455)) { @@ -25133,7 +21878,7 @@ var ts; result = undefined; break; } - if (lastLocation && ts.getModifierFlags(lastLocation) & 32) { + if (lastLocation && ts.hasModifier(lastLocation, 32)) { error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); return undefined; } @@ -25141,7 +21886,7 @@ var ts; } if (location.kind === 199 && meaning & 32) { var className = location.name; - if (className && name === className.text) { + if (className && name === className.escapedText) { result = location.symbol; break loop; } @@ -25175,7 +21920,7 @@ var ts; } if (meaning & 16) { var functionName = location.name; - if (functionName && name === functionName.text) { + if (functionName && name === functionName.escapedText) { result = location.symbol; break loop; } @@ -25193,7 +21938,7 @@ var ts; lastLocation = location; location = location.parent; } - if (result && nameNotFoundMessage && noUnusedIdentifiers) { + if (result && nameNotFoundMessage && noUnusedIdentifiers && result !== lastLocation.symbol) { result.isReferenced = true; } if (!result) { @@ -25211,11 +21956,11 @@ var ts; if (suggestedNameNotFoundMessage && suggestionCount < maximumSuggestionCount) { suggestion = getSuggestionForNonexistentSymbol(originalLocation, name, meaning); if (suggestion) { - error(errorLocation, suggestedNameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg), suggestion); + error(errorLocation, suggestedNameNotFoundMessage, diagnosticName(nameArg), ts.unescapeLeadingUnderscores(suggestion)); } } if (!suggestion) { - error(errorLocation, nameNotFoundMessage, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + error(errorLocation, nameNotFoundMessage, diagnosticName(nameArg)); } suggestionCount++; } @@ -25225,7 +21970,7 @@ var ts; if (nameNotFoundMessage) { if (propertyWithInvalidInitializer) { var propertyName = propertyWithInvalidInitializer.name; - error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + error(errorLocation, ts.Diagnostics.Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor, ts.declarationNameToString(propertyName), diagnosticName(nameArg)); return undefined; } if (errorLocation && @@ -25239,12 +21984,15 @@ var ts; if (result && isInExternalModule && (meaning & 107455) === 107455) { var decls = result.declarations; if (decls && decls.length === 1 && decls[0].kind === 236) { - error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, name); + error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); } } } return result; } + function diagnosticName(nameArg) { + return typeof nameArg === "string" ? ts.unescapeLeadingUnderscores(nameArg) : ts.declarationNameToString(nameArg); + } function isTypeParameterSymbolDeclaredInContainer(symbol, container) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; @@ -25268,13 +22016,13 @@ var ts; } var constructorType = getTypeOfSymbol(classSymbol); if (getPropertyOfType(constructorType, name)) { - error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg), symbolToString(classSymbol)); + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_static_member_1_0, diagnosticName(nameArg), symbolToString(classSymbol)); return true; } - if (location === container && !(ts.getModifierFlags(location) & 32)) { + if (location === container && !ts.hasModifier(location, 32)) { var instanceType = getDeclaredTypeOfSymbol(classSymbol).thisType; if (getPropertyOfType(instanceType, name)) { - error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, typeof nameArg === "string" ? nameArg : ts.declarationNameToString(nameArg)); + error(errorLocation, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_the_instance_member_this_0, diagnosticName(nameArg)); return true; } } @@ -25306,8 +22054,18 @@ var ts; function checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) { if (meaning === 1920) { var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined)); + var parent = errorLocation.parent; if (symbol) { - error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, name); + if (ts.isQualifiedName(parent)) { + ts.Debug.assert(parent.left === errorLocation, "Should only be resolving left side of qualified name as a namespace"); + var propName = parent.right.escapedText; + var propType = getPropertyOfType(getDeclaredTypeOfSymbol(symbol), propName); + if (propType) { + error(parent, ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1, ts.unescapeLeadingUnderscores(name), ts.unescapeLeadingUnderscores(propName)); + return true; + } + } + error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_namespace_here, ts.unescapeLeadingUnderscores(name)); return true; } } @@ -25316,12 +22074,12 @@ var ts; function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { if (meaning & (107455 & ~1024)) { if (name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never") { - error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, name); + error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name)); return true; } var symbol = resolveSymbol(resolveName(errorLocation, name, 793064 & ~107455, undefined, undefined)); if (symbol && !(symbol.flags & 1024)) { - error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, name); + error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here, ts.unescapeLeadingUnderscores(name)); return true; } } @@ -25331,14 +22089,14 @@ var ts; if (meaning & (107455 & ~1024 & ~793064)) { var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~107455, undefined, undefined)); if (symbol) { - error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, name); + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name)); return true; } } else if (meaning & (793064 & ~1024 & ~107455)) { var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~793064, undefined, undefined)); if (symbol) { - error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, name); + error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name)); return true; } } @@ -25413,7 +22171,7 @@ var ts; if (valueSymbol.flags & (793064 | 1920)) { return valueSymbol; } - var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.name); + var result = createSymbol(valueSymbol.flags | typeSymbol.flags, valueSymbol.escapedName); result.declarations = ts.concatenate(valueSymbol.declarations, typeSymbol.declarations); result.parent = valueSymbol.parent || typeSymbol.parent; if (valueSymbol.valueDeclaration) @@ -25442,20 +22200,20 @@ var ts; var targetSymbol = resolveESModuleSymbol(moduleSymbol, node.moduleSpecifier, dontResolveAlias); if (targetSymbol) { var name = specifier.propertyName || specifier.name; - if (name.text) { + if (name.escapedText) { if (ts.isShorthandAmbientModuleSymbol(moduleSymbol)) { return moduleSymbol; } var symbolFromVariable = void 0; if (moduleSymbol && moduleSymbol.exports && moduleSymbol.exports.get("export=")) { - symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.text); + symbolFromVariable = getPropertyOfType(getTypeOfSymbol(targetSymbol), name.escapedText); } else { - symbolFromVariable = getPropertyOfVariable(targetSymbol, name.text); + symbolFromVariable = getPropertyOfVariable(targetSymbol, name.escapedText); } symbolFromVariable = resolveSymbol(symbolFromVariable, dontResolveAlias); - var symbolFromModule = getExportOfModule(targetSymbol, name.text, dontResolveAlias); - if (!symbolFromModule && allowSyntheticDefaultImports && name.text === "default") { + var symbolFromModule = getExportOfModule(targetSymbol, name.escapedText, dontResolveAlias); + if (!symbolFromModule && allowSyntheticDefaultImports && name.escapedText === "default") { symbolFromModule = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias); } var symbol = symbolFromModule && symbolFromVariable ? @@ -25502,14 +22260,14 @@ var ts; } function isNonLocalAlias(symbol, excludes) { if (excludes === void 0) { excludes = 107455 | 793064 | 1920; } - return symbol && (symbol.flags & (8388608 | excludes)) === 8388608; + return symbol && (symbol.flags & (2097152 | excludes)) === 2097152; } function resolveSymbol(symbol, dontResolveAlias) { var shouldResolve = !dontResolveAlias && isNonLocalAlias(symbol); return shouldResolve ? resolveAlias(symbol) : symbol; } function resolveAlias(symbol) { - ts.Debug.assert((symbol.flags & 8388608) !== 0, "Should only get Alias here."); + ts.Debug.assert((symbol.flags & 2097152) !== 0, "Should only get Alias here."); var links = getSymbolLinks(symbol); if (!links.target) { links.target = resolvingSymbol; @@ -25578,7 +22336,7 @@ var ts; var symbol; if (name.kind === 71) { var message = meaning === 1920 ? ts.Diagnostics.Cannot_find_namespace_0 : ts.Diagnostics.Cannot_find_name_0; - symbol = resolveName(location || name, name.text, meaning, ignoreErrors ? undefined : message, name); + symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors ? undefined : message, name); if (!symbol) { return undefined; } @@ -25603,7 +22361,7 @@ var ts; else if (namespace === unknownSymbol) { return namespace; } - symbol = getSymbol(getExportsOfSymbol(namespace), right.text, meaning); + symbol = getSymbol(getExportsOfSymbol(namespace), right.escapedText, meaning); if (!symbol) { if (!ignoreErrors) { error(right, ts.Diagnostics.Namespace_0_has_no_exported_member_1, getFullyQualifiedName(namespace), ts.declarationNameToString(right)); @@ -25635,8 +22393,7 @@ var ts; } function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) { if (isForAugmentation === void 0) { isForAugmentation = false; } - var moduleName = ts.escapeIdentifier(moduleReference); - if (moduleName === undefined) { + if (moduleReference === undefined) { return; } if (ts.startsWith(moduleReference, "@types/")) { @@ -25644,11 +22401,11 @@ var ts; var withoutAtTypePrefix = ts.removePrefix(moduleReference, "@types/"); error(errorNode, diag, withoutAtTypePrefix, moduleReference); } - var ambientModule = tryFindAmbientModule(moduleName, true); + var ambientModule = tryFindAmbientModule(moduleReference, true); if (ambientModule) { return ambientModule; } - var isRelative = ts.isExternalModuleNameRelative(moduleName); + var isRelative = ts.isExternalModuleNameRelative(moduleReference); var resolvedModule = ts.getResolvedModule(ts.getSourceFileOfNode(location), moduleReference); var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule); var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName); @@ -25662,7 +22419,7 @@ var ts; return undefined; } if (patternAmbientModules) { - var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleName); + var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleReference); if (pattern) { return getMergedSymbol(pattern.symbol); } @@ -25681,16 +22438,16 @@ var ts; } if (moduleNotFoundError) { if (resolutionDiagnostic) { - error(errorNode, resolutionDiagnostic, moduleName, resolvedModule.resolvedFileName); + error(errorNode, resolutionDiagnostic, moduleReference, resolvedModule.resolvedFileName); } else { - var tsExtension = ts.tryExtractTypeScriptExtension(moduleName); + var tsExtension = ts.tryExtractTypeScriptExtension(moduleReference); if (tsExtension) { var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead; - error(errorNode, diag, tsExtension, ts.removeExtension(moduleName, tsExtension)); + error(errorNode, diag, tsExtension, ts.removeExtension(moduleReference, tsExtension)); } else { - error(errorNode, moduleNotFoundError, moduleName); + error(errorNode, moduleNotFoundError, moduleReference); } } } @@ -25726,6 +22483,16 @@ var ts; return symbolTable.get(memberName); } } + function tryGetMemberInModuleExportsAndProperties(memberName, moduleSymbol) { + var symbol = tryGetMemberInModuleExports(memberName, moduleSymbol); + if (!symbol) { + var exportEquals = resolveExternalModuleSymbol(moduleSymbol); + if (exportEquals !== moduleSymbol) { + return getPropertyOfType(getTypeOfSymbol(exportEquals), memberName); + } + } + return symbol; + } function getExportsOfSymbol(symbol) { return symbol.flags & 1536 ? getExportsOfModule(symbol) : symbol.exports || emptySymbols; } @@ -25769,7 +22536,7 @@ var ts; var symbols = ts.cloneMap(symbol.exports); var exportStars = symbol.exports.get("__export"); if (exportStars) { - var nestedSymbols = ts.createMap(); + var nestedSymbols = ts.createSymbolTable(); var lookupTable_1 = ts.createMap(); for (var _i = 0, _a = exportStars.declarations; _i < _a.length; _i++) { var node = _a[_i]; @@ -25784,7 +22551,7 @@ var ts; } for (var _i = 0, exportsWithDuplicate_1 = exportsWithDuplicate; _i < exportsWithDuplicate_1.length; _i++) { var node = exportsWithDuplicate_1[_i]; - diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, id)); + diagnostics.add(ts.createDiagnosticForNode(node, ts.Diagnostics.Module_0_has_already_exported_a_member_named_1_Consider_explicitly_re_exporting_to_resolve_the_ambiguity, lookupTable_1.get(id).specifierText, ts.unescapeLeadingUnderscores(id))); } }); extendExportSymbols(symbols, nestedSymbols); @@ -25808,7 +22575,7 @@ var ts; : symbol; } function symbolIsValue(symbol) { - return !!(symbol.flags & 107455 || symbol.flags & 8388608 && resolveAlias(symbol).flags & 107455); + return !!(symbol.flags & 107455 || symbol.flags & 2097152 && resolveAlias(symbol).flags & 107455); } function findConstructorDeclaration(node) { var members = node.members; @@ -25843,7 +22610,7 @@ var ts; return type; } function createTypeofType() { - return getUnionType(ts.convertToArray(typeofEQFacts.keys(), getLiteralType)); + return getUnionType(ts.arrayFrom(typeofEQFacts.keys(), getLiteralType)); } function isReservedMemberName(name) { return name.charCodeAt(0) === 95 && @@ -25862,7 +22629,7 @@ var ts; } } }); - return result || emptyArray; + return result || ts.emptyArray; } function setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo) { type.members = members; @@ -25929,12 +22696,12 @@ var ts; } } function trySymbolTable(symbols) { - if (isAccessible(symbols.get(symbol.name))) { + if (isAccessible(symbols.get(symbol.escapedName))) { return [symbol]; } return ts.forEachEntry(symbols, function (symbolFromSymbolTable) { - if (symbolFromSymbolTable.flags & 8388608 - && symbolFromSymbolTable.name !== "export=" + if (symbolFromSymbolTable.flags & 2097152 + && symbolFromSymbolTable.escapedName !== "export=" && !ts.getDeclarationOfKind(symbolFromSymbolTable, 246)) { if (!useOnlyExternalAliasing || ts.forEach(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) { @@ -25951,23 +22718,21 @@ var ts; }); } } - if (symbol) { - if (!(isPropertyOrMethodDeclarationSymbol(symbol))) { - return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); - } + if (symbol && !isPropertyOrMethodDeclarationSymbol(symbol)) { + return forEachSymbolTableInScope(enclosingDeclaration, getAccessibleSymbolChainFromSymbolTable); } } function needsQualification(symbol, enclosingDeclaration, meaning) { var qualify = false; forEachSymbolTableInScope(enclosingDeclaration, function (symbolTable) { - var symbolFromSymbolTable = symbolTable.get(symbol.name); + var symbolFromSymbolTable = symbolTable.get(symbol.escapedName); if (!symbolFromSymbolTable) { return false; } if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 8388608 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 246)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 246)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; if (symbolFromSymbolTable.flags & meaning) { qualify = true; return true; @@ -25994,6 +22759,10 @@ var ts; } return false; } + function isTypeSymbolAccessible(typeSymbol, enclosingDeclaration) { + var access = isSymbolAccessible(typeSymbol, enclosingDeclaration, 793064, false); + return access.accessibility === 0; + } function isSymbolAccessible(symbol, enclosingDeclaration, meaning, shouldComputeAliasesToMakeVisible) { if (symbol && enclosingDeclaration && !(symbol.flags & 262144)) { var initialSymbol = symbol; @@ -26049,7 +22818,7 @@ var ts; if (!isDeclarationVisible(declaration)) { var anyImportSyntax = getAnyImportSyntax(declaration); if (anyImportSyntax && - !(ts.getModifierFlags(anyImportSyntax) & 1) && + !ts.hasModifier(anyImportSyntax, 1) && isDeclarationVisible(anyImportSyntax.parent)) { if (shouldComputeAliasToMakeVisible) { getNodeLinks(declaration).isVisible = true; @@ -26082,7 +22851,7 @@ var ts; meaning = 793064; } var firstIdentifier = getFirstIdentifier(entityName); - var symbol = resolveName(enclosingDeclaration, firstIdentifier.text, meaning, undefined, undefined); + var symbol = resolveName(enclosingDeclaration, firstIdentifier.escapedText, meaning, undefined, undefined); return (symbol && hasVisibleDeclarations(symbol, true)) || { accessibility: 1, errorSymbolName: ts.getTextOfNode(firstIdentifier), @@ -26099,18 +22868,14 @@ var ts; writer.writeSpace(" "); } function symbolToString(symbol, enclosingDeclaration, meaning) { - var writer = ts.getSingleLineStringWriter(); - getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning); - var result = writer.string(); - ts.releaseStringWriter(writer); - return result; + return ts.usingSingleLineStringWriter(function (writer) { + getSymbolDisplayBuilder().buildSymbolDisplay(symbol, writer, enclosingDeclaration, meaning); + }); } function signatureToString(signature, enclosingDeclaration, flags, kind) { - var writer = ts.getSingleLineStringWriter(); - getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind); - var result = writer.string(); - ts.releaseStringWriter(writer); - return result; + return ts.usingSingleLineStringWriter(function (writer) { + getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags, kind); + }); } function typeToString(type, enclosingDeclaration, flags) { var typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | ts.NodeBuilderFlags.IgnoreErrors | ts.NodeBuilderFlags.WriteTypeParametersInQualifiedName); @@ -26119,7 +22884,7 @@ var ts; var writer = ts.createTextWriter(""); var printer = ts.createPrinter(options); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); - printer.writeNode(3, typeNode, sourceFile, writer); + printer.writeNode(4, typeNode, sourceFile, writer); var result = writer.getText(); var maxLength = compilerOptions.noErrorTruncation || flags & 8 ? undefined : 100; if (maxLength && result.length >= maxLength) { @@ -26251,8 +23016,7 @@ var ts; var name = symbolToName(type.symbol, context, 793064, false); return ts.createTypeReferenceNode(name, undefined); } - if (!inTypeAlias && type.aliasSymbol && - isSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration, 793064, false).accessibility === 0) { + if (!inTypeAlias && type.aliasSymbol && isTypeSymbolAccessible(type.aliasSymbol, context.enclosingDeclaration)) { var name = symbolToTypeReferenceName(type.aliasSymbol); var typeArgumentNodes = mapToTypeNodes(type.aliasTypeArguments, context); return ts.createTypeReferenceNode(name, typeArgumentNodes); @@ -26327,8 +23091,8 @@ var ts; return createTypeNodeFromObjectType(type); } function shouldWriteTypeOfFunctionSymbol() { - var isStaticMethodSymbol = !!(symbol.flags & 8192 && - ts.forEach(symbol.declarations, function (declaration) { return ts.getModifierFlags(declaration) & 32; })); + var isStaticMethodSymbol = !!(symbol.flags & 8192) && + ts.some(symbol.declarations, function (declaration) { return ts.hasModifier(declaration, 32); }); var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { @@ -26340,10 +23104,8 @@ var ts; } } function createTypeNodeFromObjectType(type) { - if (type.objectFlags & 32) { - if (getConstraintTypeFromMappedType(type).flags & (16384 | 262144)) { - return createMappedTypeNodeFromType(type); - } + if (isGenericMappedType(type)) { + return createMappedTypeNodeFromType(type); } var resolved = resolveStructuredTypeMembers(type); if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { @@ -26373,11 +23135,11 @@ var ts; return ts.createTypeQueryNode(entityName); } function symbolToTypeReferenceName(symbol) { - var entityName = symbol.flags & 32 || !isReservedMemberName(symbol.name) ? symbolToName(symbol, context, 793064, false) : ts.createIdentifier(""); + var entityName = symbol.flags & 32 || !isReservedMemberName(symbol.escapedName) ? symbolToName(symbol, context, 793064, false) : ts.createIdentifier(""); return entityName; } function typeReferenceToTypeNode(type) { - var typeArguments = type.typeArguments || emptyArray; + var typeArguments = type.typeArguments || ts.emptyArray; if (type.target === globalArrayType) { if (context.flags & ts.NodeBuilderFlags.WriteArrayAsGenericType) { var typeArgumentNode = typeToTypeNodeHelper(typeArguments[0], context); @@ -26393,9 +23155,10 @@ var ts; return ts.createTupleTypeNode(tupleConstituentNodes); } } - if (!context.encounteredError && !(context.flags & ts.NodeBuilderFlags.AllowEmptyTuple)) { - context.encounteredError = true; + if (context.encounteredError || (context.flags & ts.NodeBuilderFlags.AllowEmptyTuple)) { + return ts.createTupleTypeNode([]); } + context.encounteredError = true; return undefined; } else { @@ -26403,13 +23166,13 @@ var ts; var i = 0; var qualifiedName = void 0; if (outerTypeParameters) { - var length_1 = outerTypeParameters.length; - while (i < length_1) { + var length_2 = outerTypeParameters.length; + while (i < length_2) { var start = i; var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_1 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); + } while (i < length_2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { var typeArgumentSlice = mapToTypeNodes(typeArguments.slice(start, i), context); var typeArgumentNodes_1 = typeArgumentSlice && ts.createNodeArray(typeArgumentSlice); @@ -26438,7 +23201,7 @@ var ts; } var typeArgumentNodes = void 0; if (typeArguments.length > 0) { - var typeParameterCount = (type.target.typeParameters || emptyArray).length; + var typeParameterCount = (type.target.typeParameters || ts.emptyArray).length; typeArgumentNodes = mapToTypeNodes(typeArguments.slice(i, typeParameterCount), context); } if (typeArgumentNodes) { @@ -26482,14 +23245,14 @@ var ts; if (!properties) { return typeElements; } - for (var _d = 0, properties_2 = properties; _d < properties_2.length; _d++) { - var propertySymbol = properties_2[_d]; + for (var _d = 0, properties_1 = properties; _d < properties_1.length; _d++) { + var propertySymbol = properties_1[_d]; var propertyType = getTypeOfSymbol(propertySymbol); var saveEnclosingDeclaration = context.enclosingDeclaration; context.enclosingDeclaration = undefined; var propertyName = symbolToName(propertySymbol, context, 107455, true); context.enclosingDeclaration = saveEnclosingDeclaration; - var optionalToken = propertySymbol.flags & 67108864 ? ts.createToken(55) : undefined; + var optionalToken = propertySymbol.flags & 16777216 ? ts.createToken(55) : undefined; if (propertySymbol.flags & (16 | 8192) && !getPropertiesOfObjectType(propertyType).length) { var signatures = getSignaturesOfType(propertyType, 0); for (var _e = 0, signatures_1 = signatures; _e < signatures_1.length; _e++) { @@ -26579,7 +23342,7 @@ var ts; parameterDeclaration.name.kind === 71 ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216) : cloneBindingName(parameterDeclaration.name) : - parameterSymbol.name; + ts.unescapeLeadingUnderscores(parameterSymbol.escapedName); var questionToken = isOptionalParameter(parameterDeclaration) ? ts.createToken(55) : undefined; var parameterType = getTypeOfSymbol(parameterSymbol); if (isRequiredInitializedParameter(parameterDeclaration)) { @@ -26683,15 +23446,13 @@ var ts; return "(Anonymous function)"; } } - return symbol.name; + return ts.unescapeLeadingUnderscores(symbol.escapedName); } } function typePredicateToString(typePredicate, enclosingDeclaration, flags) { - var writer = ts.getSingleLineStringWriter(); - getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); - var result = writer.string(); - ts.releaseStringWriter(writer); - return result; + return ts.usingSingleLineStringWriter(function (writer) { + getSymbolDisplayBuilder().buildTypePredicateDisplay(typePredicate, writer, enclosingDeclaration, flags); + }); } function formatUnionTypes(types) { var result = []; @@ -26764,7 +23525,7 @@ var ts; return "(Anonymous function)"; } } - return symbol.name; + return ts.unescapeLeadingUnderscores(symbol.escapedName); } function getSymbolDisplayBuilder() { function appendSymbolNameOnly(symbol, writer) { @@ -26795,7 +23556,7 @@ var ts; if (parentSymbol) { if (flags & 1) { if (ts.getCheckFlags(symbol) & 1) { - var params = getTypeParametersOfClassOrInterface(parentSymbol.flags & 8388608 ? resolveAlias(parentSymbol) : parentSymbol); + var params = getTypeParametersOfClassOrInterface(parentSymbol.flags & 2097152 ? resolveAlias(parentSymbol) : parentSymbol); buildDisplayForTypeArgumentsAndDelimiters(params, symbol.mapper, writer, enclosingDeclaration); } else { @@ -26872,7 +23633,7 @@ var ts; buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 793064, 0, nextFlags); } else if (!(flags & 1024) && type.aliasSymbol && - isSymbolAccessible(type.aliasSymbol, enclosingDeclaration, 793064, false).accessibility === 0) { + ((flags & 65536) || isTypeSymbolAccessible(type.aliasSymbol, enclosingDeclaration))) { var typeArguments = type.aliasTypeArguments; writeSymbolTypeReference(type.aliasSymbol, typeArguments, 0, ts.length(typeArguments), nextFlags); } @@ -26923,7 +23684,7 @@ var ts; } } function writeSymbolTypeReference(symbol, typeArguments, pos, end, flags) { - if (symbol.flags & 32 || !isReservedMemberName(symbol.name)) { + if (symbol.flags & 32 || !isReservedMemberName(symbol.escapedName)) { buildSymbolDisplay(symbol, writer, enclosingDeclaration, 793064, 0, flags); } if (pos < end) { @@ -26940,9 +23701,9 @@ var ts; } } function writeTypeReference(type, flags) { - var typeArguments = type.typeArguments || emptyArray; + var typeArguments = type.typeArguments || ts.emptyArray; if (type.target === globalArrayType && !(flags & 1)) { - writeType(typeArguments[0], 128); + writeType(typeArguments[0], 128 | 32768); writePunctuation(writer, 21); writePunctuation(writer, 22); } @@ -26960,20 +23721,20 @@ var ts; var outerTypeParameters = type.target.outerTypeParameters; var i = 0; if (outerTypeParameters) { - var length_2 = outerTypeParameters.length; - while (i < length_2) { + var length_3 = outerTypeParameters.length; + while (i < length_3) { var start = i; var parent = getParentSymbolOfTypeParameter(outerTypeParameters[i]); do { i++; - } while (i < length_2 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); + } while (i < length_3 && getParentSymbolOfTypeParameter(outerTypeParameters[i]) === parent); if (!ts.rangeEquals(outerTypeParameters, typeArguments, start, i)) { writeSymbolTypeReference(parent, typeArguments, start, i, flags); writePunctuation(writer, 23); } } } - var typeParameterCount = (type.target.typeParameters || emptyArray).length; + var typeParameterCount = (type.target.typeParameters || ts.emptyArray).length; writeSymbolTypeReference(type.symbol, typeArguments, i, typeParameterCount, flags); } } @@ -27016,9 +23777,7 @@ var ts; if (!symbolStack) { symbolStack = []; } - var isConstructorObject = type.flags & 32768 && - getObjectFlags(type) & 16 && - type.symbol && type.symbol.flags & 32; + var isConstructorObject = type.objectFlags & 16 && type.symbol && type.symbol.flags & 32; if (isConstructorObject) { writeLiteralType(type, flags); } @@ -27033,23 +23792,29 @@ var ts; writeLiteralType(type, flags); } function shouldWriteTypeOfFunctionSymbol() { - var isStaticMethodSymbol = !!(symbol.flags & 8192 && - ts.forEach(symbol.declarations, function (declaration) { return ts.getModifierFlags(declaration) & 32; })); + var isStaticMethodSymbol = !!(symbol.flags & 8192) && + ts.some(symbol.declarations, function (declaration) { return ts.hasModifier(declaration, 32); }); var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || - ts.forEach(symbol.declarations, function (declaration) { + ts.some(symbol.declarations, function (declaration) { return declaration.parent.kind === 265 || declaration.parent.kind === 234; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return !!(flags & 4) || - (ts.contains(symbolStack, symbol)); + ts.contains(symbolStack, symbol); } } } function writeTypeOfSymbol(type, typeFormatFlags) { + if (typeFormatFlags & 32768) { + writePunctuation(writer, 19); + } writeKeyword(writer, 103); writeSpace(writer); buildSymbolDisplay(type.symbol, writer, enclosingDeclaration, 107455, 0, typeFormatFlags); + if (typeFormatFlags & 32768) { + writePunctuation(writer, 20); + } } function writePropertyWithModifiers(prop) { if (isReadonlySymbol(prop)) { @@ -27057,7 +23822,7 @@ var ts; writeSpace(writer); } buildSymbolDisplay(prop, writer); - if (prop.flags & 67108864) { + if (prop.flags & 16777216) { writePunctuation(writer, 55); } } @@ -27073,11 +23838,9 @@ var ts; return false; } function writeLiteralType(type, flags) { - if (type.objectFlags & 32) { - if (getConstraintTypeFromMappedType(type).flags & (16384 | 262144)) { - writeMappedType(type); - return; - } + if (isGenericMappedType(type)) { + writeMappedType(type); + return; } var resolved = resolveStructuredTypeMembers(type); if (!resolved.properties.length && !resolved.stringIndexInfo && !resolved.numberIndexInfo) { @@ -27138,11 +23901,11 @@ var ts; for (var _d = 0, _e = resolved.properties; _d < _e.length; _d++) { var p = _e[_d]; if (globalFlags & 16384) { - if (p.flags & 16777216) { + if (p.flags & 4194304) { continue; } if (ts.getDeclarationModifierFlagsFromSymbol(p) & (8 | 16)) { - writer.reportPrivateInBaseOfClassExpression(p.name); + writer.reportPrivateInBaseOfClassExpression(ts.unescapeLeadingUnderscores(p.escapedName)); } } var t = getTypeOfSymbol(p); @@ -27445,7 +24208,7 @@ var ts; case 154: case 151: case 150: - if (ts.getModifierFlags(node) & (8 | 16)) { + if (ts.hasModifier(node, 8 | 16)) { return false; } case 152: @@ -27482,10 +24245,10 @@ var ts; function collectLinkedAliases(node) { var exportSymbol; if (node.parent && node.parent.kind === 243) { - exportSymbol = resolveName(node.parent, node.text, 107455 | 793064 | 1920 | 8388608, ts.Diagnostics.Cannot_find_name_0, node); + exportSymbol = resolveName(node.parent, node.escapedText, 107455 | 793064 | 1920 | 2097152, ts.Diagnostics.Cannot_find_name_0, node); } else if (node.parent.kind === 246) { - exportSymbol = getTargetOfExportSpecifier(node.parent, 107455 | 793064 | 1920 | 8388608); + exportSymbol = getTargetOfExportSpecifier(node.parent, 107455 | 793064 | 1920 | 2097152); } var result = []; if (exportSymbol) { @@ -27502,7 +24265,7 @@ var ts; if (ts.isInternalModuleImportEqualsDeclaration(declaration)) { var internalModuleReference = declaration.moduleReference; var firstIdentifier = getFirstIdentifier(internalModuleReference); - var importSymbol = resolveName(declaration, firstIdentifier.text, 107455 | 793064 | 1920, undefined, undefined); + var importSymbol = resolveName(declaration, firstIdentifier.escapedText, 107455 | 793064 | 1920, undefined, undefined); if (importSymbol) { buildVisibleNodeList(importSymbol.declarations); } @@ -27513,8 +24276,8 @@ var ts; function pushTypeResolution(target, propertyName) { var resolutionCycleStartIndex = findResolutionCycleStartIndex(target, propertyName); if (resolutionCycleStartIndex >= 0) { - var length_3 = resolutionTargets.length; - for (var i = resolutionCycleStartIndex; i < length_3; i++) { + var length_4 = resolutionTargets.length; + for (var i = resolutionCycleStartIndex; i < length_4; i++) { resolutionResults[i] = false; } return false; @@ -27597,24 +24360,24 @@ var ts; if (source.flags & 65536) { return mapType(source, function (t) { return getRestType(t, properties, symbol); }); } - var members = ts.createMap(); - var names = ts.createMap(); - for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { - var name = properties_3[_i]; + var members = ts.createSymbolTable(); + var names = ts.createUnderscoreEscapedMap(); + for (var _i = 0, properties_2 = properties; _i < properties_2.length; _i++) { + var name = properties_2[_i]; names.set(ts.getTextOfPropertyName(name), true); } for (var _a = 0, _b = getPropertiesOfType(source); _a < _b.length; _a++) { var prop = _b[_a]; - var inNamesToRemove = names.has(prop.name); + var inNamesToRemove = names.has(prop.escapedName); var isPrivate = ts.getDeclarationModifierFlagsFromSymbol(prop) & (8 | 16); var isSetOnlyAccessor = prop.flags & 65536 && !(prop.flags & 32768); if (!inNamesToRemove && !isPrivate && !isClassMethod(prop) && !isSetOnlyAccessor) { - members.set(prop.name, prop); + members.set(prop.escapedName, prop); } } var stringIndexInfo = getIndexInfoOfType(source, 0); var numberIndexInfo = getIndexInfoOfType(source, 1); - return createAnonymousType(symbol, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); + return createAnonymousType(symbol, members, ts.emptyArray, ts.emptyArray, stringIndexInfo, numberIndexInfo); } function getTypeForBindingElement(declaration) { var pattern = declaration.parent; @@ -27653,7 +24416,8 @@ var ts; getContextualType(declaration.initializer); } var text = ts.getTextOfPropertyName(name); - type = getTypeOfPropertyOfType(parentType, text) || + var declaredType = getTypeOfPropertyOfType(parentType, text); + type = declaredType && getFlowTypeOfReference(declaration, declaredType) || isNumericLiteralName(text) && getIndexTypeOfType(parentType, 1) || getIndexTypeOfType(parentType, 0); if (!type) { @@ -27725,7 +24489,7 @@ var ts; var declaredType = getTypeFromTypeNode(typeNode); return addOptionality(declaredType, declaration.questionToken && includeOptionality); } - if ((noImplicitAny || declaration.flags & 65536) && + if ((noImplicitAny || ts.isInJavaScriptFile(declaration)) && declaration.kind === 226 && !ts.isBindingPattern(declaration.name) && !(ts.getCombinedModifierFlags(declaration) & 1) && !ts.isInAmbientContext(declaration)) { if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) { @@ -27750,7 +24514,7 @@ var ts; } } var type = void 0; - if (declaration.symbol.name === "this") { + if (declaration.symbol.escapedName === "this") { type = getContextualThisParameterType(func); } else { @@ -27827,7 +24591,7 @@ var ts; return anyType; } function getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) { - var members = ts.createMap(); + var members = ts.createSymbolTable(); var stringIndexInfo; var hasComputedProperties = false; ts.forEach(pattern.elements, function (e) { @@ -27841,13 +24605,13 @@ var ts; return; } var text = ts.getTextOfPropertyName(name); - var flags = 4 | (e.initializer ? 67108864 : 0); + var flags = 4 | (e.initializer ? 16777216 : 0); var symbol = createSymbol(flags, text); symbol.type = getTypeFromBindingElement(e, includePatternInType, reportErrors); symbol.bindingElement = e; - members.set(symbol.name, symbol); + members.set(symbol.escapedName, symbol); }); - var result = createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, undefined); + var result = createAnonymousType(undefined, members, ts.emptyArray, ts.emptyArray, stringIndexInfo, undefined); if (includePatternInType) { result.pattern = pattern; } @@ -27902,7 +24666,7 @@ var ts; function getTypeOfVariableOrParameterOrProperty(symbol) { var links = getSymbolLinks(symbol); if (!links.type) { - if (symbol.flags & 16777216) { + if (symbol.flags & 4194304) { return links.type = getTypeOfPrototypeProperty(symbol); } var declaration = symbol.valueDeclaration; @@ -27912,7 +24676,7 @@ var ts; if (declaration.kind === 243) { return links.type = checkExpression(declaration.expression); } - if (declaration.flags & 65536 && declaration.kind === 292 && declaration.typeExpression) { + if (ts.isInJavaScriptFile(declaration) && ts.isJSDocPropertyLikeTag(declaration) && declaration.typeExpression) { return links.type = getTypeFromTypeNode(declaration.typeExpression.type); } if (!pushTypeResolution(symbol, 0)) { @@ -27958,7 +24722,7 @@ var ts; if (!links.type) { var getter = ts.getDeclarationOfKind(symbol, 153); var setter = ts.getDeclarationOfKind(symbol, 154); - if (getter && getter.flags & 65536) { + if (getter && ts.isInJavaScriptFile(getter)) { var jsDocType = getTypeForDeclarationFromJSDocComment(getter); if (jsDocType) { return links.type = jsDocType; @@ -28023,7 +24787,7 @@ var ts; links.type = baseTypeVariable ? getIntersectionType([type, baseTypeVariable]) : type; } else { - links.type = strictNullChecks && symbol.flags & 67108864 ? getNullableType(type, 2048) : type; + links.type = strictNullChecks && symbol.flags & 16777216 ? getNullableType(type, 2048) : type; } } } @@ -28094,7 +24858,7 @@ var ts; if (symbol.flags & 98304) { return getTypeOfAccessors(symbol); } - if (symbol.flags & 8388608) { + if (symbol.flags & 2097152) { return getTypeOfAlias(symbol); } return unknownType; @@ -28121,8 +24885,8 @@ var ts; } } function appendTypeParameters(typeParameters, declarations) { - for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { - var declaration = declarations_3[_i]; + for (var _i = 0, declarations_2 = declarations; _i < declarations_2.length; _i++) { + var declaration = declarations_2[_i]; var tp = getDeclaredTypeOfTypeParameter(getSymbolOfNode(declaration)); if (!typeParameters) { typeParameters = [tp]; @@ -28133,25 +24897,44 @@ var ts; } return typeParameters; } - function appendOuterTypeParameters(typeParameters, node) { + function getOuterTypeParameters(node, includeThisTypes) { while (true) { node = node.parent; if (!node) { - return typeParameters; + return undefined; } - if (node.kind === 229 || node.kind === 199 || - node.kind === 228 || node.kind === 186 || - node.kind === 151 || node.kind === 187) { - var declarations = node.typeParameters; - if (declarations) { - return appendTypeParameters(appendOuterTypeParameters(typeParameters, node), declarations); - } + switch (node.kind) { + case 229: + case 199: + case 230: + case 155: + case 156: + case 150: + case 160: + case 161: + case 273: + case 228: + case 151: + case 186: + case 187: + case 231: + case 282: + case 172: + var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); + if (node.kind === 172) { + return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); + } + var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node) || ts.emptyArray); + var thisType = includeThisTypes && + (node.kind === 229 || node.kind === 199 || node.kind === 230) && + getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; + return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } } } function getOuterTypeParametersOfClassOrInterface(symbol) { var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 230); - return appendOuterTypeParameters(undefined, declaration); + return getOuterTypeParameters(declaration); } function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) { var result; @@ -28246,7 +25029,7 @@ var ts; return type.resolvedBaseTypes; } function resolveBaseTypesOfClass(type) { - type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; + type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray; var baseConstructorType = getApparentType(getBaseConstructorTypeOfClass(type)); if (!(baseConstructorType.flags & (32768 | 131072 | 1))) { return; @@ -28288,7 +25071,7 @@ var ts; error(valueDecl, ts.Diagnostics.Type_0_recursively_references_itself_as_a_base_type, typeToString(type, undefined, 1)); return; } - if (type.resolvedBaseTypes === emptyArray) { + if (type.resolvedBaseTypes === ts.emptyArray) { type.resolvedBaseTypes = [baseType]; } else { @@ -28309,7 +25092,7 @@ var ts; type.flags & 131072 && !ts.forEach(type.types, function (t) { return !isValidBaseType(t); }); } function resolveBaseTypesOfInterface(type) { - type.resolvedBaseTypes = type.resolvedBaseTypes || emptyArray; + type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray; for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (declaration.kind === 230 && ts.getInterfaceBaseTypeNodes(declaration)) { @@ -28319,7 +25102,7 @@ var ts; if (baseType !== unknownType) { if (isValidBaseType(baseType)) { if (type !== baseType && !hasBaseType(baseType, type)) { - if (type.resolvedBaseTypes === emptyArray) { + if (type.resolvedBaseTypes === ts.emptyArray) { type.resolvedBaseTypes = [baseType]; } else { @@ -28391,20 +25174,10 @@ var ts; if (!pushTypeResolution(symbol, 2)) { return unknownType; } - var declaration = ts.getDeclarationOfKind(symbol, 291); - var type = void 0; - if (declaration) { - if (declaration.jsDocTypeLiteral) { - type = getTypeFromTypeNode(declaration.jsDocTypeLiteral); - } - else { - type = getTypeFromTypeNode(declaration.typeExpression.type); - } - } - else { - declaration = ts.getDeclarationOfKind(symbol, 231); - type = getTypeFromTypeNode(declaration.type); - } + var declaration = ts.find(symbol.declarations, function (d) { + return d.kind === 283 || d.kind === 231; + }); + var type = getTypeFromTypeNode(declaration.kind === 283 ? declaration.typeExpression : declaration.type); if (popTypeResolution()) { var typeParameters = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol); if (typeParameters) { @@ -28426,10 +25199,18 @@ var ts; if (!expr) { return !ts.isInAmbientContext(member); } - return expr.kind === 9 || expr.kind === 8 || - expr.kind === 192 && expr.operator === 38 && - expr.operand.kind === 8 || - expr.kind === 71 && (ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.text)); + switch (expr.kind) { + case 9: + case 8: + return true; + case 192: + return expr.operator === 38 && + expr.operand.kind === 8; + case 71: + return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); + default: + return false; + } } function getEnumKind(symbol) { var links = getSymbolLinks(symbol); @@ -28530,7 +25311,7 @@ var ts; if (symbol.flags & 8) { return getDeclaredTypeOfEnumMember(symbol); } - if (symbol.flags & 8388608) { + if (symbol.flags & 2097152) { return getDeclaredTypeOfAlias(symbol); } return unknownType; @@ -28603,27 +25384,19 @@ var ts; } return false; } - function createSymbolTable(symbols) { - var result = ts.createMap(); - for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) { - var symbol = symbols_1[_i]; - result.set(symbol.name, symbol); - } - return result; - } function createInstantiatedSymbolTable(symbols, mapper, mappingThisOnly) { - var result = ts.createMap(); + var result = ts.createSymbolTable(); for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) { var symbol = symbols_2[_i]; - result.set(symbol.name, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); + result.set(symbol.escapedName, mappingThisOnly && isIndependentMember(symbol) ? symbol : instantiateSymbol(symbol, mapper)); } return result; } function addInheritedMembers(symbols, baseSymbols) { for (var _i = 0, baseSymbols_1 = baseSymbols; _i < baseSymbols_1.length; _i++) { var s = baseSymbols_1[_i]; - if (!symbols.has(s.name)) { - symbols.set(s.name, s); + if (!symbols.has(s.escapedName)) { + symbols.set(s.escapedName, s); } } } @@ -28660,7 +25433,7 @@ var ts; var numberIndexInfo; if (ts.rangeEquals(typeParameters, typeArguments, 0, typeParameters.length)) { mapper = identityMapper; - members = source.symbol ? source.symbol.members : createSymbolTable(source.declaredProperties); + members = source.symbol ? source.symbol.members : ts.createSymbolTable(source.declaredProperties); callSignatures = source.declaredCallSignatures; constructSignatures = source.declaredConstructSignatures; stringIndexInfo = source.declaredStringIndexInfo; @@ -28677,7 +25450,7 @@ var ts; var baseTypes = getBaseTypes(source); if (baseTypes.length) { if (source.symbol && members === source.symbol.members) { - members = createSymbolTable(source.declaredProperties); + members = ts.createSymbolTable(source.declaredProperties); } var thisArgument = ts.lastOrUndefined(typeArguments); for (var _i = 0, baseTypes_1 = baseTypes; _i < baseTypes_1.length; _i++) { @@ -28697,7 +25470,7 @@ var ts; setStructuredTypeMembers(type, members, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } function resolveClassOrInterfaceMembers(type) { - resolveObjectTypeMembers(type, resolveDeclaredMembers(type), emptyArray, emptyArray); + resolveObjectTypeMembers(type, resolveDeclaredMembers(type), ts.emptyArray, ts.emptyArray); } function resolveTypeReferenceMembers(type) { var source = resolveDeclaredMembers(type.target); @@ -28726,7 +25499,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1); if (baseSignatures.length === 0) { - return [createSignature(undefined, classType.localTypeParameters, undefined, emptyArray, classType, undefined, 0, false, false)]; + return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, undefined, 0, false, false)]; } var baseTypeNode = getBaseTypeNodeOfClass(classType); var isJavaScript = ts.isInJavaScriptFile(baseTypeNode); @@ -28802,7 +25575,7 @@ var ts; } } } - return result || emptyArray; + return result || ts.emptyArray; } function getUnionIndexInfo(types, kind) { var indexTypes = []; @@ -28847,13 +25620,13 @@ var ts; return getIntersectionType(mixedTypes); } function resolveIntersectionTypeMembers(type) { - var callSignatures = emptyArray; - var constructSignatures = emptyArray; + var callSignatures = ts.emptyArray; + var constructSignatures = ts.emptyArray; var stringIndexInfo; var numberIndexInfo; var types = type.types; var mixinCount = ts.countWhere(types, isMixinConstructorType); - var _loop_3 = function (i) { + var _loop_4 = function (i) { var t = type.types[i]; if (mixinCount === 0 || mixinCount === types.length && i === 0 || !isMixinConstructorType(t)) { var signatures = getSignaturesOfType(t, 1); @@ -28871,7 +25644,7 @@ var ts; numberIndexInfo = intersectIndexInfos(numberIndexInfo, getIndexInfoOfType(t, 1)); }; for (var i = 0; i < types.length; i++) { - _loop_3(i); + _loop_4(i); } setStructuredTypeMembers(type, emptySymbols, callSignatures, constructSignatures, stringIndexInfo, numberIndexInfo); } @@ -28895,7 +25668,7 @@ var ts; } else { var members = emptySymbols; - var constructSignatures = emptyArray; + var constructSignatures = ts.emptyArray; var stringIndexInfo = undefined; if (symbol.exports) { members = getExportsOfSymbol(symbol); @@ -28908,7 +25681,7 @@ var ts; } var baseConstructorType = getBaseConstructorTypeOfClass(classType); if (baseConstructorType.flags & (32768 | 131072 | 540672)) { - members = createSymbolTable(getNamedMembers(members)); + members = ts.createSymbolTable(getNamedMembers(members)); addInheritedMembers(members, getPropertiesOfType(baseConstructorType)); } else if (baseConstructorType === anyType) { @@ -28916,16 +25689,16 @@ var ts; } } var numberIndexInfo = symbol.flags & 384 ? enumNumberIndexInfo : undefined; - setStructuredTypeMembers(type, members, emptyArray, constructSignatures, stringIndexInfo, numberIndexInfo); + setStructuredTypeMembers(type, members, ts.emptyArray, constructSignatures, stringIndexInfo, numberIndexInfo); if (symbol.flags & (16 | 8192)) { type.callSignatures = getSignaturesOfSymbol(symbol); } } } function resolveMappedTypeMembers(type) { - var members = ts.createMap(); + var members = ts.createSymbolTable(); var stringIndexInfo; - setStructuredTypeMembers(type, emptySymbols, emptyArray, emptyArray, undefined, undefined); + setStructuredTypeMembers(type, emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); var typeParameter = getTypeParameterFromMappedType(type); var constraintType = getConstraintTypeFromMappedType(type); var templateType = getTemplateTypeFromMappedType(type); @@ -28946,16 +25719,16 @@ var ts; var iterationType = keyType.flags & 262144 ? getIndexType(getApparentType(keyType.type)) : keyType; forEachType(iterationType, addMemberForKeyType); } - setStructuredTypeMembers(type, members, emptyArray, emptyArray, stringIndexInfo, undefined); + setStructuredTypeMembers(type, members, ts.emptyArray, ts.emptyArray, stringIndexInfo, undefined); function addMemberForKeyType(t, propertySymbol) { var iterationMapper = createTypeMapper([typeParameter], [t]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, iterationMapper) : iterationMapper; var propType = instantiateType(templateType, templateMapper); if (t.flags & 32) { - var propName = t.value; + var propName = ts.escapeLeadingUnderscores(t.value); var modifiersProp = getPropertyOfType(modifiersType, propName); - var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 67108864); - var prop = createSymbol(4 | (isOptional ? 67108864 : 0), propName); + var isOptional = templateOptional || !!(modifiersProp && modifiersProp.flags & 16777216); + var prop = createSymbol(4 | (isOptional ? 16777216 : 0), propName); prop.checkFlags = templateReadonly || modifiersProp && isReadonlySymbol(modifiersProp) ? 8 : 0; prop.type = propType; if (propertySymbol) { @@ -28998,12 +25771,11 @@ var ts; } return type.modifiersType; } + function isPartialMappedType(type) { + return getObjectFlags(type) & 32 && !!type.declaration.questionToken; + } function isGenericMappedType(type) { - if (getObjectFlags(type) & 32) { - var constraintType = getConstraintTypeFromMappedType(type); - return maybeTypeOfKind(constraintType, 540672 | 262144); - } - return false; + return getObjectFlags(type) & 32 && isGenericIndexType(getConstraintTypeFromMappedType(type)); } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -29034,7 +25806,7 @@ var ts; if (type.flags & 32768) { return resolveStructuredTypeMembers(type).properties; } - return emptyArray; + return ts.emptyArray; } function getPropertyOfObjectType(type, name) { if (type.flags & 32768) { @@ -29047,15 +25819,15 @@ var ts; } function getPropertiesOfUnionOrIntersectionType(type) { if (!type.resolvedProperties) { - var members = ts.createMap(); + var members = ts.createSymbolTable(); for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var current = _a[_i]; for (var _b = 0, _c = getPropertiesOfType(current); _b < _c.length; _b++) { var prop = _c[_b]; - if (!members.has(prop.name)) { - var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.name); + if (!members.has(prop.escapedName)) { + var combinedProp = getPropertyOfUnionOrIntersectionType(type, prop.escapedName); if (combinedProp) { - members.set(prop.name, combinedProp); + members.set(prop.escapedName, combinedProp); } } } @@ -29075,16 +25847,16 @@ var ts; } function getAllPossiblePropertiesOfType(type) { if (type.flags & 65536) { - var props = ts.createMap(); + var props = ts.createSymbolTable(); for (var _i = 0, _a = type.types; _i < _a.length; _i++) { var memberType = _a[_i]; if (memberType.flags & 8190) { continue; } for (var _b = 0, _c = getPropertiesOfType(memberType); _b < _c.length; _b++) { - var name = _c[_b].name; - if (!props.has(name)) { - props.set(name, createUnionOrIntersectionProperty(type, name)); + var escapedName = _c[_b].escapedName; + if (!props.has(escapedName)) { + props.set(escapedName, createUnionOrIntersectionProperty(type, escapedName)); } } } @@ -29103,6 +25875,10 @@ var ts; return hasNonCircularBaseConstraint(typeParameter) ? getConstraintFromTypeParameter(typeParameter) : undefined; } function getConstraintOfIndexedAccess(type) { + var transformed = getTransformedIndexedAccessType(type); + if (transformed) { + return transformed; + } var baseObjectType = getBaseConstraintOfType(type.objectType); var baseIndexType = getBaseConstraintOfType(type.indexType); return baseObjectType || baseIndexType ? getIndexedAccessType(baseObjectType || type.objectType, baseIndexType || type.indexType) : undefined; @@ -29165,11 +25941,18 @@ var ts; return stringType; } if (t.flags & 524288) { + var transformed = getTransformedIndexedAccessType(t); + if (transformed) { + return getBaseConstraint(transformed); + } var baseObjectType = getBaseConstraint(t.objectType); var baseIndexType = getBaseConstraint(t.indexType); var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType) : undefined; return baseIndexedAccess && baseIndexedAccess !== unknownType ? getBaseConstraint(baseIndexedAccess) : undefined; } + if (isGenericMappedType(t)) { + return emptyObjectType; + } return t; } } @@ -29204,7 +25987,7 @@ var ts; var types = containingType.types; var isUnion = containingType.flags & 65536; var excludeModifiers = isUnion ? 24 : 0; - var commonFlags = isUnion ? 0 : 67108864; + var commonFlags = isUnion ? 0 : 16777216; var syntheticFlag = 4; var checkFlags = 0; for (var _i = 0, types_3 = types; _i < types_3.length; _i++) { @@ -29266,7 +26049,7 @@ var ts; return result; } function getUnionOrIntersectionProperty(type, name) { - var properties = type.propertyCache || (type.propertyCache = ts.createMap()); + var properties = type.propertyCache || (type.propertyCache = ts.createSymbolTable()); var property = properties.get(name); if (!property) { property = createUnionOrIntersectionProperty(type, name); @@ -29306,7 +26089,7 @@ var ts; var resolved = resolveStructuredTypeMembers(type); return kind === 0 ? resolved.callSignatures : resolved.constructSignatures; } - return emptyArray; + return ts.emptyArray; } function getSignaturesOfType(type, kind) { return getSignaturesOfStructuredType(getApparentType(type), kind); @@ -29332,7 +26115,7 @@ var ts; var propTypes = []; for (var _i = 0, _a = getPropertiesOfType(type); _i < _a.length; _i++) { var prop = _a[_i]; - if (kind === 0 || isNumericLiteralName(prop.name)) { + if (kind === 0 || isNumericLiteralName(prop.escapedName)) { propTypes.push(getTypeOfSymbol(prop)); } } @@ -29365,8 +26148,8 @@ var ts; return result; } function isJSDocOptionalParameter(node) { - if (node.flags & 65536) { - if (node.type && node.type.kind === 278) { + if (ts.isInJavaScriptFile(node)) { + if (node.type && node.type.kind === 272) { return true; } var paramTags = ts.getJSDocParameterTags(node); @@ -29377,7 +26160,7 @@ var ts; return true; } if (paramTag.typeExpression) { - return paramTag.typeExpression.type.kind === 278; + return paramTag.typeExpression.type.kind === 272; } } } @@ -29410,11 +26193,11 @@ var ts; return false; } function createTypePredicateFromTypePredicateNode(node) { - if (node.parameterName.kind === 71) { - var parameterName = node.parameterName; + var parameterName = node.parameterName; + if (parameterName.kind === 71) { return { kind: 1, - parameterName: parameterName ? parameterName.text : undefined, + parameterName: parameterName ? parameterName.escapedText : undefined, parameterIndex: parameterName ? getTypePredicateParameterIndex(node.parent.parameters, parameterName) : undefined, type: getTypeFromTypeNode(node.type) }; @@ -29447,12 +26230,12 @@ var ts; typeArguments = []; } for (var i = numTypeArguments; i < numTypeParameters; i++) { - typeArguments[i] = isJavaScript ? anyType : emptyObjectType; + typeArguments[i] = getDefaultTypeArgumentType(isJavaScript); } for (var i = numTypeArguments; i < numTypeParameters; i++) { var mapper = createTypeMapper(typeParameters, typeArguments); var defaultType = getDefaultFromTypeParameter(typeParameters[i]); - typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : isJavaScript ? anyType : emptyObjectType; + typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : getDefaultTypeArgumentType(isJavaScript); } } } @@ -29473,10 +26256,10 @@ var ts; var param = declaration.parameters[i]; var paramSymbol = param.symbol; if (paramSymbol && !!(paramSymbol.flags & 4) && !ts.isBindingPattern(param.name)) { - var resolvedSymbol = resolveName(param, paramSymbol.name, 107455, undefined, undefined); + var resolvedSymbol = resolveName(param, paramSymbol.escapedName, 107455, undefined, undefined); paramSymbol = resolvedSymbol; } - if (i === 0 && paramSymbol.name === "this") { + if (i === 0 && paramSymbol.escapedName === "this") { hasThisParameter = true; thisParameter = param.symbol; } @@ -29512,7 +26295,7 @@ var ts; createTypePredicateFromTypePredicateNode(declaration.type) : undefined; var hasRestLikeParameter = ts.hasRestParameter(declaration); - if (!hasRestLikeParameter && ts.isInJavaScriptFile(declaration) && !ts.hasJSDocParameterTags(declaration) && containsArgumentsReference(declaration)) { + if (!hasRestLikeParameter && ts.isInJavaScriptFile(declaration) && containsArgumentsReference(declaration)) { hasRestLikeParameter = true; var syntheticArgsSymbol = createSymbol(3, "args"); syntheticArgsSymbol.type = anyArrayType; @@ -29558,7 +26341,7 @@ var ts; return false; switch (node.kind) { case 71: - return node.text === "arguments" && ts.isPartOfExpression(node); + return node.escapedText === "arguments" && ts.isPartOfExpression(node); case 149: case 151: case 153: @@ -29572,7 +26355,7 @@ var ts; } function getSignaturesOfSymbol(symbol) { if (!symbol) - return emptyArray; + return ts.emptyArray; var result = []; for (var i = 0; i < symbol.declarations.length; i++) { var node = symbol.declarations[i]; @@ -29590,7 +26373,7 @@ var ts; case 154: case 186: case 187: - case 279: + case 273: if (i > 0 && node.body) { var previous = symbol.declarations[i - 1]; if (node.parent === previous.parent && node.kind === previous.kind && node.pos === previous.end) { @@ -29649,6 +26432,9 @@ var ts; } return signature.resolvedReturnType; } + function isResolvingReturnTypeOfSignature(signature) { + return !signature.resolvedReturnType && findResolutionCycleStartIndex(signature, 3) >= 0; + } function getRestTypeOfSignature(signature) { if (signature.hasRestParameter) { var type = getTypeOfSymbol(ts.lastOrUndefined(signature.parameters)); @@ -29672,21 +26458,29 @@ var ts; return instantiateSignature(signature, createTypeMapper(signature.typeParameters, typeArguments), true); } function getErasedSignature(signature) { - if (!signature.typeParameters) - return signature; - if (!signature.erasedSignatureCache) { - signature.erasedSignatureCache = instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); - } - return signature.erasedSignatureCache; + return signature.typeParameters ? + signature.erasedSignatureCache || (signature.erasedSignatureCache = createErasedSignature(signature)) : + signature; + } + function createErasedSignature(signature) { + return instantiateSignature(signature, createTypeEraser(signature.typeParameters), true); + } + function getCanonicalSignature(signature) { + return signature.typeParameters ? + signature.canonicalSignatureCache || (signature.canonicalSignatureCache = createCanonicalSignature(signature)) : + signature; + } + function createCanonicalSignature(signature) { + return getSignatureInstantiation(signature, ts.map(signature.typeParameters, function (tp) { return tp.target && !getConstraintOfTypeParameter(tp.target) ? tp.target : tp; })); } function getOrCreateTypeFromSignature(signature) { if (!signature.isolatedSignatureType) { var isConstructor = signature.declaration.kind === 152 || signature.declaration.kind === 156; var type = createObjectType(16); type.members = emptySymbols; - type.properties = emptyArray; - type.callSignatures = !isConstructor ? [signature] : emptyArray; - type.constructSignatures = isConstructor ? [signature] : emptyArray; + type.properties = ts.emptyArray; + type.callSignatures = !isConstructor ? [signature] : ts.emptyArray; + type.constructSignatures = isConstructor ? [signature] : ts.emptyArray; signature.isolatedSignatureType = type; } return signature.isolatedSignatureType; @@ -29717,7 +26511,7 @@ var ts; function getIndexInfoOfSymbol(symbol, kind) { var declaration = getIndexDeclarationOfSymbol(symbol, kind); if (declaration) { - return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, (ts.getModifierFlags(declaration) & 64) !== 0, declaration); + return createIndexInfo(declaration.type ? getTypeFromTypeNode(declaration.type) : anyType, ts.hasModifier(declaration, 64), declaration); } return undefined; } @@ -29743,12 +26537,12 @@ var ts; function getTypeListId(types) { var result = ""; if (types) { - var length_4 = types.length; + var length_5 = types.length; var i = 0; - while (i < length_4) { + while (i < length_5) { var startId = types[i].id; var count = 1; - while (i + count < length_4 && types[i + count].id === startId + count) { + while (i + count < length_5 && types[i + count].id === startId + count) { count++; } if (result.length) { @@ -29824,7 +26618,7 @@ var ts; var id = getTypeListId(typeArguments); var instantiation = links.instantiations.get(id); if (!instantiation) { - links.instantiations.set(id, instantiation = instantiateTypeNoAlias(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters))))); + links.instantiations.set(id, instantiation = instantiateType(type, createTypeMapper(typeParameters, fillMissingTypeArguments(typeArguments, typeParameters, getMinTypeArgumentCount(typeParameters))))); } return instantiation; } @@ -29859,8 +26653,6 @@ var ts; switch (node.kind) { case 159: return node.typeName; - case 277: - return node.name; case 201: var expr = node.expression; if (ts.isEntityNameExpression(expr)) { @@ -29884,7 +26676,7 @@ var ts; if (type) { return type; } - if (symbol.flags & 107455 && node.kind === 277) { + if (symbol.flags & 107455 && isJSDocTypeReference(node)) { var valueType = getTypeOfSymbol(symbol); if (valueType.symbol && !isInferredClassType(valueType)) { var referenceType = getTypeReferenceTypeWorker(node, valueType.symbol, typeArguments); @@ -29904,13 +26696,29 @@ var ts; if (symbol.flags & 524288) { return getTypeFromTypeAliasReference(node, symbol, typeArguments); } - if (symbol.flags & 16 && node.kind === 277 && (symbol.members || ts.getJSDocClassTag(symbol.valueDeclaration))) { + if (symbol.flags & 16 && + isJSDocTypeReference(node) && + (symbol.members || ts.getJSDocClassTag(symbol.valueDeclaration))) { return getInferredClassType(symbol); } } - function getPrimitiveTypeFromJSDocTypeReference(node) { - if (ts.isIdentifier(node.name)) { - switch (node.name.text) { + function isJSDocTypeReference(node) { + return node.flags & 1048576 && node.kind === 159; + } + function getIntendedTypeFromJSDocTypeReference(node) { + if (ts.isIdentifier(node.typeName)) { + if (node.typeName.escapedText === "Object") { + if (node.typeArguments && node.typeArguments.length === 2) { + var indexed = getTypeFromTypeNode(node.typeArguments[0]); + var target = getTypeFromTypeNode(node.typeArguments[1]); + var index = createIndexInfo(target, false); + if (indexed === stringType || indexed === numberType) { + return createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, indexed === stringType && index, indexed === numberType && index); + } + } + return anyType; + } + switch (node.typeName.escapedText) { case "String": return stringType; case "Number": @@ -29923,14 +26731,12 @@ var ts; return undefinedType; case "Null": return nullType; - case "Object": - return anyType; case "Function": case "function": return globalFunctionType; case "Array": case "array": - return !node.typeArguments || !node.typeArguments.length ? createArrayType(anyType) : undefined; + return !node.typeArguments || !node.typeArguments.length ? anyArrayType : undefined; case "Promise": case "promise": return !node.typeArguments || !node.typeArguments.length ? createPromiseType(anyType) : undefined; @@ -29947,8 +26753,8 @@ var ts; var symbol = void 0; var type = void 0; var meaning = 793064; - if (node.kind === 277) { - type = getPrimitiveTypeFromJSDocTypeReference(node); + if (isJSDocTypeReference(node)) { + type = getIntendedTypeFromJSDocTypeReference(node); meaning |= 107455; } if (!type) { @@ -29973,8 +26779,8 @@ var ts; function getTypeOfGlobalSymbol(symbol, arity) { function getTypeDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { - var declaration = declarations_4[_i]; + for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { + var declaration = declarations_3[_i]; switch (declaration.kind) { case 229: case 230: @@ -29988,11 +26794,11 @@ var ts; } var type = getDeclaredTypeOfSymbol(symbol); if (!(type.flags & 32768)) { - error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, symbol.name); + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_be_a_class_or_interface_type, ts.unescapeLeadingUnderscores(symbol.escapedName)); return arity ? emptyGenericType : emptyObjectType; } if (ts.length(type.typeParameters) !== arity) { - error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, symbol.name, arity); + error(getTypeDeclaration(symbol), ts.Diagnostics.Global_type_0_must_have_1_type_parameter_s, ts.unescapeLeadingUnderscores(symbol.escapedName), arity); return arity ? emptyGenericType : emptyObjectType; } return type; @@ -30109,8 +26915,8 @@ var ts; type.thisType.isThisType = true; type.thisType.constraint = type; type.declaredProperties = properties; - type.declaredCallSignatures = emptyArray; - type.declaredConstructSignatures = emptyArray; + type.declaredCallSignatures = ts.emptyArray; + type.declaredConstructSignatures = ts.emptyArray; type.declaredStringIndexInfo = undefined; type.declaredNumberIndexInfo = undefined; return type; @@ -30379,9 +27185,9 @@ var ts; return type.resolvedIndexType; } function getLiteralTypeFromPropertyName(prop) { - return ts.getDeclarationModifierFlagsFromSymbol(prop) & 24 || ts.startsWith(prop.name, "__@") ? + return ts.getDeclarationModifierFlagsFromSymbol(prop) & 24 || ts.startsWith(prop.escapedName, "__@") ? neverType : - getLiteralType(ts.unescapeIdentifier(prop.name)); + getLiteralType(ts.unescapeLeadingUnderscores(prop.escapedName)); } function getLiteralTypeFromPropertyNames(type) { return getUnionType(ts.map(getPropertiesOfType(type), getLiteralTypeFromPropertyName)); @@ -30412,9 +27218,9 @@ var ts; function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol) { var accessExpression = accessNode && accessNode.kind === 180 ? accessNode : undefined; var propName = indexType.flags & 96 ? - "" + indexType.value : + ts.escapeLeadingUnderscores("" + indexType.value) : accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ? - ts.getPropertyNameForKnownSymbolName(accessExpression.argumentExpression.name.text) : + ts.getPropertyNameForKnownSymbolName(ts.unescapeLeadingUnderscores(accessExpression.argumentExpression.name.escapedText)) : undefined; if (propName !== undefined) { var prop = getPropertyOfType(objectType, propName); @@ -30431,11 +27237,11 @@ var ts; return getTypeOfSymbol(prop); } } - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 262178 | 84 | 512)) { + if (!(indexType.flags & 6144) && isTypeAssignableToKind(indexType, 262178 | 84 | 512)) { if (isTypeAny(objectType)) { return anyType; } - var indexInfo = isTypeAnyOrAllConstituentTypesHaveKind(indexType, 84) && getIndexInfoOfType(objectType, 1) || + var indexInfo = isTypeAssignableToKind(indexType, 84) && getIndexInfoOfType(objectType, 1) || getIndexInfoOfType(objectType, 0) || undefined; if (indexInfo) { @@ -30473,25 +27279,69 @@ var ts; return anyType; } function getIndexedAccessForMappedType(type, indexType, accessNode) { - var accessExpression = accessNode && accessNode.kind === 180 ? accessNode : undefined; - if (accessExpression && ts.isAssignmentTarget(accessExpression) && type.declaration.readonlyToken) { - error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); - return unknownType; + if (accessNode) { + if (!isTypeAssignableTo(indexType, getIndexType(type))) { + error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(type)); + return unknownType; + } + if (accessNode.kind === 180 && ts.isAssignmentTarget(accessNode) && type.declaration.readonlyToken) { + error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(type)); + return unknownType; + } } var mapper = createTypeMapper([getTypeParameterFromMappedType(type)], [indexType]); var templateMapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; return instantiateType(getTemplateTypeFromMappedType(type), templateMapper); } + function isGenericObjectType(type) { + return type.flags & 540672 ? true : + getObjectFlags(type) & 32 ? isGenericIndexType(getConstraintTypeFromMappedType(type)) : + type.flags & 196608 ? ts.forEach(type.types, isGenericObjectType) : + false; + } + function isGenericIndexType(type) { + return type.flags & (540672 | 262144) ? true : + type.flags & 196608 ? ts.forEach(type.types, isGenericIndexType) : + false; + } + function isStringIndexOnlyType(type) { + if (type.flags & 32768 && !isGenericMappedType(type)) { + var t = resolveStructuredTypeMembers(type); + return t.properties.length === 0 && + t.callSignatures.length === 0 && t.constructSignatures.length === 0 && + t.stringIndexInfo && !t.numberIndexInfo; + } + return false; + } + function getTransformedIndexedAccessType(type) { + var objectType = type.objectType; + if (objectType.flags & 131072 && isGenericObjectType(objectType) && ts.some(objectType.types, isStringIndexOnlyType)) { + var regularTypes = []; + var stringIndexTypes = []; + for (var _i = 0, _a = objectType.types; _i < _a.length; _i++) { + var t = _a[_i]; + if (isStringIndexOnlyType(t)) { + stringIndexTypes.push(getIndexTypeOfType(t, 0)); + } + else { + regularTypes.push(t); + } + } + return getUnionType([ + getIndexedAccessType(getIntersectionType(regularTypes), type.indexType), + getIntersectionType(stringIndexTypes) + ]); + } + return undefined; + } function getIndexedAccessType(objectType, indexType, accessNode) { - if (maybeTypeOfKind(indexType, 540672 | 262144) || - maybeTypeOfKind(objectType, 540672) && !(accessNode && accessNode.kind === 180) || - isGenericMappedType(objectType)) { + if (isGenericMappedType(objectType)) { + return getIndexedAccessForMappedType(objectType, indexType, accessNode); + } + if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind === 180) && isGenericObjectType(objectType)) { if (objectType.flags & 1) { return objectType; } - if (isGenericMappedType(objectType)) { - return getIndexedAccessForMappedType(objectType, indexType, accessNode); - } var id = objectType.id + "," + indexType.id; var type = indexedAccessTypes.get(id); if (!type) { @@ -30544,6 +27394,9 @@ var ts; var type = createObjectType(16, node.symbol); type.aliasSymbol = aliasSymbol; type.aliasTypeArguments = getAliasTypeArgumentsForTypeNode(node); + if (ts.isJSDocTypeLiteral(node) && node.isArrayType) { + type = createArrayType(type); + } links.resolvedType = type; } } @@ -30575,8 +27428,8 @@ var ts; if (right.flags & 16777216) { return emptyObjectType; } - var members = ts.createMap(); - var skippedPrivateMembers = ts.createMap(); + var members = ts.createSymbolTable(); + var skippedPrivateMembers = ts.createUnderscoreEscapedMap(); var stringIndexInfo; var numberIndexInfo; if (left === emptyObjectType) { @@ -30591,45 +27444,45 @@ var ts; var rightProp = _a[_i]; var isSetterWithoutGetter = rightProp.flags & 65536 && !(rightProp.flags & 32768); if (ts.getDeclarationModifierFlagsFromSymbol(rightProp) & (8 | 16)) { - skippedPrivateMembers.set(rightProp.name, true); + skippedPrivateMembers.set(rightProp.escapedName, true); } else if (!isClassMethod(rightProp) && !isSetterWithoutGetter) { - members.set(rightProp.name, getNonReadonlySymbol(rightProp)); + members.set(rightProp.escapedName, getNonReadonlySymbol(rightProp)); } } for (var _b = 0, _c = getPropertiesOfType(left); _b < _c.length; _b++) { var leftProp = _c[_b]; if (leftProp.flags & 65536 && !(leftProp.flags & 32768) - || skippedPrivateMembers.has(leftProp.name) + || skippedPrivateMembers.has(leftProp.escapedName) || isClassMethod(leftProp)) { continue; } - if (members.has(leftProp.name)) { - var rightProp = members.get(leftProp.name); + if (members.has(leftProp.escapedName)) { + var rightProp = members.get(leftProp.escapedName); var rightType = getTypeOfSymbol(rightProp); - if (rightProp.flags & 67108864) { + if (rightProp.flags & 16777216) { var declarations = ts.concatenate(leftProp.declarations, rightProp.declarations); - var flags = 4 | (leftProp.flags & 67108864); - var result = createSymbol(flags, leftProp.name); + var flags = 4 | (leftProp.flags & 16777216); + var result = createSymbol(flags, leftProp.escapedName); result.type = getUnionType([getTypeOfSymbol(leftProp), getTypeWithFacts(rightType, 131072)]); result.leftSpread = leftProp; result.rightSpread = rightProp; result.declarations = declarations; - members.set(leftProp.name, result); + members.set(leftProp.escapedName, result); } } else { - members.set(leftProp.name, getNonReadonlySymbol(leftProp)); + members.set(leftProp.escapedName, getNonReadonlySymbol(leftProp)); } } - return createAnonymousType(undefined, members, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); + return createAnonymousType(undefined, members, ts.emptyArray, ts.emptyArray, stringIndexInfo, numberIndexInfo); } function getNonReadonlySymbol(prop) { if (!isReadonlySymbol(prop)) { return prop; } - var flags = 4 | (prop.flags & 67108864); - var result = createSymbol(flags, prop.name); + var flags = 4 | (prop.flags & 16777216); + var result = createSymbol(flags, prop.escapedName); result.type = getTypeOfSymbol(prop); result.declarations = prop.declarations; result.syntheticOrigin = prop; @@ -30683,19 +27536,11 @@ var ts; } return links.resolvedType; } - function getTypeFromJSDocTupleType(node) { - var links = getNodeLinks(node); - if (!links.resolvedType) { - var types = ts.map(node.types, getTypeFromTypeNode); - links.resolvedType = createTupleType(types); - } - return links.resolvedType; - } function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; if (parent && (ts.isClassLike(parent) || parent.kind === 230)) { - if (!(ts.getModifierFlags(container) & 32) && + if (!ts.hasModifier(container, 32) && (container.kind !== 152 || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; } @@ -30733,16 +27578,13 @@ var ts; case 130: return neverType; case 134: - return nonPrimitiveType; + return node.flags & 65536 ? anyType : nonPrimitiveType; case 169: case 99: return getTypeFromThisTypeNode(node); case 173: return getTypeFromLiteralTypeNode(node); - case 294: - return getTypeFromLiteralTypeNode(node.literal); case 159: - case 277: return getTypeFromTypeReference(node); case 158: return booleanType; @@ -30751,30 +27593,25 @@ var ts; case 162: return getTypeFromTypeQueryNode(node); case 164: - case 270: return getTypeFromArrayTypeNode(node); case 165: return getTypeFromTupleTypeNode(node); case 166: - case 271: return getTypeFromUnionTypeNode(node); case 167: return getTypeFromIntersectionTypeNode(node); - case 273: + case 270: return getTypeFromJSDocNullableTypeNode(node); case 168: - case 274: - case 281: - case 282: - case 278: + case 271: + case 272: + case 267: return getTypeFromTypeNode(node.type); - case 275: - return getTypeFromTypeNode(node.literal); case 160: case 161: case 163: - case 293: - case 279: + case 285: + case 273: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); case 170: return getTypeFromTypeOperatorNode(node); @@ -30786,9 +27623,7 @@ var ts; case 143: var symbol = getSymbolAtLocation(node); return symbol && getDeclaredTypeOfSymbol(symbol); - case 272: - return getTypeFromJSDocTupleType(node); - case 280: + case 274: return getTypeFromJSDocVariadicType(node); default: return unknownType; @@ -30811,10 +27646,6 @@ var ts; function instantiateSignatures(signatures, mapper) { return instantiateList(signatures, mapper, instantiateSignature); } - function instantiateCached(type, mapper, instantiator) { - var instantiations = mapper.instantiations || (mapper.instantiations = []); - return instantiations[type.id] || (instantiations[type.id] = instantiator(type, mapper)); - } function makeUnaryTypeMapper(source, target) { return function (t) { return t === source ? target : t; }; } @@ -30832,40 +27663,33 @@ var ts; }; } function createTypeMapper(sources, targets) { - var mapper = sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : + ts.Debug.assert(targets === undefined || sources.length === targets.length); + return sources.length === 1 ? makeUnaryTypeMapper(sources[0], targets ? targets[0] : anyType) : sources.length === 2 ? makeBinaryTypeMapper(sources[0], targets ? targets[0] : anyType, sources[1], targets ? targets[1] : anyType) : makeArrayTypeMapper(sources, targets); - mapper.mappedTypes = sources; - return mapper; } function createTypeEraser(sources) { return createTypeMapper(sources, undefined); } function createBackreferenceMapper(typeParameters, index) { - var mapper = function (t) { return ts.indexOf(typeParameters, t) >= index ? emptyObjectType : t; }; - mapper.mappedTypes = typeParameters; - return mapper; + return function (t) { return ts.indexOf(typeParameters, t) >= index ? emptyObjectType : t; }; } function isInferenceContext(mapper) { return !!mapper.signature; } function cloneTypeMapper(mapper) { return mapper && isInferenceContext(mapper) ? - createInferenceContext(mapper.signature, mapper.flags | 2, mapper.inferences) : + createInferenceContext(mapper.signature, mapper.flags | 2, mapper.compareTypes, mapper.inferences) : mapper; } function identityMapper(type) { return type; } function combineTypeMappers(mapper1, mapper2) { - var mapper = function (t) { return instantiateType(mapper1(t), mapper2); }; - mapper.mappedTypes = ts.concatenate(mapper1.mappedTypes, mapper2.mappedTypes); - return mapper; + return function (t) { return instantiateType(mapper1(t), mapper2); }; } function createReplacementMapper(source, target, baseMapper) { - var mapper = function (t) { return t === source ? target : baseMapper(t); }; - mapper.mappedTypes = baseMapper.mappedTypes; - return mapper; + return function (t) { return t === source ? target : baseMapper(t); }; } function cloneTypeParameter(typeParameter) { var result = createType(16384); @@ -30914,7 +27738,7 @@ var ts; symbol = links.target; mapper = combineTypeMappers(links.mapper, mapper); } - var result = createSymbol(symbol.flags, symbol.name); + var result = createSymbol(symbol.flags, symbol.escapedName); result.checkFlags = 1; result.declarations = symbol.declarations; result.parent = symbol.parent; @@ -30925,13 +27749,45 @@ var ts; } return result; } - function instantiateAnonymousType(type, mapper) { - var result = createObjectType(16 | 64, type.symbol); - result.target = type.objectFlags & 64 ? type.target : type; - result.mapper = type.objectFlags & 64 ? combineTypeMappers(type.mapper, mapper) : mapper; - result.aliasSymbol = type.aliasSymbol; - result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper); - return result; + function getAnonymousTypeInstantiation(type, mapper) { + var target = type.objectFlags & 64 ? type.target : type; + var symbol = target.symbol; + var links = getSymbolLinks(symbol); + var typeParameters = links.typeParameters; + if (!typeParameters) { + var declaration_1 = symbol.declarations[0]; + var outerTypeParameters = getOuterTypeParameters(declaration_1, true) || ts.emptyArray; + typeParameters = symbol.flags & 2048 && !target.aliasTypeArguments ? + ts.filter(outerTypeParameters, function (tp) { return isTypeParameterReferencedWithin(tp, declaration_1); }) : + outerTypeParameters; + links.typeParameters = typeParameters; + if (typeParameters.length) { + links.instantiations = ts.createMap(); + links.instantiations.set(getTypeListId(typeParameters), target); + } + } + if (typeParameters.length) { + var combinedMapper = type.objectFlags & 64 ? combineTypeMappers(type.mapper, mapper) : mapper; + var typeArguments = ts.map(typeParameters, combinedMapper); + var id = getTypeListId(typeArguments); + var result = links.instantiations.get(id); + if (!result) { + var newMapper = createTypeMapper(typeParameters, typeArguments); + result = target.objectFlags & 32 ? instantiateMappedType(target, newMapper) : instantiateAnonymousType(target, newMapper); + links.instantiations.set(id, result); + } + return result; + } + return type; + } + function isTypeParameterReferencedWithin(tp, node) { + return tp.isThisType ? ts.forEachChild(node, checkThis) : ts.forEachChild(node, checkIdentifier); + function checkThis(node) { + return node.kind === 169 || ts.forEachChild(node, checkThis); + } + function checkIdentifier(node) { + return node.kind === 71 && ts.isPartOfTypeNode(node) && getTypeFromTypeNode(node) === tp || ts.forEachChild(node, checkIdentifier); + } } function instantiateMappedType(type, mapper) { var constraintType = getConstraintTypeFromMappedType(type); @@ -30942,134 +27798,58 @@ var ts; if (typeVariable_1 !== mappedTypeVariable) { return mapType(mappedTypeVariable, function (t) { if (isMappableType(t)) { - return instantiateMappedObjectType(type, createReplacementMapper(typeVariable_1, t, mapper)); + return instantiateAnonymousType(type, createReplacementMapper(typeVariable_1, t, mapper)); } return t; }); } } } - return instantiateMappedObjectType(type, mapper); + return instantiateAnonymousType(type, mapper); } function isMappableType(type) { return type.flags & (16384 | 32768 | 131072 | 524288); } - function instantiateMappedObjectType(type, mapper) { - var result = createObjectType(32 | 64, type.symbol); - result.declaration = type.declaration; - result.mapper = type.mapper ? combineTypeMappers(type.mapper, mapper) : mapper; + function instantiateAnonymousType(type, mapper) { + var result = createObjectType(type.objectFlags | 64, type.symbol); + if (type.objectFlags & 32) { + result.declaration = type.declaration; + } + result.target = type; + result.mapper = mapper; result.aliasSymbol = type.aliasSymbol; result.aliasTypeArguments = instantiateTypes(type.aliasTypeArguments, mapper); return result; } - function isSymbolInScopeOfMappedTypeParameter(symbol, mapper) { - if (!(symbol.declarations && symbol.declarations.length)) { - return false; - } - var mappedTypes = mapper.mappedTypes; - return !!ts.findAncestor(symbol.declarations[0], function (node) { - if (node.kind === 233 || node.kind === 265) { - return "quit"; - } - switch (node.kind) { - case 160: - case 161: - case 228: - case 151: - case 150: - case 152: - case 155: - case 156: - case 157: - case 153: - case 154: - case 186: - case 187: - case 229: - case 199: - case 230: - case 231: - var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - if (typeParameters) { - for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) { - var d = typeParameters_1[_i]; - if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(d)))) { - return true; - } - } - } - if (ts.isClassLike(node) || node.kind === 230) { - var thisType = getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; - if (thisType && ts.contains(mappedTypes, thisType)) { - return true; - } - } - break; - case 172: - if (ts.contains(mappedTypes, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)))) { - return true; - } - break; - case 279: - var func = node; - for (var _a = 0, _b = func.parameters; _a < _b.length; _a++) { - var p = _b[_a]; - if (ts.contains(mappedTypes, getTypeOfNode(p))) { - return true; - } - } - break; - } - }); - } - function isTopLevelTypeAlias(symbol) { - if (symbol.declarations && symbol.declarations.length) { - var parentKind = symbol.declarations[0].parent.kind; - return parentKind === 265 || parentKind === 234; - } - return false; - } function instantiateType(type, mapper) { if (type && mapper !== identityMapper) { - if (type.aliasSymbol && isTopLevelTypeAlias(type.aliasSymbol)) { - if (type.aliasTypeArguments) { - return getTypeAliasInstantiation(type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); + if (type.flags & 16384) { + return mapper(type); + } + if (type.flags & 32768) { + if (type.objectFlags & 16) { + return type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && type.symbol.declarations ? + getAnonymousTypeInstantiation(type, mapper) : type; + } + if (type.objectFlags & 32) { + return getAnonymousTypeInstantiation(type, mapper); + } + if (type.objectFlags & 4) { + return createTypeReference(type.target, instantiateTypes(type.typeArguments, mapper)); } - return type; } - return instantiateTypeNoAlias(type, mapper); - } - return type; - } - function instantiateTypeNoAlias(type, mapper) { - if (type.flags & 16384) { - return mapper(type); - } - if (type.flags & 32768) { - if (type.objectFlags & 16) { - return type.symbol && - type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && - (type.objectFlags & 64 || isSymbolInScopeOfMappedTypeParameter(type.symbol, mapper)) ? - instantiateCached(type, mapper, instantiateAnonymousType) : type; + if (type.flags & 65536 && !(type.flags & 8190)) { + return getUnionType(instantiateTypes(type.types, mapper), false, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); } - if (type.objectFlags & 32) { - return instantiateCached(type, mapper, instantiateMappedType); + if (type.flags & 131072) { + return getIntersectionType(instantiateTypes(type.types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); } - if (type.objectFlags & 4) { - return createTypeReference(type.target, instantiateTypes(type.typeArguments, mapper)); + if (type.flags & 262144) { + return getIndexType(instantiateType(type.type, mapper)); + } + if (type.flags & 524288) { + return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper)); } - } - if (type.flags & 65536 && !(type.flags & 8190)) { - return getUnionType(instantiateTypes(type.types, mapper), false, type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); - } - if (type.flags & 131072) { - return getIntersectionType(instantiateTypes(type.types, mapper), type.aliasSymbol, instantiateTypes(type.aliasTypeArguments, mapper)); - } - if (type.flags & 262144) { - return getIndexType(instantiateType(type.type, mapper)); - } - if (type.flags & 524288) { - return getIndexedAccessType(instantiateType(type.objectType, mapper), instantiateType(type.indexType, mapper)); } return type; } @@ -31115,11 +27895,13 @@ var ts; if (ts.forEach(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind === 187) { - return false; + if (node.kind !== 187) { + var parameter = ts.firstOrUndefined(node.parameters); + if (!(parameter && ts.parameterIsThisKeyword(parameter))) { + return true; + } } - var parameter = ts.firstOrUndefined(node.parameters); - return !(parameter && ts.parameterIsThisKeyword(parameter)); + return node.body.kind === 207 ? false : isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { return (isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); @@ -31131,8 +27913,8 @@ var ts; var result = createObjectType(16, type.symbol); result.members = resolved.members; result.properties = resolved.properties; - result.callSignatures = emptyArray; - result.constructSignatures = emptyArray; + result.callSignatures = ts.emptyArray; + result.constructSignatures = ts.emptyArray; return result; } } @@ -31181,8 +27963,9 @@ var ts; if (!target.hasRestParameter && source.minArgumentCount > target.parameters.length) { return 0; } - if (source.typeParameters) { - source = instantiateSignatureInContextOf(source, target); + if (source.typeParameters && source.typeParameters !== target.typeParameters) { + target = getCanonicalSignature(target); + source = instantiateSignatureInContextOf(source, target, undefined, compareTypes); } var result = -1; var sourceThisType = getThisTypeOfSignature(source); @@ -31217,7 +28000,7 @@ var ts; !checkAsCallback && compareTypes(sourceType, targetType, false) || compareTypes(targetType, sourceType, reportErrors); if (!related) { if (reportErrors) { - errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, sourceParams[i < sourceMax ? i : sourceMax].name, targetParams[i < targetMax ? i : targetMax].name); + errorReporter(ts.Diagnostics.Types_of_parameters_0_and_1_are_incompatible, ts.unescapeLeadingUnderscores(sourceParams[i < sourceMax ? i : sourceMax].escapedName), ts.unescapeLeadingUnderscores(targetParams[i < targetMax ? i : targetMax].escapedName)); } return 0; } @@ -31231,11 +28014,11 @@ var ts; var sourceReturnType = getReturnTypeOfSignature(source); if (target.typePredicate) { if (source.typePredicate) { - result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, reportErrors, errorReporter, compareTypes); + result &= compareTypePredicateRelatedTo(source.typePredicate, target.typePredicate, source.declaration, target.declaration, reportErrors, errorReporter, compareTypes); } else if (ts.isIdentifierTypePredicate(target.typePredicate)) { if (reportErrors) { - errorReporter(ts.Diagnostics.Signature_0_must_have_a_type_predicate, signatureToString(source)); + errorReporter(ts.Diagnostics.Signature_0_must_be_a_type_predicate, signatureToString(source)); } return 0; } @@ -31247,7 +28030,7 @@ var ts; } return result; } - function compareTypePredicateRelatedTo(source, target, reportErrors, errorReporter, compareTypes) { + function compareTypePredicateRelatedTo(source, target, sourceDeclaration, targetDeclaration, reportErrors, errorReporter, compareTypes) { if (source.kind !== target.kind) { if (reportErrors) { errorReporter(ts.Diagnostics.A_this_based_type_guard_is_not_compatible_with_a_parameter_based_type_guard); @@ -31256,11 +28039,13 @@ var ts; return 0; } if (source.kind === 1) { - var sourceIdentifierPredicate = source; - var targetIdentifierPredicate = target; - if (sourceIdentifierPredicate.parameterIndex !== targetIdentifierPredicate.parameterIndex) { + var sourcePredicate = source; + var targetPredicate = target; + var sourceIndex = sourcePredicate.parameterIndex - (ts.getThisParameter(sourceDeclaration) ? 1 : 0); + var targetIndex = targetPredicate.parameterIndex - (ts.getThisParameter(targetDeclaration) ? 1 : 0); + if (sourceIndex !== targetIndex) { if (reportErrors) { - errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourceIdentifierPredicate.parameterName, targetIdentifierPredicate.parameterName); + errorReporter(ts.Diagnostics.Parameter_0_is_not_in_the_same_position_as_parameter_1, sourcePredicate.parameterName, targetPredicate.parameterName); errorReporter(ts.Diagnostics.Type_predicate_0_is_not_assignable_to_1, typePredicateToString(source), typePredicateToString(target)); } return 0; @@ -31328,7 +28113,7 @@ var ts; if (relation !== undefined) { return relation; } - if (sourceSymbol.name !== targetSymbol.name || !(sourceSymbol.flags & 256) || !(targetSymbol.flags & 256)) { + if (sourceSymbol.escapedName !== targetSymbol.escapedName || !(sourceSymbol.flags & 256) || !(targetSymbol.flags & 256)) { enumRelation.set(id, false); return false; } @@ -31336,10 +28121,10 @@ var ts; for (var _i = 0, _a = getPropertiesOfType(getTypeOfSymbol(sourceSymbol)); _i < _a.length; _i++) { var property = _a[_i]; if (property.flags & 8) { - var targetProperty = getPropertyOfType(targetEnumType, property.name); + var targetProperty = getPropertyOfType(targetEnumType, property.escapedName); if (!targetProperty || !(targetProperty.flags & 8)) { if (errorReporter) { - errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, property.name, typeToString(getDeclaredTypeOfSymbol(targetSymbol), undefined, 256)); + errorReporter(ts.Diagnostics.Property_0_is_missing_in_type_1, ts.unescapeLeadingUnderscores(property.escapedName), typeToString(getDeclaredTypeOfSymbol(targetSymbol), undefined, 256)); } enumRelation.set(id, false); return false; @@ -31405,8 +28190,7 @@ var ts; return true; } if (source.flags & 32768 && target.flags & 32768) { - var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; - var related = relation.get(id); + var related = relation.get(getRelationKey(source, target, relation)); if (related !== undefined) { return related === 1; } @@ -31418,11 +28202,12 @@ var ts; } function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain) { var errorInfo; + var maybeKeys; var sourceStack; var targetStack; - var maybeStack; - var expandingFlags; + var maybeCount = 0; var depth = 0; + var expandingFlags = 0; var overflow = false; var isIntersectionConstituent = false; ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking"); @@ -31518,11 +28303,21 @@ var ts; !(target.flags & 65536) && !isIntersectionConstituent && source !== globalObjectType && - getPropertiesOfType(source).length > 0 && + (getPropertiesOfType(source).length > 0 || + getSignaturesOfType(source, 0).length > 0 || + getSignaturesOfType(source, 1).length > 0) && isWeakType(target) && !hasCommonProperties(source, target)) { if (reportErrors) { - reportError(ts.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, typeToString(source), typeToString(target)); + var calls = getSignaturesOfType(source, 0); + var constructs = getSignaturesOfType(source, 1); + if (calls.length > 0 && isRelatedTo(getReturnTypeOfSignature(calls[0]), target, false) || + constructs.length > 0 && isRelatedTo(getReturnTypeOfSignature(constructs[0]), target, false)) { + reportError(ts.Diagnostics.Value_of_type_0_has_no_properties_in_common_with_type_1_Did_you_mean_to_call_it, typeToString(source), typeToString(target)); + } + else { + reportError(ts.Diagnostics.Type_0_has_no_properties_in_common_with_type_1, typeToString(source), typeToString(target)); + } } return 0; } @@ -31586,8 +28381,8 @@ var ts; (isTypeSubsetOf(globalObjectType, target) || (!isComparingJsxAttributes && isEmptyObjectType(target)))) { return false; } - var _loop_4 = function (prop) { - if (!isKnownProperty(target, prop.name, isComparingJsxAttributes)) { + var _loop_5 = function (prop) { + if (!isKnownProperty(target, prop.escapedName, isComparingJsxAttributes)) { if (reportErrors) { ts.Debug.assert(!!errorNode); if (ts.isJsxAttributes(errorNode) || ts.isJsxOpeningLikeElement(errorNode)) { @@ -31606,7 +28401,7 @@ var ts; }; for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; - var state_2 = _loop_4(prop); + var state_2 = _loop_5(prop); if (typeof state_2 === "object") return state_2.value; } @@ -31649,11 +28444,11 @@ var ts; if (sourceProperties) { for (var _i = 0, sourceProperties_1 = sourceProperties; _i < sourceProperties_1.length; _i++) { var sourceProperty = sourceProperties_1[_i]; - if (isDiscriminantProperty(target, sourceProperty.name)) { + if (isDiscriminantProperty(target, sourceProperty.escapedName)) { var sourceType = getTypeOfSymbol(sourceProperty); for (var _a = 0, _b = target.types; _a < _b.length; _a++) { var type = _b[_a]; - var targetType = getTypeOfPropertyOfType(type, sourceProperty.name); + var targetType = getTypeOfPropertyOfType(type, sourceProperty.escapedName); if (targetType && isRelatedTo(sourceType, targetType)) { return type; } @@ -31703,8 +28498,8 @@ var ts; return result; } function typeArgumentsRelatedTo(source, target, reportErrors) { - var sources = source.typeArguments || emptyArray; - var targets = target.typeArguments || emptyArray; + var sources = source.typeArguments || ts.emptyArray; + var targets = target.typeArguments || ts.emptyArray; if (sources.length !== targets.length && relation === identityRelation) { return 0; } @@ -31723,7 +28518,7 @@ var ts; if (overflow) { return 0; } - var id = relation !== identityRelation || source.id < target.id ? source.id + "," + target.id : target.id + "," + source.id; + var id = getRelationKey(source, target, relation); var related = relation.get(id); if (related !== undefined) { if (reportErrors && related === 2) { @@ -31733,9 +28528,14 @@ var ts; return related === 1 ? -1 : 0; } } - if (depth > 0) { - for (var i = 0; i < depth; i++) { - if (maybeStack[i].get(id)) { + if (!maybeKeys) { + maybeKeys = []; + sourceStack = []; + targetStack = []; + } + else { + for (var i = 0; i < maybeCount; i++) { + if (id === maybeKeys[i]) { return 1; } } @@ -31744,16 +28544,11 @@ var ts; return 0; } } - else { - sourceStack = []; - targetStack = []; - maybeStack = []; - expandingFlags = 0; - } + var maybeStart = maybeCount; + maybeKeys[maybeCount] = id; + maybeCount++; sourceStack[depth] = source; targetStack[depth] = target; - maybeStack[depth] = ts.createMap(); - maybeStack[depth].set(id, 1); depth++; var saveExpandingFlags = expandingFlags; if (!(expandingFlags & 1) && isDeeplyNestedType(source, sourceStack, depth)) @@ -31764,12 +28559,16 @@ var ts; expandingFlags = saveExpandingFlags; depth--; if (result) { - var maybeCache = maybeStack[depth]; - var destinationCache = (result === -1 || depth === 0) ? relation : maybeStack[depth - 1]; - ts.copyEntries(maybeCache, destinationCache); + if (result === -1 || depth === 0) { + for (var i = maybeStart; i < maybeCount; i++) { + relation.set(maybeKeys[i], 1); + } + maybeCount = maybeStart; + } } else { relation.set(id, reportErrors ? 3 : 2); + maybeCount = maybeStart; } return result; } @@ -31859,8 +28658,11 @@ var ts; } if (source.flags & (32768 | 131072) && target.flags & 32768) { var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive; - if (isGenericMappedType(source) || isGenericMappedType(target)) { - result = mappedTypeRelatedTo(source, target, reportStructuralErrors); + if (isPartialMappedType(target) && !isGenericMappedType(source) && isEmptyObjectType(source)) { + result = -1; + } + else if (isGenericMappedType(target)) { + result = isGenericMappedType(source) ? mappedTypeRelatedTo(source, target, reportStructuralErrors) : 0; } else { result = propertiesRelatedTo(source, target, reportStructuralErrors); @@ -31886,31 +28688,18 @@ var ts; return 0; } function mappedTypeRelatedTo(source, target, reportErrors) { - if (isGenericMappedType(target)) { - if (isGenericMappedType(source)) { - var sourceReadonly = !!source.declaration.readonlyToken; - var sourceOptional = !!source.declaration.questionToken; - var targetReadonly = !!target.declaration.readonlyToken; - var targetOptional = !!target.declaration.questionToken; - var modifiersRelated = relation === identityRelation ? - sourceReadonly === targetReadonly && sourceOptional === targetOptional : - relation === comparableRelation || !sourceOptional || targetOptional; - if (modifiersRelated) { - var result_2; - if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { - var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); - return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); - } - } - } - else if (target.declaration.questionToken && isEmptyObjectType(source)) { - return -1; - } - } - else if (relation !== identityRelation) { - var resolved = resolveStructuredTypeMembers(target); - if (isEmptyResolvedType(resolved) || resolved.stringIndexInfo && resolved.stringIndexInfo.type.flags & 1) { - return -1; + var sourceReadonly = !!source.declaration.readonlyToken; + var sourceOptional = !!source.declaration.questionToken; + var targetReadonly = !!target.declaration.readonlyToken; + var targetOptional = !!target.declaration.questionToken; + var modifiersRelated = relation === identityRelation ? + sourceReadonly === targetReadonly && sourceOptional === targetOptional : + relation === comparableRelation || !sourceOptional || targetOptional; + if (modifiersRelated) { + var result_2; + if (result_2 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) { + var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]); + return result_2 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors); } } return 0; @@ -31922,19 +28711,19 @@ var ts; var result = -1; var properties = getPropertiesOfObjectType(target); var requireOptionalProperties = relation === subtypeRelation && !(getObjectFlags(source) & 128); - for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { - var targetProp = properties_4[_i]; - var sourceProp = getPropertyOfType(source, targetProp.name); + for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) { + var targetProp = properties_3[_i]; + var sourceProp = getPropertyOfType(source, targetProp.escapedName); if (sourceProp !== targetProp) { if (!sourceProp) { - if (!(targetProp.flags & 67108864) || requireOptionalProperties) { + if (!(targetProp.flags & 16777216) || requireOptionalProperties) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_missing_in_type_1, symbolToString(targetProp), typeToString(source)); } return 0; } } - else if (!(targetProp.flags & 16777216)) { + else if (!(targetProp.flags & 4194304)) { var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp); var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp); if (sourcePropFlags & 8 || targetPropFlags & 8) { @@ -31978,7 +28767,7 @@ var ts; return 0; } result &= related; - if (relation !== comparableRelation && sourceProp.flags & 67108864 && !(targetProp.flags & 67108864)) { + if (relation !== comparableRelation && sourceProp.flags & 16777216 && !(targetProp.flags & 16777216)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -31995,7 +28784,7 @@ var ts; return resolved.callSignatures.length === 0 && resolved.constructSignatures.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo && resolved.properties.length > 0 && - ts.every(resolved.properties, function (p) { return !!(p.flags & 67108864); }); + ts.every(resolved.properties, function (p) { return !!(p.flags & 16777216); }); } if (type.flags & 131072) { return ts.every(type.types, isWeakType); @@ -32006,7 +28795,7 @@ var ts; var isComparingJsxAttributes = !!(source.flags & 33554432); for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) { var prop = _a[_i]; - if (isKnownProperty(target, prop.name, isComparingJsxAttributes)) { + if (isKnownProperty(target, prop.escapedName, isComparingJsxAttributes)) { return true; } } @@ -32024,7 +28813,7 @@ var ts; var result = -1; for (var _i = 0, sourceProperties_2 = sourceProperties; _i < sourceProperties_2.length; _i++) { var sourceProp = sourceProperties_2[_i]; - var targetProp = getPropertyOfObjectType(target, sourceProp.name); + var targetProp = getPropertyOfObjectType(target, sourceProp.escapedName); if (!targetProp) { return 0; } @@ -32116,7 +28905,7 @@ var ts; var result = -1; for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) { var prop = _a[_i]; - if (kind === 0 || isNumericLiteralName(prop.name)) { + if (kind === 0 || isNumericLiteralName(prop.escapedName)) { var related = isRelatedTo(getTypeOfSymbol(prop), target, reportErrors); if (!related) { if (reportErrors) { @@ -32149,6 +28938,9 @@ var ts; if (sourceInfo) { return indexInfoRelatedTo(sourceInfo, targetInfo, reportErrors); } + if (isGenericMappedType(source)) { + return kind === 0 && isRelatedTo(getTemplateTypeFromMappedType(source), targetInfo.type, reportErrors); + } if (isObjectLiteralType(source)) { var related = -1; if (kind === 0) { @@ -32182,8 +28974,8 @@ var ts; if (!sourceSignature.declaration || !targetSignature.declaration) { return true; } - var sourceAccessibility = ts.getModifierFlags(sourceSignature.declaration) & 24; - var targetAccessibility = ts.getModifierFlags(targetSignature.declaration) & 24; + var sourceAccessibility = ts.getSelectedModifierFlags(sourceSignature.declaration, 24); + var targetAccessibility = ts.getSelectedModifierFlags(targetSignature.declaration, 24); if (targetAccessibility === 8) { return true; } @@ -32199,11 +28991,47 @@ var ts; return false; } } + function isUnconstrainedTypeParameter(type) { + return type.flags & 16384 && !getConstraintFromTypeParameter(type); + } + function isTypeReferenceWithGenericArguments(type) { + return getObjectFlags(type) & 4 && ts.some(type.typeArguments, isUnconstrainedTypeParameter); + } + function getTypeReferenceId(type, typeParameters) { + var result = "" + type.target.id; + for (var _i = 0, _a = type.typeArguments; _i < _a.length; _i++) { + var t = _a[_i]; + if (isUnconstrainedTypeParameter(t)) { + var index = ts.indexOf(typeParameters, t); + if (index < 0) { + index = typeParameters.length; + typeParameters.push(t); + } + result += "=" + index; + } + else { + result += "-" + t.id; + } + } + return result; + } + function getRelationKey(source, target, relation) { + if (relation === identityRelation && source.id > target.id) { + var temp = source; + source = target; + target = temp; + } + if (isTypeReferenceWithGenericArguments(source) && isTypeReferenceWithGenericArguments(target)) { + var typeParameters = []; + return getTypeReferenceId(source, typeParameters) + "," + getTypeReferenceId(target, typeParameters); + } + return source.id + "," + target.id; + } function forEachProperty(prop, callback) { if (ts.getCheckFlags(prop) & 6) { for (var _i = 0, _a = prop.containingType.types; _i < _a.length; _i++) { var t = _a[_i]; - var p = getPropertyOfType(t, prop.name); + var p = getPropertyOfType(t, prop.escapedName); var result = p && forEachProperty(p, callback); if (result) { return result; @@ -32235,7 +29063,7 @@ var ts; var symbol = type.symbol; if (symbol && symbol.flags & 32) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - if (declaration && ts.getModifierFlags(declaration) & 128) { + if (declaration && ts.hasModifier(declaration, 128)) { return true; } } @@ -32277,7 +29105,7 @@ var ts; } } else { - if ((sourceProp.flags & 67108864) !== (targetProp.flags & 67108864)) { + if ((sourceProp.flags & 16777216) !== (targetProp.flags & 16777216)) { return 0; } } @@ -32457,7 +29285,7 @@ var ts; getSignaturesOfType(type, 1).length === 0; } function createSymbolWithType(source, type) { - var symbol = createSymbol(source.flags, source.name); + var symbol = createSymbol(source.flags, source.escapedName); symbol.declarations = source.declarations; symbol.parent = source.parent; symbol.type = type; @@ -32468,12 +29296,12 @@ var ts; return symbol; } function transformTypeOfMembers(type, f) { - var members = ts.createMap(); + var members = ts.createSymbolTable(); for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { var property = _a[_i]; var original = getTypeOfSymbol(property); var updated = f(original); - members.set(property.name, updated === original ? property : createSymbolWithType(property, updated)); + members.set(property.escapedName, updated === original ? property : createSymbolWithType(property, updated)); } return members; } @@ -32499,14 +29327,14 @@ var ts; return widened === original ? prop : createSymbolWithType(prop, widened); } function getWidenedTypeOfObjectLiteral(type) { - var members = ts.createMap(); + var members = ts.createSymbolTable(); for (var _i = 0, _a = getPropertiesOfObjectType(type); _i < _a.length; _i++) { var prop = _a[_i]; - members.set(prop.name, prop.flags & 4 ? getWidenedProperty(prop) : prop); + members.set(prop.escapedName, prop.flags & 4 ? getWidenedProperty(prop) : prop); } var stringIndexInfo = getIndexInfoOfType(type, 0); var numberIndexInfo = getIndexInfoOfType(type, 1); - return createAnonymousType(type.symbol, members, emptyArray, emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); + return createAnonymousType(type.symbol, members, ts.emptyArray, ts.emptyArray, stringIndexInfo && createIndexInfo(getWidenedType(stringIndexInfo.type), stringIndexInfo.isReadonly), numberIndexInfo && createIndexInfo(getWidenedType(numberIndexInfo.type), numberIndexInfo.isReadonly)); } function getWidenedConstituentType(type) { return type.flags & 6144 ? type : getWidenedType(type); @@ -32552,7 +29380,7 @@ var ts; var t = getTypeOfSymbol(p); if (t.flags & 2097152) { if (!reportWideningErrorsInType(t)) { - error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, p.name, typeToString(getWidenedType(t))); + error(p.valueDeclaration, ts.Diagnostics.Object_literal_s_property_0_implicitly_has_an_1_type, ts.unescapeLeadingUnderscores(p.escapedName), typeToString(getWidenedType(t))); } errorReported = true; } @@ -32621,13 +29449,13 @@ var ts; callback(getTypeAtPosition(source, i), getTypeAtPosition(target, i)); } } - function createInferenceContext(signature, flags, baseInferences) { + function createInferenceContext(signature, flags, compareTypes, baseInferences) { var inferences = baseInferences ? ts.map(baseInferences, cloneInferenceInfo) : ts.map(signature.typeParameters, createInferenceInfo); var context = mapper; - context.mappedTypes = signature.typeParameters; context.signature = signature; context.inferences = inferences; context.flags = flags; + context.compareTypes = compareTypes || compareTypesAssignable; return context; function mapper(t) { for (var i = 0; i < inferences.length; i++) { @@ -32687,19 +29515,19 @@ var ts; var inferences = [inference]; var templateType = getTemplateTypeFromMappedType(target); var readonlyMask = target.declaration.readonlyToken ? false : true; - var optionalMask = target.declaration.questionToken ? 0 : 67108864; - var members = ts.createMap(); - for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { - var prop = properties_5[_i]; + var optionalMask = target.declaration.questionToken ? 0 : 16777216; + var members = ts.createSymbolTable(); + for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) { + var prop = properties_4[_i]; var inferredPropType = inferTargetType(getTypeOfSymbol(prop)); if (!inferredPropType) { return undefined; } - var inferredProp = createSymbol(4 | prop.flags & optionalMask, prop.name); + var inferredProp = createSymbol(4 | prop.flags & optionalMask, prop.escapedName); inferredProp.checkFlags = readonlyMask && isReadonlySymbol(prop) ? 8 : 0; inferredProp.declarations = prop.declarations; inferredProp.type = inferredPropType; - members.set(prop.name, inferredProp); + members.set(prop.escapedName, inferredProp); } if (indexInfo) { var inferredIndexType = inferTargetType(indexInfo.type); @@ -32708,13 +29536,26 @@ var ts; } indexInfo = createIndexInfo(inferredIndexType, readonlyMask && indexInfo.isReadonly); } - return createAnonymousType(undefined, members, emptyArray, emptyArray, indexInfo, undefined); + return createAnonymousType(undefined, members, ts.emptyArray, ts.emptyArray, indexInfo, undefined); function inferTargetType(sourceType) { inference.candidates = undefined; inferTypes(inferences, sourceType, templateType); return inference.candidates && getUnionType(inference.candidates, true); } } + function isPossiblyAssignableTo(source, target) { + var properties = getPropertiesOfObjectType(target); + for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) { + var targetProp = properties_5[_i]; + if (!(targetProp.flags & (16777216 | 4194304))) { + var sourceProp = getPropertyOfObjectType(source, targetProp.escapedName); + if (!sourceProp) { + return false; + } + } + } + return true; + } function inferTypes(inferences, originalSource, originalTarget, priority) { if (priority === void 0) { priority = 0; } var symbolStack; @@ -32782,8 +29623,8 @@ var ts; } } else if (getObjectFlags(source) & 4 && getObjectFlags(target) & 4 && source.target === target.target) { - var sourceTypes = source.typeArguments || emptyArray; - var targetTypes = target.typeArguments || emptyArray; + var sourceTypes = source.typeArguments || ts.emptyArray; + var targetTypes = target.typeArguments || ts.emptyArray; var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length; for (var i = 0; i < count; i++) { inferFromTypes(sourceTypes[i], targetTypes[i]); @@ -32875,16 +29716,18 @@ var ts; return; } } - inferFromProperties(source, target); - inferFromSignatures(source, target, 0); - inferFromSignatures(source, target, 1); - inferFromIndexTypes(source, target); + if (isPossiblyAssignableTo(source, target) || isPossiblyAssignableTo(target, source)) { + inferFromProperties(source, target); + inferFromSignatures(source, target, 0); + inferFromSignatures(source, target, 1); + inferFromIndexTypes(source, target); + } } function inferFromProperties(source, target) { var properties = getPropertiesOfObjectType(target); for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) { var targetProp = properties_6[_i]; - var sourceProp = getPropertyOfObjectType(source, targetProp.name); + var sourceProp = getPropertyOfObjectType(source, targetProp.escapedName); if (sourceProp) { inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp)); } @@ -32900,11 +29743,8 @@ var ts; inferFromSignature(getErasedSignature(sourceSignatures[sourceLen - len + i]), getErasedSignature(targetSignatures[targetLen - len + i])); } } - function inferFromParameterTypes(source, target) { - return inferFromTypes(source, target); - } function inferFromSignature(source, target) { - forEachMatchingParameterType(source, target, inferFromParameterTypes); + forEachMatchingParameterType(source, target, inferFromTypes); if (source.typePredicate && target.typePredicate && source.typePredicate.kind === target.typePredicate.kind) { inferFromTypes(source.typePredicate.type, target.typePredicate.type); } @@ -32978,20 +29818,23 @@ var ts; inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context.signature.typeParameters, index), context)); } else { - inferredType = context.flags & 4 ? anyType : emptyObjectType; + inferredType = getDefaultTypeArgumentType(!!(context.flags & 4)); } } inference.inferredType = inferredType; var constraint = getConstraintOfTypeParameter(context.signature.typeParameters[index]); if (constraint) { var instantiatedConstraint = instantiateType(constraint, context); - if (!isTypeAssignableTo(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { + if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) { inference.inferredType = inferredType = instantiatedConstraint; } } } return inferredType; } + function getDefaultTypeArgumentType(isInJavaScriptFile) { + return isInJavaScriptFile ? anyType : emptyObjectType; + } function getInferredTypes(context) { var result = []; for (var i = 0; i < context.inferences.length; i++) { @@ -33002,7 +29845,7 @@ var ts; function getResolvedSymbol(node) { var links = getNodeLinks(node); if (!links.resolvedSymbol) { - links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.text, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol; + links.resolvedSymbol = !ts.nodeIsMissing(node) && resolveName(node, node.escapedText, 107455 | 1048576, ts.Diagnostics.Cannot_find_name_0, node, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol; } return links.resolvedSymbol; } @@ -33019,19 +29862,35 @@ var ts; } if (node.kind === 179) { var key = getFlowCacheKey(node.expression); - return key && key + "." + node.name.text; + return key && key + "." + ts.unescapeLeadingUnderscores(node.name.escapedText); + } + if (node.kind === 176) { + var container = node.parent.parent; + var key = container.kind === 176 ? getFlowCacheKey(container) : (container.initializer && getFlowCacheKey(container.initializer)); + var text = getBindingElementNameText(node); + var result = key && text && (key + "." + text); + return result; } return undefined; } - function getLeftmostIdentifierOrThis(node) { - switch (node.kind) { - case 71: - case 99: - return node; - case 179: - return getLeftmostIdentifierOrThis(node.expression); + function getBindingElementNameText(element) { + if (element.parent.kind === 174) { + var name = element.propertyName || element.name; + switch (name.kind) { + case 71: + return ts.unescapeLeadingUnderscores(name.escapedText); + case 144: + return ts.isStringOrNumericLiteral(name.expression) ? name.expression.text : undefined; + case 9: + case 8: + return name.text; + default: + ts.Debug.fail("Unexpected name kind for binding element name"); + } + } + else { + return "" + element.parent.elements.indexOf(element); } - return undefined; } function isMatchingReference(source, target) { switch (source.kind) { @@ -33045,8 +29904,21 @@ var ts; return target.kind === 97; case 179: return target.kind === 179 && - source.name.text === target.name.text && + source.name.escapedText === target.name.escapedText && isMatchingReference(source.expression, target.expression); + case 176: + if (target.kind !== 179) + return false; + var t = target; + if (t.name.escapedText !== getBindingElementNameText(source)) + return false; + if (source.parent.parent.kind === 176 && isMatchingReference(source.parent.parent, t.expression)) { + return true; + } + if (source.parent.parent.kind === 226) { + var maybeId = source.parent.parent.initializer; + return maybeId && isMatchingReference(maybeId, t.expression); + } } return false; } @@ -33062,7 +29934,7 @@ var ts; function containsMatchingReferenceDiscriminant(source, target) { return target.kind === 179 && containsMatchingReference(source, target.expression) && - isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.text); + isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), target.name.escapedText); } function getDeclaredTypeOfReference(expr) { if (expr.kind === 71) { @@ -33070,7 +29942,7 @@ var ts; } if (expr.kind === 179) { var type = getDeclaredTypeOfReference(expr.expression); - return type && getTypeOfPropertyOfType(type, expr.name.text); + return type && getTypeOfPropertyOfType(type, expr.name.escapedText); } return undefined; } @@ -33344,8 +30216,15 @@ var ts; function getSwitchClauseTypes(switchStatement) { var links = getNodeLinks(switchStatement); if (!links.switchTypes) { - var types = ts.map(switchStatement.caseBlock.clauses, getTypeOfSwitchClause); - links.switchTypes = !ts.contains(types, undefined) ? types : emptyArray; + links.switchTypes = []; + for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { + var clause = _a[_i]; + var type = getTypeOfSwitchClause(clause); + if (type === undefined) { + return links.switchTypes = ts.emptyArray; + } + links.switchTypes.push(type); + } } return links.switchTypes; } @@ -33477,7 +30356,7 @@ var ts; function isEvolvingArrayOperationTarget(node) { var root = getReferenceRoot(node); var parent = root.parent; - var isLengthPushOrUnshift = parent.kind === 179 && (parent.name.text === "length" || + var isLengthPushOrUnshift = parent.kind === 179 && (parent.name.escapedText === "length" || parent.parent.kind === 181 && ts.isPushOrUnshiftIdentifier(parent.name)); var isElementAssignment = parent.kind === 180 && parent.expression === root && @@ -33485,7 +30364,7 @@ var ts; parent.parent.operatorToken.kind === 58 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && - isTypeAnyOrAllConstituentTypesHaveKind(getTypeOfExpression(parent.argumentExpression), 84 | 2048); + isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 84); return isLengthPushOrUnshift || isElementAssignment; } function maybeTypePredicateCall(node) { @@ -33631,7 +30510,7 @@ var ts; } else { var indexType = getTypeOfExpression(node.left.argumentExpression); - if (isTypeAnyOrAllConstituentTypesHaveKind(indexType, 84 | 2048)) { + if (isTypeAssignableToKind(indexType, 84)) { evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, node.right); } } @@ -33664,7 +30543,7 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (isMatchingReferenceDiscriminant(expr)) { + else if (isMatchingReferenceDiscriminant(expr, type)) { type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd); }); } return createFlowType(type, isIncomplete(flowType)); @@ -33700,6 +30579,9 @@ var ts; var cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap()); if (!key) { key = getFlowCacheKey(reference); + if (!key) { + return declaredType; + } } var cached = cache.get(key); if (cached) { @@ -33746,14 +30628,14 @@ var ts; cache.set(key, result); return result; } - function isMatchingReferenceDiscriminant(expr) { + function isMatchingReferenceDiscriminant(expr, computedType) { return expr.kind === 179 && - declaredType.flags & 65536 && + computedType.flags & 65536 && isMatchingReference(reference, expr.expression) && - isDiscriminantProperty(declaredType, expr.name.text); + isDiscriminantProperty(computedType, expr.name.escapedText); } function narrowTypeByDiscriminant(type, propAccess, narrowType) { - var propName = propAccess.name.text; + var propName = propAccess.name.escapedText; var propType = getTypeOfPropertyOfType(type, propName); var narrowedPropType = propType && narrowType(propType); return propType === narrowedPropType ? type : filterType(type, function (t) { return isTypeComparableTo(getTypeOfPropertyOfType(t, propName), narrowedPropType); }); @@ -33762,7 +30644,7 @@ var ts; if (isMatchingReference(reference, expr)) { return getTypeWithFacts(type, assumeTrue ? 1048576 : 2097152); } - if (isMatchingReferenceDiscriminant(expr)) { + if (isMatchingReferenceDiscriminant(expr, declaredType)) { return narrowTypeByDiscriminant(type, expr, function (t) { return getTypeWithFacts(t, assumeTrue ? 1048576 : 2097152); }); } if (containsMatchingReferenceDiscriminant(reference, expr)) { @@ -33793,10 +30675,10 @@ var ts; if (isMatchingReference(reference, right_1)) { return narrowTypeByEquality(type, operator_1, left_1, assumeTrue); } - if (isMatchingReferenceDiscriminant(left_1)) { + if (isMatchingReferenceDiscriminant(left_1, declaredType)) { return narrowTypeByDiscriminant(type, left_1, function (t) { return narrowTypeByEquality(t, operator_1, right_1, assumeTrue); }); } - if (isMatchingReferenceDiscriminant(right_1)) { + if (isMatchingReferenceDiscriminant(right_1, declaredType)) { return narrowTypeByDiscriminant(type, right_1, function (t) { return narrowTypeByEquality(t, operator_1, left_1, assumeTrue); }); } if (containsMatchingReferenceDiscriminant(reference, left_1) || containsMatchingReferenceDiscriminant(reference, right_1)) { @@ -34005,6 +30887,7 @@ var ts; } } function getTypeOfSymbolAtLocation(symbol, location) { + symbol = symbol.exportSymbol || symbol; if (location.kind === 71) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) { location = location.parent; @@ -34102,26 +30985,26 @@ var ts; markAliasSymbolAsReferenced(symbol); } var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol); + var declaration = localOrExportSymbol.valueDeclaration; if (localOrExportSymbol.flags & 32) { - var declaration_1 = localOrExportSymbol.valueDeclaration; - if (declaration_1.kind === 229 - && ts.nodeIsDecorated(declaration_1)) { + if (declaration.kind === 229 + && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { - if (container === declaration_1 && container.name !== node) { - getNodeLinks(declaration_1).flags |= 8388608; + if (container === declaration && container.name !== node) { + getNodeLinks(declaration).flags |= 8388608; getNodeLinks(node).flags |= 16777216; break; } container = ts.getContainingClass(container); } } - else if (declaration_1.kind === 199) { + else if (declaration.kind === 199) { var container = ts.getThisContainer(node, false); while (container !== undefined) { - if (container.parent === declaration_1) { + if (container.parent === declaration) { if (container.kind === 149 && ts.hasModifier(container, 32)) { - getNodeLinks(declaration_1).flags |= 8388608; + getNodeLinks(declaration).flags |= 8388608; getNodeLinks(node).flags |= 16777216; } break; @@ -34135,7 +31018,6 @@ var ts; checkCollisionWithCapturedNewTargetVariable(node, node); checkNestedBlockScopedBinding(node, symbol); var type = getDeclaredOrApparentType(localOrExportSymbol, node); - var declaration = localOrExportSymbol.valueDeclaration; var assignmentKind = ts.getAssignmentTargetKind(node); if (assignmentKind) { if (!(localOrExportSymbol.flags & 3)) { @@ -34147,7 +31029,19 @@ var ts; return unknownType; } } - if (!(localOrExportSymbol.flags & 3) || assignmentKind === 1 || !declaration) { + var isAlias = localOrExportSymbol.flags & 2097152; + if (localOrExportSymbol.flags & 3) { + if (assignmentKind === 1) { + return type; + } + } + else if (isAlias) { + declaration = ts.find(symbol.declarations, isSomeImportDeclaration); + } + else { + return type; + } + if (!declaration) { return type; } var isParameter = ts.getRootDeclaration(declaration).kind === 146; @@ -34159,7 +31053,7 @@ var ts; (isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } - var assumeInitialized = isParameter || isOuterVariable || + var assumeInitialized = isParameter || isAlias || isOuterVariable || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 1) !== 0 || isInTypeQuery(node) || node.parent.kind === 246) || node.parent.kind === 203 || ts.isInAmbientContext(declaration); @@ -34302,7 +31196,7 @@ var ts; break; case 149: case 148: - if (ts.getModifierFlags(container) & 32) { + if (ts.hasModifier(container, 32)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer); } break; @@ -34350,9 +31244,11 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 279) { + if (jsdocType && jsdocType.kind === 273) { var jsDocFunctionType = jsdocType; - if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].type.kind === 282) { + if (jsDocFunctionType.parameters.length > 0 && + jsDocFunctionType.parameters[0].name && + jsDocFunctionType.parameters[0].name.escapedText === "this") { return getTypeFromTypeNode(jsDocFunctionType.parameters[0].type); } } @@ -34391,14 +31287,14 @@ var ts; if (!isCallExpression && container.kind === 152) { 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) { + if (ts.hasModifier(container, 32) || isCallExpression) { nodeCheckFlag = 512; } else { nodeCheckFlag = 256; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 151 && ts.getModifierFlags(container) & 256) { + if (container.kind === 151 && ts.hasModifier(container, 256)) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096; } @@ -34443,7 +31339,7 @@ var ts; } else { if (ts.isClassLike(container.parent) || container.parent.kind === 178) { - if (ts.getModifierFlags(container) & 32) { + if (ts.hasModifier(container, 32)) { return container.kind === 151 || container.kind === 150 || container.kind === 153 || @@ -34491,7 +31387,7 @@ var ts; } } } - if (noImplicitThis) { + if (noImplicitThis || ts.isInJavaScriptFile(func)) { var containingLiteral = getContainingObjectLiteral(func); if (containingLiteral) { var contextualType = getApparentTypeOfContextualType(containingLiteral); @@ -34565,12 +31461,6 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (ts.isInJavaScriptFile(declaration)) { - var jsDocType = getTypeForDeclarationFromJSDocComment(declaration); - if (jsDocType) { - return jsDocType; - } - } if (declaration.kind === 146) { var type = getContextuallyTypedParameterType(declaration); if (type) { @@ -34639,7 +31529,7 @@ var ts; return getReturnTypeOfSignature(getSignatureFromDeclaration(functionDecl)); } var signature = getContextualSignatureForFunctionLikeDeclaration(functionDecl); - if (signature) { + if (signature && !isResolvingReturnTypeOfSignature(signature)) { return getReturnTypeOfSignature(signature); } return undefined; @@ -34648,7 +31538,7 @@ var ts; var args = getEffectiveCallArguments(callTarget); var argIndex = ts.indexOf(args, arg); if (argIndex >= 0) { - var signature = getResolvedOrAnySignature(callTarget); + var signature = getNodeLinks(callTarget).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(callTarget); return getTypeAtPosition(signature, argIndex); } return undefined; @@ -34708,7 +31598,7 @@ var ts; var type = getApparentTypeOfContextualType(objectLiteral); if (type) { if (!ts.hasDynamicName(element)) { - var symbolName = getSymbolOfNode(element).name; + var symbolName = getSymbolOfNode(element).escapedName; var propertyType = getTypeOfPropertyOfContextualType(type, symbolName); if (propertyType) { return propertyType; @@ -34743,7 +31633,7 @@ var ts; return undefined; } if (ts.isJsxAttribute(node.parent)) { - return getTypeOfPropertyOfType(attributesType, node.parent.name.text); + return getTypeOfPropertyOfType(attributesType, node.parent.name.escapedText); } else if (node.parent.kind === 249) { var jsxChildrenPropertyName = getJsxElementChildrenPropertyname(); @@ -34759,7 +31649,7 @@ var ts; if (!attributesType || isTypeAny(attributesType)) { return undefined; } - return getTypeOfPropertyOfType(attributesType, attribute.name.text); + return getTypeOfPropertyOfType(attributesType, attribute.name.escapedText); } else { return attributesType; @@ -34962,13 +31852,20 @@ var ts; strictNullChecks ? neverType : undefinedWideningType); } function isNumericName(name) { - return name.kind === 144 ? isNumericComputedName(name) : isNumericLiteralName(name.text); + switch (name.kind) { + case 144: + return isNumericComputedName(name); + case 71: + return isNumericLiteralName(name.escapedText); + case 8: + case 9: + return isNumericLiteralName(name.text); + default: + return false; + } } function isNumericComputedName(name) { - return isTypeAnyOrAllConstituentTypesHaveKind(checkComputedPropertyName(name), 84); - } - function isTypeAnyOrAllConstituentTypesHaveKind(type, kind) { - return isTypeAny(type) || isTypeOfKind(type, kind); + return isTypeAssignableToKind(checkComputedPropertyName(name), 84); } function isInfinityOrNaNString(name) { return name === "Infinity" || name === "-Infinity" || name === "NaN"; @@ -34980,7 +31877,9 @@ var ts; var links = getNodeLinks(node.expression); if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - if (!isTypeAnyOrAllConstituentTypesHaveKind(links.resolvedType, 84 | 262178 | 512)) { + if (links.resolvedType.flags & 6144 || + !isTypeAssignableToKind(links.resolvedType, 262178 | 84 | 512) && + !isTypeAssignableTo(links.resolvedType, getUnionType([stringType, numberType, esSymbolType]))) { error(node, ts.Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else { @@ -35002,7 +31901,7 @@ var ts; function checkObjectLiteral(node, checkMode) { var inDestructuringPattern = ts.isAssignmentTarget(node); checkGrammarObjectLiteralExpression(node, inDestructuringPattern); - var propertiesTable = ts.createMap(); + var propertiesTable = ts.createSymbolTable(); var propertiesArray = []; var spread = emptyObjectType; var propagatedFlags = 0; @@ -35014,6 +31913,7 @@ var ts; var patternWithComputedProperties = false; var hasComputedStringProperty = false; var hasComputedNumberProperty = false; + var isInJSFile = ts.isInJavaScriptFile(node); var offset = 0; for (var i = 0; i < node.properties.length; i++) { var memberDecl = node.properties[i]; @@ -35021,6 +31921,10 @@ var ts; if (memberDecl.kind === 261 || memberDecl.kind === 262 || ts.isObjectLiteralMethod(memberDecl)) { + var jsdocType = void 0; + if (isInJSFile) { + jsdocType = getTypeForDeclarationFromJSDocComment(memberDecl); + } var type = void 0; if (memberDecl.kind === 261) { type = checkPropertyAssignment(memberDecl, checkMode); @@ -35032,22 +31936,26 @@ var ts; ts.Debug.assert(memberDecl.kind === 262); type = checkExpressionForMutableLocation(memberDecl.name, checkMode); } + if (jsdocType) { + checkTypeAssignableTo(type, jsdocType, memberDecl); + type = jsdocType; + } typeFlags |= type.flags; - var prop = createSymbol(4 | member.flags, member.name); + var prop = createSymbol(4 | member.flags, member.escapedName); if (inDestructuringPattern) { var isOptional = (memberDecl.kind === 261 && hasDefaultValue(memberDecl.initializer)) || (memberDecl.kind === 262 && memberDecl.objectAssignmentInitializer); if (isOptional) { - prop.flags |= 67108864; + prop.flags |= 16777216; } if (ts.hasDynamicName(memberDecl)) { patternWithComputedProperties = true; } } else if (contextualTypeHasPattern && !(getObjectFlags(contextualType) & 512)) { - var impliedProp = getPropertyOfType(contextualType, member.name); + var impliedProp = getPropertyOfType(contextualType, member.escapedName); if (impliedProp) { - prop.flags |= impliedProp.flags & 67108864; + prop.flags |= impliedProp.flags & 16777216; } else if (!compilerOptions.suppressExcessPropertyErrors && !getIndexInfoOfType(contextualType, 0)) { error(memberDecl.name, ts.Diagnostics.Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1, symbolToString(member), typeToString(contextualType)); @@ -35069,7 +31977,7 @@ var ts; if (propertiesArray.length > 0) { spread = getSpreadType(spread, createObjectLiteralType()); propertiesArray = []; - propertiesTable = ts.createMap(); + propertiesTable = ts.createSymbolTable(); hasComputedStringProperty = false; hasComputedNumberProperty = false; typeFlags = 0; @@ -35096,18 +32004,18 @@ var ts; } } else { - propertiesTable.set(member.name, member); + propertiesTable.set(member.escapedName, member); } propertiesArray.push(member); } if (contextualTypeHasPattern) { for (var _i = 0, _a = getPropertiesOfType(contextualType); _i < _a.length; _i++) { var prop = _a[_i]; - if (!propertiesTable.get(prop.name)) { - if (!(prop.flags & 67108864)) { + if (!propertiesTable.get(prop.escapedName)) { + if (!(prop.flags & 16777216)) { error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); } - propertiesTable.set(prop.name, prop); + propertiesTable.set(prop.escapedName, prop); propertiesArray.push(prop); } } @@ -35128,7 +32036,7 @@ var ts; function createObjectLiteralType() { var stringIndexInfo = isJSObjectLiteral ? jsObjectLiteralIndexInfo : hasComputedStringProperty ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 0) : undefined; var numberIndexInfo = hasComputedNumberProperty && !isJSObjectLiteral ? getObjectLiteralIndexInfo(node.properties, offset, propertiesArray, 1) : undefined; - var result = createAnonymousType(node.symbol, propertiesTable, emptyArray, emptyArray, stringIndexInfo, numberIndexInfo); + var result = createAnonymousType(node.symbol, propertiesTable, ts.emptyArray, ts.emptyArray, stringIndexInfo, numberIndexInfo); var freshObjectLiteralFlag = compilerOptions.suppressExcessPropertyErrors ? 0 : 1048576; result.flags |= 4194304 | freshObjectLiteralFlag | (typeFlags & 14680064); result.objectFlags |= 128; @@ -35167,16 +32075,19 @@ var ts; return name.indexOf("-") < 0; } function isJsxIntrinsicIdentifier(tagName) { - if (tagName.kind === 179 || tagName.kind === 99) { - return false; - } - else { - return ts.isIntrinsicJsxName(tagName.text); + switch (tagName.kind) { + case 179: + case 99: + return false; + case 71: + return ts.isIntrinsicJsxName(tagName.escapedText); + default: + ts.Debug.fail(); } } function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, filter, checkMode) { var attributes = openingLikeElement.attributes; - var attributesTable = ts.createMap(); + var attributesTable = ts.createSymbolTable(); var spread = emptyObjectType; var attributesArray = []; var hasSpreadAnyType = false; @@ -35190,7 +32101,7 @@ var ts; var exprType = attributeDecl.initializer ? checkExpression(attributeDecl.initializer, checkMode) : trueType; - var attributeSymbol = createSymbol(4 | 134217728 | member.flags, member.name); + var attributeSymbol = createSymbol(4 | 33554432 | member.flags, member.escapedName); attributeSymbol.declarations = member.declarations; attributeSymbol.parent = member.parent; if (member.valueDeclaration) { @@ -35198,9 +32109,9 @@ var ts; } attributeSymbol.type = exprType; attributeSymbol.target = member; - attributesTable.set(attributeSymbol.name, attributeSymbol); + attributesTable.set(attributeSymbol.escapedName, attributeSymbol); attributesArray.push(attributeSymbol); - if (attributeDecl.name.text === jsxChildrenPropertyName) { + if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } } @@ -35209,7 +32120,7 @@ var ts; if (attributesArray.length > 0) { spread = getSpreadType(spread, createJsxAttributesType(attributes.symbol, attributesTable)); attributesArray = []; - attributesTable = ts.createMap(); + attributesTable = ts.createSymbolTable(); } var exprType = checkExpression(attributeDecl.expression); if (isTypeAny(exprType)) { @@ -35230,11 +32141,11 @@ var ts; } attributesArray = getPropertiesOfType(spread); } - attributesTable = ts.createMap(); + attributesTable = ts.createSymbolTable(); for (var _b = 0, attributesArray_1 = attributesArray; _b < attributesArray_1.length; _b++) { var attr = attributesArray_1[_b]; if (!filter || filter(attr)) { - attributesTable.set(attr.name, attr); + attributesTable.set(attr.escapedName, attr); } } } @@ -35254,9 +32165,9 @@ var ts; } if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { if (explicitlySpecifyChildrenAttribute) { - error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, jsxChildrenPropertyName); + error(attributes, ts.Diagnostics._0_are_specified_twice_The_attribute_named_0_will_be_overwritten, ts.unescapeLeadingUnderscores(jsxChildrenPropertyName)); } - var childrenPropSymbol = createSymbol(4 | 134217728, jsxChildrenPropertyName); + var childrenPropSymbol = createSymbol(4 | 33554432, jsxChildrenPropertyName); childrenPropSymbol.type = childrenTypes.length === 1 ? childrenTypes[0] : createArrayType(getUnionType(childrenTypes, false)); @@ -35270,7 +32181,7 @@ var ts; return typeToIntersect && attributesTable.size ? getIntersectionType([typeToIntersect, attributeType]) : typeToIntersect ? typeToIntersect : attributeType; function createJsxAttributesType(symbol, attributesTable) { - var result = createAnonymousType(symbol, attributesTable, emptyArray, emptyArray, undefined, undefined); + var result = createAnonymousType(symbol, attributesTable, ts.emptyArray, ts.emptyArray, undefined, undefined); result.flags |= 33554432 | 4194304; result.objectFlags |= 128; return result; @@ -35291,7 +32202,9 @@ var ts; if (!links.resolvedSymbol) { var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { - var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.text); + if (!ts.isIdentifier(node.tagName)) + throw ts.Debug.fail(); + var intrinsicProp = getPropertyOfType(intrinsicElementsType, node.tagName.escapedText); if (intrinsicProp) { links.jsxFlags |= 1; return links.resolvedSymbol = intrinsicProp; @@ -35301,12 +32214,12 @@ var ts; links.jsxFlags |= 2; return links.resolvedSymbol = intrinsicElementsType.symbol; } - error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, node.tagName.text, "JSX." + JsxNames.IntrinsicElements); + error(node, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(node.tagName.escapedText), "JSX." + JsxNames.IntrinsicElements); return links.resolvedSymbol = unknownSymbol; } else { if (noImplicitAny) { - error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, JsxNames.IntrinsicElements); + error(node, ts.Diagnostics.JSX_element_implicitly_has_type_any_because_no_interface_JSX_0_exists, ts.unescapeLeadingUnderscores(JsxNames.IntrinsicElements)); } return links.resolvedSymbol = unknownSymbol; } @@ -35349,10 +32262,10 @@ var ts; return ""; } else if (propertiesOfJsxElementAttribPropInterface.length === 1) { - return propertiesOfJsxElementAttribPropInterface[0].name; + return propertiesOfJsxElementAttribPropInterface[0].escapedName; } else if (propertiesOfJsxElementAttribPropInterface.length > 1) { - error(jsxElementAttribPropInterfaceSym.declarations[0], ts.Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, nameOfAttribPropContainer); + error(jsxElementAttribPropInterfaceSym.declarations[0], ts.Diagnostics.The_global_type_JSX_0_may_not_have_more_than_one_property, ts.unescapeLeadingUnderscores(nameOfAttribPropContainer)); } } return undefined; @@ -35426,8 +32339,8 @@ var ts; for (var _a = 0, _b = openingLikeElement.attributes.properties; _a < _b.length; _a++) { var attribute = _b[_a]; if (ts.isJsxAttribute(attribute) && - isUnhyphenatedJsxName(attribute.name.text) && - !getPropertyOfType(paramType, attribute.name.text)) { + isUnhyphenatedJsxName(attribute.name.escapedText) && + !getPropertyOfType(paramType, attribute.name.escapedText)) { shouldBeCandidate = false; break; } @@ -35451,9 +32364,7 @@ var ts; return undefined; } function resolveCustomJsxElementAttributesType(openingLikeElement, shouldIncludeAllStatelessAttributesType, elementType, elementClassType) { - if (!elementType) { - elementType = checkExpression(openingLikeElement.tagName); - } + if (elementType === void 0) { elementType = checkExpression(openingLikeElement.tagName); } if (elementType.flags & 65536) { var types = elementType.types; return getUnionType(types.map(function (type) { @@ -35466,7 +32377,7 @@ var ts; else if (elementType.flags & 32) { var intrinsicElementsType = getJsxType(JsxNames.IntrinsicElements); if (intrinsicElementsType !== unknownType) { - var stringLiteralTypeName = elementType.value; + var stringLiteralTypeName = ts.escapeLeadingUnderscores(elementType.value); var intrinsicProp = getPropertyOfType(intrinsicElementsType, stringLiteralTypeName); if (intrinsicProp) { return getTypeOfSymbol(intrinsicProp); @@ -35475,7 +32386,7 @@ var ts; if (indexSignatureType) { return indexSignatureType; } - error(openingLikeElement, ts.Diagnostics.Property_0_does_not_exist_on_type_1, stringLiteralTypeName, "JSX." + JsxNames.IntrinsicElements); + error(openingLikeElement, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(stringLiteralTypeName), "JSX." + JsxNames.IntrinsicElements); } return anyType; } @@ -35548,11 +32459,12 @@ var ts; } function getCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType) { var links = getNodeLinks(node); - if (!links.resolvedJsxElementAttributesType) { + var linkLocation = shouldIncludeAllStatelessAttributesType ? "resolvedJsxElementAllAttributesType" : "resolvedJsxElementAttributesType"; + if (!links[linkLocation]) { var elemClassType = getJsxGlobalElementClassType(); - return links.resolvedJsxElementAttributesType = resolveCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType, undefined, elemClassType); + return links[linkLocation] = resolveCustomJsxElementAttributesType(node, shouldIncludeAllStatelessAttributesType, undefined, elemClassType); } - return links.resolvedJsxElementAttributesType; + return links[linkLocation]; } function getAllAttributesTypeFromJsxOpeningLikeElement(node) { if (isJsxIntrinsicIdentifier(node.tagName)) { @@ -35572,7 +32484,7 @@ var ts; } function getJsxAttributePropertySymbol(attrib) { var attributesType = getAttributesTypeFromJsxOpeningLikeElement(attrib.parent.parent); - var prop = getPropertyOfType(attributesType, attrib.name.text); + var prop = getPropertyOfType(attributesType, attrib.name.escapedText); return prop || unknownSymbol; } function getJsxGlobalElementClassType() { @@ -35598,7 +32510,7 @@ var ts; } function getJsxIntrinsicTagNames() { var intrinsics = getJsxType(JsxNames.IntrinsicElements); - return intrinsics ? getPropertiesOfType(intrinsics) : emptyArray; + return intrinsics ? getPropertiesOfType(intrinsics) : ts.emptyArray; } function checkJsxPreconditions(errorNode) { if ((compilerOptions.jsx || 0) === 0) { @@ -35618,7 +32530,7 @@ var ts; var reactSym = resolveName(node.tagName, reactNamespace, 107455, reactRefErr, reactNamespace); if (reactSym) { reactSym.isReferenced = true; - if (reactSym.flags & 8388608 && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) { + if (reactSym.flags & 2097152 && !isConstEnumOrConstEnumOnlyModule(resolveAlias(reactSym))) { markAliasSymbolAsReferenced(reactSym); } } @@ -35649,18 +32561,18 @@ var ts; getIntrinsicAttributesTypeFromJsxOpeningLikeElement(openingLikeElement) : getCustomJsxElementAttributesType(openingLikeElement, false); var sourceAttributesType = createJsxAttributesTypeFromAttributesProperty(openingLikeElement, function (attribute) { - return isUnhyphenatedJsxName(attribute.name) || !!(getPropertyOfType(targetAttributesType, attribute.name)); + return isUnhyphenatedJsxName(attribute.escapedName) || !!(getPropertyOfType(targetAttributesType, attribute.escapedName)); }); if (targetAttributesType === emptyObjectType && (isTypeAny(sourceAttributesType) || sourceAttributesType.properties.length > 0)) { - error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, getJsxElementPropertiesName()); + error(openingLikeElement, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(getJsxElementPropertiesName())); } else { var isSourceAttributeTypeAssignableToTarget = checkTypeAssignableTo(sourceAttributesType, targetAttributesType, openingLikeElement.attributes.properties.length > 0 ? openingLikeElement.attributes : openingLikeElement); if (isSourceAttributeTypeAssignableToTarget && !isTypeAny(sourceAttributesType) && !isTypeAny(targetAttributesType)) { for (var _i = 0, _a = openingLikeElement.attributes.properties; _i < _a.length; _i++) { var attribute = _a[_i]; - if (ts.isJsxAttribute(attribute) && !isKnownProperty(targetAttributesType, attribute.name.text, true)) { - error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, attribute.name.text, typeToString(targetAttributesType)); + if (ts.isJsxAttribute(attribute) && !isKnownProperty(targetAttributesType, attribute.name.escapedText, true)) { + error(attribute, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(attribute.name.escapedText), typeToString(targetAttributesType)); break; } } @@ -35777,13 +32689,13 @@ var ts; if (apparentType === unknownType || (type.flags & 16384 && isTypeAny(apparentType))) { return apparentType; } - var prop = getPropertyOfType(apparentType, right.text); + var prop = getPropertyOfType(apparentType, right.escapedText); if (!prop) { var stringIndexType = getIndexTypeOfType(apparentType, 0); if (stringIndexType) { return stringIndexType; } - if (right.text && !checkAndReportErrorForExtendingInterface(node)) { + if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) { reportNonexistentProperty(right, type.flags & 16384 && type.isThisType ? apparentType : type); } return unknownType; @@ -35791,13 +32703,13 @@ var ts; if (prop.valueDeclaration) { if (isInPropertyInitializer(node) && !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { - error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, right.text); + error(right, ts.Diagnostics.Block_scoped_variable_0_used_before_its_declaration, ts.unescapeLeadingUnderscores(right.escapedText)); } if (prop.valueDeclaration.kind === 229 && node.parent && node.parent.kind !== 159 && !ts.isInAmbientContext(prop.valueDeclaration) && !isBlockScopedNameDeclaredBeforeUse(prop.valueDeclaration, right)) { - error(right, ts.Diagnostics.Class_0_used_before_its_declaration, right.text); + error(right, ts.Diagnostics.Class_0_used_before_its_declaration, ts.unescapeLeadingUnderscores(right.escapedText)); } } markPropertyAsReferenced(prop); @@ -35807,7 +32719,7 @@ var ts; var assignmentKind = ts.getAssignmentTargetKind(node); if (assignmentKind) { if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) { - error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, right.text); + error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant_or_a_read_only_property, ts.unescapeLeadingUnderscores(right.escapedText)); return unknownType; } } @@ -35824,7 +32736,7 @@ var ts; if (containingType.flags & 65536 && !(containingType.flags & 8190)) { for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) { var subtype = _a[_i]; - if (!getPropertyOfType(subtype, propNode.text)) { + if (!getPropertyOfType(subtype, propNode.escapedText)) { errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.declarationNameToString(propNode), typeToString(subtype)); break; } @@ -35840,8 +32752,8 @@ var ts; diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(propNode, errorInfo)); } function getSuggestionForNonexistentProperty(node, containingType) { - var suggestion = getSpellingSuggestionForName(node.text, getPropertiesOfObjectType(containingType), 107455); - return suggestion && suggestion.name; + var suggestion = getSpellingSuggestionForName(ts.unescapeLeadingUnderscores(node.escapedText), getPropertiesOfType(containingType), 107455); + return suggestion && suggestion.escapedName; } function getSuggestionForNonexistentSymbol(location, name, meaning) { var result = resolveNameHelper(location, name, meaning, undefined, name, function (symbols, name, meaning) { @@ -35849,10 +32761,10 @@ var ts; if (symbol) { return symbol; } - return getSpellingSuggestionForName(name, ts.arrayFrom(symbols.values()), meaning); + return getSpellingSuggestionForName(ts.unescapeLeadingUnderscores(name), ts.arrayFrom(symbols.values()), meaning); }); if (result) { - return result.name; + return result.escapedName; } } function getSpellingSuggestionForName(name, symbols, meaning) { @@ -35867,10 +32779,11 @@ var ts; name = name.toLowerCase(); for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { var candidate = symbols_3[_i]; + var candidateName = ts.unescapeLeadingUnderscores(candidate.escapedName); if (candidate.flags & meaning && - candidate.name && - Math.abs(candidate.name.length - name.length) < maximumLengthDifference) { - var candidateName = candidate.name.toLowerCase(); + candidateName && + Math.abs(candidateName.length - name.length) < maximumLengthDifference) { + candidateName = candidateName.toLowerCase(); if (candidateName === name) { return candidate; } @@ -35907,7 +32820,7 @@ var ts; if (prop && noUnusedIdentifiers && (prop.flags & 106500) && - prop.valueDeclaration && (ts.getModifierFlags(prop.valueDeclaration) & 8)) { + prop.valueDeclaration && ts.hasModifier(prop.valueDeclaration, 8)) { if (ts.getCheckFlags(prop) & 1) { getSymbolLinks(prop).target.isReferenced = true; } @@ -36178,8 +33091,8 @@ var ts; } return undefined; } - function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper) { - var context = createInferenceContext(signature, 1); + function instantiateSignatureInContextOf(signature, contextualSignature, contextualMapper, compareTypes) { + var context = createInferenceContext(signature, 1, compareTypes); forEachMatchingParameterType(contextualSignature, signature, function (source, target) { inferTypes(context.inferences, instantiateType(source, contextualMapper || identityMapper), target); }); @@ -36189,10 +33102,10 @@ var ts; return getSignatureInstantiation(signature, getInferredTypes(context)); } function inferTypeArguments(node, signature, args, excludeArgument, context) { - var inferences = context.inferences; - for (var i = 0; i < inferences.length; i++) { - if (!inferences[i].isFixed) { - inferences[i].inferredType = undefined; + for (var _i = 0, _a = context.inferences; _i < _a.length; _i++) { + var inference = _a[_i]; + if (!inference.isFixed) { + inference.inferredType = undefined; } } if (ts.isExpression(node)) { @@ -36272,7 +33185,7 @@ var ts; var argProperties = getPropertiesOfType(attributesType); for (var _i = 0, argProperties_1 = argProperties; _i < argProperties_1.length; _i++) { var arg = argProperties_1[_i]; - if (!getPropertyOfType(paramType, arg.name) && isUnhyphenatedJsxName(arg.name)) { + if (!getPropertyOfType(paramType, arg.escapedName) && isUnhyphenatedJsxName(arg.escapedName)) { return false; } } @@ -36298,12 +33211,11 @@ var ts; var arg = getEffectiveArgument(node, args, i); if (arg === undefined || arg.kind !== 200) { var paramType = getTypeAtPosition(signature, i); - var argType = getEffectiveArgumentType(node, i); - if (argType === undefined) { - argType = checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); - } + var argType = getEffectiveArgumentType(node, i) || + checkExpressionWithContextualType(arg, paramType, excludeArgument && excludeArgument[i] ? identityMapper : undefined); + var checkArgType = excludeArgument ? getRegularTypeOfObjectLiteral(argType) : argType; var errorNode = reportErrors ? getEffectiveArgumentErrorNode(node, i, arg) : undefined; - if (!checkTypeRelatedTo(argType, paramType, relation, errorNode, headMessage)) { + if (!checkTypeRelatedTo(checkArgType, paramType, relation, errorNode, headMessage)) { return false; } } @@ -36322,26 +33234,25 @@ var ts; } } function getEffectiveCallArguments(node) { - var args; if (node.kind === 183) { var template = node.template; - args = [undefined]; + var args_4 = [undefined]; if (template.kind === 196) { ts.forEach(template.templateSpans, function (span) { - args.push(span.expression); + args_4.push(span.expression); }); } + return args_4; } else if (node.kind === 147) { return undefined; } else if (ts.isJsxOpeningLikeElement(node)) { - args = node.attributes.properties.length > 0 ? [node.attributes] : emptyArray; + return node.attributes.properties.length > 0 ? [node.attributes] : ts.emptyArray; } else { - args = node.arguments || emptyArray; + return node.arguments || ts.emptyArray; } - return args; } function getEffectiveArgumentCount(node, args, signature) { if (node.kind === 147) { @@ -36405,12 +33316,13 @@ var ts; var element = node; switch (element.name.kind) { case 71: + return getLiteralType(ts.unescapeLeadingUnderscores(element.name.escapedText)); case 8: case 9: return getLiteralType(element.name.text); case 144: var nameType = checkComputedPropertyName(element.name); - if (isTypeOfKind(nameType, 512)) { + if (isTypeAssignableToKind(nameType, 512)) { return nameType; } else { @@ -36503,14 +33415,17 @@ var ts; return resolveErrorCall(node); } var args = getEffectiveCallArguments(node); + var isSingleNonGenericCandidate = candidates.length === 1 && !candidates[0].typeParameters; var excludeArgument; - if (!isDecorator) { + var excludeCount = 0; + if (!isDecorator && !isSingleNonGenericCandidate) { for (var i = isTaggedTemplate ? 1 : 0; i < args.length; i++) { if (isContextSensitive(args[i])) { if (!excludeArgument) { excludeArgument = new Array(args.length); } excludeArgument[i] = true; + excludeCount++; } } } @@ -36572,23 +33487,42 @@ var ts; diagnostics.add(ts.createDiagnosticForNode(node, fallbackError)); } if (!produceDiagnostics) { - for (var _b = 0, candidates_1 = candidates; _b < candidates_1.length; _b++) { - var candidate = candidates_1[_b]; - if (hasCorrectArity(node, args, candidate)) { - if (candidate.typeParameters && typeArguments) { - candidate = getSignatureInstantiation(candidate, ts.map(typeArguments, getTypeFromTypeNode)); - } - return candidate; + ts.Debug.assert(candidates.length > 0); + var bestIndex = getLongestCandidateIndex(candidates, apparentArgumentCount === undefined ? args.length : apparentArgumentCount); + var candidate = candidates[bestIndex]; + var typeParameters = candidate.typeParameters; + if (typeParameters && callLikeExpressionMayHaveTypeArguments(node) && node.typeArguments) { + var typeArguments_2 = node.typeArguments.map(getTypeOfNode); + while (typeArguments_2.length > typeParameters.length) { + typeArguments_2.pop(); } + while (typeArguments_2.length < typeParameters.length) { + typeArguments_2.push(getDefaultTypeArgumentType(ts.isInJavaScriptFile(node))); + } + var instantiated = createSignatureInstantiation(candidate, typeArguments_2); + candidates[bestIndex] = instantiated; + return instantiated; } + return candidate; } return resolveErrorCall(node); function chooseOverload(candidates, relation, signatureHelpTrailingComma) { if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; } candidateForArgumentError = undefined; candidateForTypeArgumentError = undefined; - for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) { - var originalCandidate = candidates_2[_i]; + if (isSingleNonGenericCandidate) { + var candidate = candidates[0]; + if (!hasCorrectArity(node, args, candidate, signatureHelpTrailingComma)) { + return undefined; + } + if (!checkApplicableSignature(node, args, candidate, relation, excludeArgument, false)) { + candidateForArgumentError = candidate; + return undefined; + } + return candidate; + } + for (var candidateIndex = 0; candidateIndex < candidates.length; candidateIndex++) { + var originalCandidate = candidates[candidateIndex]; if (!hasCorrectArity(node, args, originalCandidate, signatureHelpTrailingComma)) { continue; } @@ -36616,16 +33550,37 @@ var ts; candidateForArgumentError = candidate; break; } - var index = excludeArgument ? ts.indexOf(excludeArgument, true) : -1; - if (index < 0) { + if (excludeCount === 0) { + candidates[candidateIndex] = candidate; return candidate; } - excludeArgument[index] = false; + excludeCount--; + if (excludeCount > 0) { + excludeArgument[ts.indexOf(excludeArgument, true)] = false; + } + else { + excludeArgument = undefined; + } } } return undefined; } } + function getLongestCandidateIndex(candidates, argsCount) { + var maxParamsIndex = -1; + var maxParams = -1; + for (var i = 0; i < candidates.length; i++) { + var candidate = candidates[i]; + if (candidate.hasRestParameter || candidate.parameters.length >= argsCount) { + return i; + } + if (candidate.parameters.length > maxParams) { + maxParams = candidate.parameters.length; + maxParamsIndex = i; + } + } + return maxParamsIndex; + } function resolveCallExpression(node, candidatesOutArray) { if (node.expression.kind === 97) { var superType = checkSuperExpression(node.expression); @@ -36696,7 +33651,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.getModifierFlags(valueDecl) & 128) { + if (valueDecl && ts.hasModifier(valueDecl, 128)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_the_abstract_class_0, ts.declarationNameToString(ts.getNameOfDeclaration(valueDecl))); return resolveErrorCall(node); } @@ -36732,8 +33687,8 @@ var ts; return true; } var declaration = signature.declaration; - var modifiers = ts.getModifierFlags(declaration); - if (!(modifiers & 24)) { + var modifiers = ts.getSelectedModifierFlags(declaration, 24); + if (!modifiers) { return true; } var declaringClassDeclaration = getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -36832,9 +33787,7 @@ var ts; } var callSignatures = elementType && getSignaturesOfType(elementType, 0); if (callSignatures && callSignatures.length > 0) { - var callSignature = void 0; - callSignature = resolveCall(openingLikeElement, callSignatures, candidatesOutArray); - return callSignature; + return resolveCall(openingLikeElement, callSignatures, candidatesOutArray); } return undefined; } @@ -36865,11 +33818,8 @@ var ts; links.resolvedSignature = flowLoopStart === flowLoopCount ? result : cached; return result; } - function getResolvedOrAnySignature(node) { - return getNodeLinks(node).resolvedSignature === resolvingSignature ? resolvingSignature : getResolvedSignature(node); - } function isJavaScriptConstructor(node) { - if (ts.isInJavaScriptFile(node)) { + if (node && ts.isInJavaScriptFile(node)) { if (ts.getJSDocClassTag(node)) return true; var symbol = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? getSymbolOfNode(node) : @@ -36879,10 +33829,24 @@ var ts; } return false; } + function getJavaScriptClassType(symbol) { + if (ts.isDeclarationOfFunctionOrClassExpression(symbol)) { + symbol = getSymbolOfNode(symbol.valueDeclaration.initializer); + } + if (isJavaScriptConstructor(symbol.valueDeclaration)) { + return getInferredClassType(symbol); + } + if (symbol.flags & 3) { + var valueType = getTypeOfSymbol(symbol); + if (valueType.symbol && !isInferredClassType(valueType) && isJavaScriptConstructor(valueType.symbol.valueDeclaration)) { + return getInferredClassType(valueType.symbol); + } + } + } function getInferredClassType(symbol) { var links = getSymbolLinks(symbol); if (!links.inferredClassType) { - links.inferredClassType = createAnonymousType(symbol, symbol.members || emptySymbols, emptyArray, emptyArray, undefined, undefined); + links.inferredClassType = createAnonymousType(symbol, symbol.members || emptySymbols, ts.emptyArray, ts.emptyArray, undefined, undefined); } return links.inferredClassType; } @@ -36907,13 +33871,11 @@ var ts; var funcSymbol = node.expression.kind === 71 ? getResolvedSymbol(node.expression) : checkExpression(node.expression).symbol; - if (funcSymbol && ts.isDeclarationOfFunctionOrClassExpression(funcSymbol)) { - funcSymbol = getSymbolOfNode(funcSymbol.valueDeclaration.initializer); - } - if (funcSymbol && funcSymbol.flags & 16 && (funcSymbol.members || ts.getJSDocClassTag(funcSymbol.valueDeclaration))) { - return getInferredClassType(funcSymbol); + var type = funcSymbol && getJavaScriptClassType(funcSymbol); + if (type) { + return type; } - else if (noImplicitAny) { + if (noImplicitAny) { error(node, ts.Diagnostics.new_expression_whose_target_lacks_a_construct_signature_implicitly_has_an_any_type); } return anyType; @@ -36941,20 +33903,44 @@ var ts; if (moduleSymbol) { var esModuleSymbol = resolveESModuleSymbol(moduleSymbol, specifier, true); if (esModuleSymbol) { - return createPromiseReturnType(node, getTypeOfSymbol(esModuleSymbol)); + return createPromiseReturnType(node, getTypeWithSyntheticDefaultImportType(getTypeOfSymbol(esModuleSymbol), esModuleSymbol)); } } return createPromiseReturnType(node, anyType); } + function getTypeWithSyntheticDefaultImportType(type, symbol) { + if (allowSyntheticDefaultImports && type && type !== unknownType) { + var synthType = type; + if (!synthType.syntheticType) { + if (!getPropertyOfType(type, "default")) { + var memberTable = ts.createSymbolTable(); + var newSymbol = createSymbol(2097152, "default"); + newSymbol.target = resolveSymbol(symbol); + memberTable.set("default", newSymbol); + var anonymousSymbol = createSymbol(2048, "__type"); + var defaultContainingObject = createAnonymousType(anonymousSymbol, memberTable, ts.emptyArray, ts.emptyArray, undefined, undefined); + anonymousSymbol.type = defaultContainingObject; + synthType.syntheticType = getIntersectionType([type, defaultContainingObject]); + } + else { + synthType.syntheticType = type; + } + } + return synthType.syntheticType; + } + return type; + } function isCommonJsRequire(node) { if (!ts.isRequireCall(node, true)) { return false; } - var resolvedRequire = resolveName(node.expression, node.expression.text, 107455, undefined, undefined); + if (!ts.isIdentifier(node.expression)) + throw ts.Debug.fail(); + var resolvedRequire = resolveName(node.expression, node.expression.escapedText, 107455, undefined, undefined); if (!resolvedRequire) { return true; } - if (resolvedRequire.flags & 8388608) { + if (resolvedRequire.flags & 2097152) { return false; } var targetDeclarationKind = resolvedRequire.flags & 16 @@ -36972,13 +33958,16 @@ var ts; return getReturnTypeOfSignature(getResolvedSignature(node)); } function checkAssertion(node) { - var exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(checkExpression(node.expression))); - checkSourceElement(node.type); - var targetType = getTypeFromTypeNode(node.type); + return checkAssertionWorker(node, node.type, node.expression); + } + function checkAssertionWorker(errNode, type, expression, checkMode) { + var exprType = getRegularTypeOfObjectLiteral(getBaseTypeOfLiteralType(checkExpression(expression, checkMode))); + checkSourceElement(type); + var targetType = getTypeFromTypeNode(type); if (produceDiagnostics && targetType !== unknownType) { var widenedType = getWidenedType(exprType); if (!isTypeComparableTo(targetType, widenedType)) { - checkTypeComparableTo(exprType, targetType, node, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1); + checkTypeComparableTo(exprType, targetType, errNode, ts.Diagnostics.Type_0_cannot_be_converted_to_type_1); } } return targetType; @@ -37059,15 +34048,15 @@ var ts; } } } - function assignBindingElementTypes(node) { - if (ts.isBindingPattern(node.name)) { - for (var _i = 0, _a = node.name.elements; _i < _a.length; _i++) { - var element = _a[_i]; - if (!ts.isOmittedExpression(element)) { - if (element.name.kind === 71) { - getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); - } - assignBindingElementTypes(element); + function assignBindingElementTypes(pattern) { + for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + if (element.name.kind === 71) { + getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element); + } + else { + assignBindingElementTypes(element.name); } } } @@ -37076,12 +34065,13 @@ var ts; var links = getSymbolLinks(parameter); if (!links.type) { links.type = contextualType; - var name = ts.getNameOfDeclaration(parameter.valueDeclaration); - if (links.type === emptyObjectType && - (name.kind === 174 || name.kind === 175)) { - links.type = getTypeFromBindingPattern(name); + var decl = parameter.valueDeclaration; + if (decl.name.kind !== 71) { + if (links.type === emptyObjectType) { + links.type = getTypeFromBindingPattern(decl.name); + } + assignBindingElementTypes(decl.name); } - assignBindingElementTypes(parameter.valueDeclaration); } } function createPromiseType(promisedType) { @@ -37282,14 +34272,14 @@ var ts; } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { ts.Debug.assert(node.kind !== 151 || ts.isObjectLiteralMethod(node)); - var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 186) { - checkGrammarForGenerator(node); - } if (checkMode === 1 && isContextSensitive(node)) { checkNodeDeferred(node); return anyFunctionType; } + var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); + if (!hasGrammarError && node.kind === 186) { + checkGrammarForGenerator(node); + } var links = getNodeLinks(node); var type = getTypeOfSymbol(node.symbol); if (!(links.flags & 1024)) { @@ -37359,7 +34349,7 @@ var ts; } } function checkArithmeticOperandType(operand, type, diagnostic) { - if (!isTypeAnyOrAllConstituentTypesHaveKind(type, 84)) { + if (!isTypeAssignableToKind(type, 84)) { error(operand, diagnostic); return false; } @@ -37392,7 +34382,7 @@ var ts; var node = ts.skipParentheses(expr.expression); if (node.kind === 71) { var symbol = getNodeLinks(node).resolvedSymbol; - if (symbol.flags & 8388608) { + if (symbol.flags & 2097152) { var declaration = getDeclarationOfAliasSymbol(symbol); return declaration && declaration.kind === 240; } @@ -37447,8 +34437,13 @@ var ts; if (operandType === silentNeverType) { return silentNeverType; } - if (node.operator === 38 && node.operand.kind === 8) { - return getFreshTypeOfLiteralType(getLiteralType(-node.operand.text)); + if (node.operand.kind === 8) { + if (node.operator === 38) { + return getFreshTypeOfLiteralType(getLiteralType(-node.operand.text)); + } + else if (node.operator === 37) { + return getFreshTypeOfLiteralType(getLiteralType(+node.operand.text)); + } } switch (node.operator) { case 37: @@ -37500,30 +34495,22 @@ var ts; } return false; } - function isTypeOfKind(type, kind) { - if (type.flags & kind) { + function isTypeAssignableToKind(source, kind, strict) { + if (source.flags & kind) { return true; } - if (type.flags & 65536) { - var types = type.types; - for (var _i = 0, types_18 = types; _i < types_18.length; _i++) { - var t = types_18[_i]; - if (!isTypeOfKind(t, kind)) { - return false; - } - } - return true; - } - if (type.flags & 131072) { - var types = type.types; - for (var _a = 0, types_19 = types; _a < types_19.length; _a++) { - var t = types_19[_a]; - if (isTypeOfKind(t, kind)) { - return true; - } - } + if (strict && source.flags & (1 | 1024 | 2048 | 4096)) { + return false; } - return false; + return (kind & 84 && isTypeAssignableTo(source, numberType)) || + (kind & 262178 && isTypeAssignableTo(source, stringType)) || + (kind & 136 && isTypeAssignableTo(source, booleanType)) || + (kind & 1024 && isTypeAssignableTo(source, voidType)) || + (kind & 8192 && isTypeAssignableTo(source, neverType)) || + (kind & 4096 && isTypeAssignableTo(source, nullType)) || + (kind & 2048 && isTypeAssignableTo(source, undefinedType)) || + (kind & 512 && isTypeAssignableTo(source, esSymbolType)) || + (kind & 16777216 && isTypeAssignableTo(source, nonPrimitiveType)); } function isConstEnumObjectType(type) { return getObjectFlags(type) & 16 && type.symbol && isConstEnumSymbol(type.symbol); @@ -37535,7 +34522,7 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (isTypeOfKind(leftType, 8190)) { + if (!isTypeAny(leftType) && isTypeAssignableToKind(leftType, 8190)) { error(left, ts.Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } if (!(isTypeAny(rightType) || @@ -37552,10 +34539,10 @@ var ts; } leftType = checkNonNullType(leftType, left); rightType = checkNonNullType(rightType, right); - if (!(isTypeComparableTo(leftType, stringType) || isTypeOfKind(leftType, 84 | 512))) { + if (!(isTypeComparableTo(leftType, stringType) || isTypeAssignableToKind(leftType, 84 | 512))) { error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672 | 16777216)) { + if (!isTypeAssignableToKind(rightType, 16777216 | 540672)) { error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -37819,24 +34806,22 @@ var ts; if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; } - if (!isTypeOfKind(leftType, 1 | 262178) && !isTypeOfKind(rightType, 1 | 262178)) { + if (!isTypeAssignableToKind(leftType, 262178) && !isTypeAssignableToKind(rightType, 262178)) { leftType = checkNonNullType(leftType, left); rightType = checkNonNullType(rightType, right); } var resultType = void 0; - if (isTypeOfKind(leftType, 84) && isTypeOfKind(rightType, 84)) { + if (isTypeAssignableToKind(leftType, 84, true) && isTypeAssignableToKind(rightType, 84, true)) { resultType = numberType; } - else { - if (isTypeOfKind(leftType, 262178) || isTypeOfKind(rightType, 262178)) { - resultType = stringType; - } - else if (isTypeAny(leftType) || isTypeAny(rightType)) { - resultType = leftType === unknownType || rightType === unknownType ? unknownType : anyType; - } - if (resultType && !checkForDisallowedESSymbolOperand(operator)) { - return resultType; - } + else if (isTypeAssignableToKind(leftType, 262178, true) || isTypeAssignableToKind(rightType, 262178, true)) { + resultType = stringType; + } + else if (isTypeAny(leftType) || isTypeAny(rightType)) { + resultType = leftType === unknownType || rightType === unknownType ? unknownType : anyType; + } + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; } if (!resultType) { reportOperatorError(); @@ -37894,7 +34879,7 @@ var ts; return rightType; } function isEvalNode(node) { - return node.kind === 71 && node.text === "eval"; + return node.kind === 71 && node.escapedText === "eval"; } function checkForDisallowedESSymbolOperand(operator) { var offendingSymbolOperand = maybeTypeOfKind(leftType, 512) ? left : @@ -37970,7 +34955,7 @@ var ts; } } if (functionFlags & 1) { - var expressionType = checkExpressionCached(node.expression, undefined); + var expressionType = checkExpressionCached(node.expression); var expressionElementType = void 0; var nodeIsYieldStar = !!node.asteriskToken; if (nodeIsYieldStar) { @@ -38001,13 +34986,12 @@ var ts; return getBestChoiceType(type1, type2); } function checkLiteralExpression(node) { - if (node.kind === 8) { - checkGrammarNumericLiteral(node); - } switch (node.kind) { + case 13: case 9: return getFreshTypeOfLiteralType(getLiteralType(node.text)); case 8: + checkGrammarNumericLiteral(node); return getFreshTypeOfLiteralType(getLiteralType(+node.text)); case 101: return trueType; @@ -38135,6 +35119,16 @@ var ts; } return type; } + function checkParenthesizedExpression(node, checkMode) { + if (ts.isInJavaScriptFile(node) && node.jsDoc) { + var typecasts = ts.flatMap(node.jsDoc, function (doc) { return ts.filter(doc.tags, function (tag) { return tag.kind === 281 && !!tag.typeExpression && !!tag.typeExpression.type; }); }); + if (typecasts && typecasts.length) { + var cast_1 = typecasts[0]; + return checkAssertionWorker(cast_1, cast_1.typeExpression.type, node.expression, checkMode); + } + } + return checkExpression(node.expression, checkMode); + } function checkExpressionWorker(node, checkMode) { switch (node.kind) { case 71: @@ -38145,6 +35139,7 @@ var ts; return checkSuperExpression(node); case 95: return nullWideningType; + case 13: case 9: case 8: case 101: @@ -38152,8 +35147,6 @@ var ts; return checkLiteralExpression(node); case 196: return checkTemplateExpression(node); - case 13: - return stringType; case 12: return globalRegExpType; case 177: @@ -38173,7 +35166,7 @@ var ts; case 183: return checkTaggedTemplateExpression(node); case 185: - return checkExpression(node.expression, checkMode); + return checkParenthesizedExpression(node, checkMode); case 199: return checkClassExpression(node); case 186: @@ -38244,7 +35237,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); - if (ts.getModifierFlags(node) & 92) { + if (ts.hasModifier(node, 92)) { func = ts.getContainingFunction(node); if (!(func.kind === 152 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); @@ -38253,9 +35246,9 @@ var ts; if (node.questionToken && ts.isBindingPattern(node.name) && func.body) { error(node, ts.Diagnostics.A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature); } - if (node.name.text === "this") { + if (node.name && ts.isIdentifier(node.name) && (node.name.escapedText === "this" || node.name.escapedText === "new")) { if (ts.indexOf(func.parameters, node) !== 0) { - error(node, ts.Diagnostics.A_this_parameter_must_be_the_first_parameter); + error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } if (func.kind === 152 || func.kind === 156 || func.kind === 161) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); @@ -38269,8 +35262,7 @@ var ts; if (parameterList) { for (var i = 0; i < parameterList.length; i++) { var param = parameterList[i]; - if (param.name.kind === 71 && - param.name.text === parameter.text) { + if (param.name.kind === 71 && param.name.escapedText === parameter.escapedText) { return i; } } @@ -38287,6 +35279,7 @@ var ts; if (!typePredicate) { return; } + checkSourceElement(node.type); var parameterName = node.parameterName; if (ts.isThisTypePredicate(typePredicate)) { getTypeFromThisTypeNode(parameterName); @@ -38339,13 +35332,11 @@ var ts; continue; } var name = element.name; - if (name.kind === 71 && - name.text === predicateVariableName) { + if (name.kind === 71 && name.escapedText === predicateVariableName) { error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 175 || - name.kind === 174) { + else if (name.kind === 175 || name.kind === 174) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -38423,20 +35414,20 @@ var ts; Declaration[Declaration["Method"] = 4] = "Method"; Declaration[Declaration["Property"] = 3] = "Property"; })(Declaration || (Declaration = {})); - var instanceNames = ts.createMap(); - var staticNames = ts.createMap(); + var instanceNames = ts.createUnderscoreEscapedMap(); + var staticNames = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (member.kind === 152) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; - if (ts.isParameterPropertyDeclaration(param)) { - addName(instanceNames, param.name, param.name.text, 3); + if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) { + addName(instanceNames, param.name, param.name.escapedText, 3); } } } else { - var isStatic = ts.getModifierFlags(member) & 32; + var isStatic = ts.hasModifier(member, 32); var names = isStatic ? staticNames : instanceNames; var memberName = member.name && ts.getPropertyNameForPropertyNameNode(member.name); if (memberName) { @@ -38481,7 +35472,7 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; var memberNameNode = member.name; - var isStatic = ts.getModifierFlags(member) & 32; + var isStatic = ts.hasModifier(member, 32); if (isStatic && memberNameNode) { var memberName = ts.getPropertyNameForPropertyNameNode(memberNameNode); switch (memberName) { @@ -38507,9 +35498,11 @@ var ts; switch (member.name.kind) { case 9: case 8: - case 71: memberName = member.name.text; break; + case 71: + memberName = ts.unescapeLeadingUnderscores(member.name.escapedText); + break; default: continue; } @@ -38567,7 +35560,7 @@ var ts; function checkMethodDeclaration(node) { checkGrammarMethod(node) || checkGrammarComputedPropertyName(node.name); checkFunctionOrMethodDeclaration(node); - if (ts.getModifierFlags(node) & 128 && node.body) { + if (ts.hasModifier(node, 128) && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -38603,17 +35596,9 @@ var ts; } return ts.forEachChild(n, containsSuperCall); } - function markThisReferencesAsErrors(n) { - if (n.kind === 99) { - error(n, ts.Diagnostics.this_cannot_be_referenced_in_current_location); - } - else if (n.kind !== 186 && n.kind !== 228) { - ts.forEachChild(n, markThisReferencesAsErrors); - } - } function isInstancePropertyWithInitializer(n) { return n.kind === 149 && - !(ts.getModifierFlags(n) & 32) && + !ts.hasModifier(n, 32) && !!n.initializer; } var containingClassDecl = node.parent; @@ -38625,13 +35610,13 @@ var ts; if (classExtendsNull) { error(superCall, ts.Diagnostics.A_constructor_cannot_contain_a_super_call_when_its_class_extends_null); } - var superCallShouldBeFirst = ts.forEach(node.parent.members, isInstancePropertyWithInitializer) || - ts.forEach(node.parameters, function (p) { return ts.getModifierFlags(p) & 92; }); + var superCallShouldBeFirst = ts.some(node.parent.members, isInstancePropertyWithInitializer) || + ts.some(node.parameters, function (p) { return ts.hasModifier(p, 92); }); if (superCallShouldBeFirst) { var statements = node.body.statements; var superCallStatement = void 0; - for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { - var statement = statements_3[_i]; + for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) { + var statement = statements_2[_i]; if (statement.kind === 210 && ts.isSuperCall(statement.expression)) { superCallStatement = statement; break; @@ -38669,10 +35654,12 @@ var ts; var otherKind = node.kind === 153 ? 154 : 153; var otherAccessor = ts.getDeclarationOfKind(node.symbol, otherKind); if (otherAccessor) { - if ((ts.getModifierFlags(node) & 28) !== (ts.getModifierFlags(otherAccessor) & 28)) { + var nodeFlags = ts.getModifierFlags(node); + var otherFlags = ts.getModifierFlags(otherAccessor); + if ((nodeFlags & 28) !== (otherFlags & 28)) { error(node.name, ts.Diagnostics.Getter_and_setter_accessors_do_not_agree_in_visibility); } - if (ts.hasModifier(node, 128) !== ts.hasModifier(otherAccessor, 128)) { + if ((nodeFlags & 128) !== (otherFlags & 128)) { error(node.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } checkAccessorDeclarationTypesIdentical(node, otherAccessor, getAnnotatedAccessorType, ts.Diagnostics.get_and_set_accessor_must_have_the_same_type); @@ -38717,13 +35704,23 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); + if (node.kind === 159 && node.typeName.jsdocDotPos !== undefined && !ts.isInJavaScriptFile(node) && !ts.isInJSDoc(node)) { + grammarErrorAtPos(ts.getSourceFileOfNode(node), node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); + } var type = getTypeFromTypeReference(node); if (type !== unknownType) { if (node.typeArguments) { ts.forEach(node.typeArguments, checkSourceElement); if (produceDiagnostics) { var symbol = getNodeLinks(node).resolvedSymbol; - var typeParameters = symbol.flags & 524288 ? getSymbolLinks(symbol).typeParameters : type.target.localTypeParameters; + if (!symbol) { + error(node, ts.Diagnostics.Type_0_is_not_generic, typeToString(type)); + return; + } + var typeParameters = symbol.flags & 524288 && getSymbolLinks(symbol).typeParameters; + if (!typeParameters && getObjectFlags(type) & 4) { + typeParameters = type.target.localTypeParameters; + } checkTypeArgumentConstraints(typeParameters, node.typeArguments); } } @@ -38766,7 +35763,7 @@ var ts; if (isTypeAssignableTo(indexType, getIndexType(objectType))) { return type; } - if (maybeTypeOfKind(objectType, 540672) && isTypeOfKind(indexType, 84)) { + if (maybeTypeOfKind(objectType, 540672) && isTypeAssignableToKind(indexType, 84)) { var constraint = getBaseConstraintOfType(objectType); if (constraint && getIndexInfoOfType(constraint, 1)) { return type; @@ -38776,6 +35773,8 @@ var ts; return type; } function checkIndexedAccessType(node) { + checkSourceElement(node.objectType); + checkSourceElement(node.indexType); checkIndexedAccessIndexType(getTypeFromIndexedAccessTypeNode(node), node); } function checkMappedType(node) { @@ -38786,7 +35785,7 @@ var ts; checkTypeAssignableTo(constraintType, stringType, node.typeParameter.constraint); } function isPrivateWithinAmbient(node) { - return (ts.getModifierFlags(node) & 8) && ts.isInAmbientContext(node); + return ts.hasModifier(node, 8) && ts.isInAmbientContext(node); } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); @@ -38868,11 +35867,14 @@ var ts; if (subsequentNode && subsequentNode.pos === node.end) { if (subsequentNode.kind === node.kind) { var errorNode_1 = subsequentNode.name || subsequentNode; - if (node.name && subsequentNode.name && node.name.text === subsequentNode.name.text) { + var subsequentName = subsequentNode.name; + if (node.name && subsequentName && + (ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) || + !ts.isComputedPropertyName(node.name) && !ts.isComputedPropertyName(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { var reportError = (node.kind === 151 || node.kind === 150) && - (ts.getModifierFlags(node) & 32) !== (ts.getModifierFlags(subsequentNode) & 32); + ts.hasModifier(node, 32) !== ts.hasModifier(subsequentNode, 32); if (reportError) { - var diagnostic = ts.getModifierFlags(node) & 32 ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; + var diagnostic = ts.hasModifier(node, 32) ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; error(errorNode_1, diagnostic); } return; @@ -38888,7 +35890,7 @@ var ts; error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing); } else { - if (ts.getModifierFlags(node) & 128) { + if (ts.hasModifier(node, 128)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -38898,8 +35900,8 @@ var ts; } var duplicateFunctionDeclaration = false; var multipleConstructorImplementation = false; - for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { - var current = declarations_5[_i]; + for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { + var current = declarations_4[_i]; var node = current; var inAmbientContext = ts.isInAmbientContext(node); var inAmbientContextOrInterface = node.parent.kind === 230 || node.parent.kind === 163 || inAmbientContext; @@ -38948,7 +35950,7 @@ var ts; }); } if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !(ts.getModifierFlags(lastSeenNonAmbientDeclaration) & 128) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasModifier(lastSeenNonAmbientDeclaration, 128) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -38974,7 +35976,7 @@ var ts; var symbol = node.localSymbol; if (!symbol) { symbol = getSymbolOfNode(node); - if (!(symbol.flags & 7340032)) { + if (!symbol.exportSymbol) { return; } } @@ -39016,24 +36018,38 @@ var ts; } } } + var DeclarationSpaces; + (function (DeclarationSpaces) { + DeclarationSpaces[DeclarationSpaces["None"] = 0] = "None"; + DeclarationSpaces[DeclarationSpaces["ExportValue"] = 1] = "ExportValue"; + DeclarationSpaces[DeclarationSpaces["ExportType"] = 2] = "ExportType"; + DeclarationSpaces[DeclarationSpaces["ExportNamespace"] = 4] = "ExportNamespace"; + })(DeclarationSpaces || (DeclarationSpaces = {})); function getDeclarationSpaces(d) { switch (d.kind) { case 230: - return 2097152; + case 231: + return 2; case 233: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 - ? 4194304 | 1048576 - : 4194304; + ? 4 | 1 + : 4; case 229: case 232: - return 2097152 | 1048576; + case 240: + return 2 | 1; case 237: var result_3 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_3 |= getDeclarationSpaces(d); }); return result_3; + case 226: + case 176: + case 228: + case 242: + return 1; default: - return 1048576; + ts.Debug.fail(ts.SyntaxKind[d.kind]); } } } @@ -39056,7 +36072,7 @@ var ts; if (isTypeAny(thenFunction)) { return undefined; } - var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0) : emptyArray; + var thenSignatures = thenFunction ? getSignaturesOfType(thenFunction, 0) : ts.emptyArray; if (thenSignatures.length === 0) { if (errorNode) { error(errorNode, ts.Diagnostics.A_promise_must_have_a_then_method); @@ -39150,7 +36166,7 @@ var ts; var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 107455, true); var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : unknownType; if (promiseConstructorType === unknownType) { - if (promiseConstructorName.kind === 71 && promiseConstructorName.text === "Promise" && getTargetType(returnType) === getGlobalPromiseType(false)) { + if (promiseConstructorName.kind === 71 && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(false)) { error(returnTypeNode, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option); } else { @@ -39167,9 +36183,9 @@ var ts; return unknownType; } var rootName = promiseConstructorName && getFirstIdentifier(promiseConstructorName); - var collidingSymbol = getSymbol(node.locals, rootName.text, 107455); + var collidingSymbol = getSymbol(node.locals, rootName.escapedText, 107455); if (collidingSymbol) { - error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, rootName.text, ts.entityNameToString(promiseConstructorName)); + error(collidingSymbol.valueDeclaration, ts.Diagnostics.Duplicate_identifier_0_Compiler_uses_declaration_1_to_support_async_functions, ts.unescapeLeadingUnderscores(rootName.escapedText), ts.entityNameToString(promiseConstructorName)); return unknownType; } } @@ -39213,9 +36229,9 @@ var ts; } function markEntityNameOrEntityExpressionAsReference(typeName) { var rootName = typeName && getFirstIdentifier(typeName); - var rootSymbol = rootName && resolveName(rootName, rootName.text, (typeName.kind === 71 ? 793064 : 1920) | 8388608, undefined, undefined); + var rootSymbol = rootName && resolveName(rootName, rootName.escapedText, (typeName.kind === 71 ? 793064 : 1920) | 2097152, undefined, undefined); if (rootSymbol - && rootSymbol.flags & 8388608 + && rootSymbol.flags & 2097152 && symbolIsValue(rootSymbol) && !isConstEnumOrConstEnumOnlyModule(resolveAlias(rootSymbol))) { markAliasSymbolAsReferenced(rootSymbol); @@ -39242,7 +36258,7 @@ var ts; if (commonEntityName) { if (!ts.isIdentifier(commonEntityName) || !ts.isIdentifier(individualEntityName) || - commonEntityName.text !== individualEntityName.text) { + commonEntityName.escapedText !== individualEntityName.escapedText) { return undefined; } } @@ -39319,7 +36335,22 @@ var ts; checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); } } + function checkJSDoc(node) { + if (!ts.isInJavaScriptFile(node)) { + return; + } + ts.forEach(node.jsDoc, checkSourceElement); + } + function checkJSDocComment(node) { + if (node.tags) { + for (var _i = 0, _a = node.tags; _i < _a.length; _i++) { + var tag = _a[_i]; + checkSourceElement(tag); + } + } + } function checkFunctionOrMethodDeclaration(node) { + checkJSDoc(node); checkDecorators(node); checkSignatureDeclaration(node); var functionFlags = ts.getFunctionFlags(node); @@ -39329,8 +36360,7 @@ var ts; if (!ts.hasDynamicName(node)) { var symbol = getSymbolOfNode(node); var localSymbol = node.localSymbol || symbol; - var firstDeclaration = ts.forEach(localSymbol.declarations, function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)) ? - declaration : undefined; }); + var firstDeclaration = ts.find(localSymbol.declarations, function (declaration) { return declaration.kind === node.kind && !ts.isSourceFileJavaScript(ts.getSourceFileOfNode(declaration)); }); if (node === firstDeclaration) { checkFunctionOrConstructorSymbol(localSymbol); } @@ -39407,6 +36437,9 @@ var ts; case 161: checkUnusedTypeParameters(node); break; + case 231: + checkUnusedTypeParameters(node); + break; } } } @@ -39422,11 +36455,11 @@ var ts; !ts.isParameterPropertyDeclaration(parameter) && !ts.parameterIsThisKeyword(parameter) && !parameterNameStartsWithUnderscore(name)) { - error(name, ts.Diagnostics._0_is_declared_but_never_used, local.name); + error(name, ts.Diagnostics._0_is_declared_but_never_used, ts.unescapeLeadingUnderscores(local.escapedName)); } } else if (compilerOptions.noUnusedLocals) { - ts.forEach(local.declarations, function (d) { return errorUnusedLocal(ts.getNameOfDeclaration(d) || d, local.name); }); + ts.forEach(local.declarations, function (d) { return errorUnusedLocal(ts.getNameOfDeclaration(d) || d, ts.unescapeLeadingUnderscores(local.escapedName)); }); } } }); @@ -39454,7 +36487,7 @@ var ts; return parameterName && isIdentifierThatStartsWithUnderScore(parameterName); } function isIdentifierThatStartsWithUnderScore(node) { - return node.kind === 71 && node.text.charCodeAt(0) === 95; + return node.kind === 71 && ts.unescapeLeadingUnderscores(node.escapedText).charCodeAt(0) === 95; } function checkUnusedClassMembers(node) { if (compilerOptions.noUnusedLocals && !ts.isInAmbientContext(node)) { @@ -39462,15 +36495,15 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (member.kind === 151 || member.kind === 149) { - if (!member.symbol.isReferenced && ts.getModifierFlags(member) & 8) { - error(member.name, ts.Diagnostics._0_is_declared_but_never_used, member.symbol.name); + if (!member.symbol.isReferenced && ts.hasModifier(member, 8)) { + error(member.name, ts.Diagnostics._0_is_declared_but_never_used, ts.unescapeLeadingUnderscores(member.symbol.escapedName)); } } else if (member.kind === 152) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; - if (!parameter.symbol.isReferenced && ts.getModifierFlags(parameter) & 8) { - error(parameter.name, ts.Diagnostics.Property_0_is_declared_but_never_used, parameter.symbol.name); + if (!parameter.symbol.isReferenced && ts.hasModifier(parameter, 8)) { + error(parameter.name, ts.Diagnostics.Property_0_is_declared_but_never_used, ts.unescapeLeadingUnderscores(parameter.symbol.escapedName)); } } } @@ -39489,7 +36522,7 @@ var ts; for (var _i = 0, _a = node.typeParameters; _i < _a.length; _i++) { var typeParameter = _a[_i]; if (!getMergedSymbol(typeParameter.symbol).isReferenced) { - error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, typeParameter.symbol.name); + error(typeParameter.name, ts.Diagnostics._0_is_declared_but_never_used, ts.unescapeLeadingUnderscores(typeParameter.symbol.escapedName)); } } } @@ -39502,7 +36535,7 @@ var ts; for (var _i = 0, _a = local.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; if (!ts.isAmbientModule(declaration)) { - errorUnusedLocal(ts.getNameOfDeclaration(declaration), local.name); + errorUnusedLocal(ts.getNameOfDeclaration(declaration), ts.unescapeLeadingUnderscores(local.escapedName)); } } } @@ -39523,13 +36556,13 @@ var ts; return; } ts.forEach(node.parameters, function (p) { - if (p.name && !ts.isBindingPattern(p.name) && p.name.text === argumentsSymbol.name) { + if (p.name && !ts.isBindingPattern(p.name) && p.name.escapedText === argumentsSymbol.escapedName) { error(p, ts.Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters); } }); } function needCollisionCheckForIdentifier(node, identifier, name) { - if (!(identifier && identifier.text === name)) { + if (!(identifier && identifier.escapedText === name)) { return false; } if (node.kind === 149 || @@ -39641,7 +36674,9 @@ var ts; } var symbol = getSymbolOfNode(node); if (symbol.flags & 1) { - var localDeclarationSymbol = resolveName(node, node.name.text, 3, undefined, undefined); + if (!ts.isIdentifier(node.name)) + throw ts.Debug.fail(); + var localDeclarationSymbol = resolveName(node, node.name.escapedText, 3, undefined, undefined); if (localDeclarationSymbol && localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { @@ -39677,7 +36712,7 @@ var ts; return visit(n.expression); } else if (n.kind === 71) { - var symbol = resolveName(n, n.text, 107455 | 8388608, undefined, undefined); + var symbol = resolveName(n, n.escapedText, 107455 | 2097152, undefined, undefined); if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) { return; } @@ -39718,6 +36753,9 @@ var ts; function checkVariableLikeDeclaration(node) { checkDecorators(node); checkSourceElement(node.type); + if (!node.name) { + return; + } if (node.name.kind === 144) { checkComputedPropertyName(node.name); if (node.initializer) { @@ -39804,7 +36842,7 @@ var ts; 128 | 64 | 32; - return (ts.getModifierFlags(left) & interestingFlags) === (ts.getModifierFlags(right) & interestingFlags); + return ts.getSelectedModifierFlags(left, interestingFlags) === ts.getSelectedModifierFlags(right, interestingFlags); } function checkVariableDeclaration(node) { checkGrammarVariableDeclaration(node); @@ -39934,7 +36972,7 @@ var ts; checkReferenceExpression(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_a_variable_or_a_property_access); } } - if (!isTypeAnyOrAllConstituentTypesHaveKind(rightType, 32768 | 540672 | 16777216)) { + if (!isTypeAssignableToKind(rightType, 16777216 | 540672)) { error(node.expression, ts.Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } checkSourceElement(node.statement); @@ -40087,7 +37125,7 @@ var ts; if (isTypeAny(nextMethod)) { return undefined; } - var nextMethodSignatures = nextMethod ? getSignaturesOfType(nextMethod, 0) : emptyArray; + var nextMethodSignatures = nextMethod ? getSignaturesOfType(nextMethod, 0) : ts.emptyArray; if (nextMethodSignatures.length === 0) { if (errorNode) { error(errorNode, isAsyncIterator @@ -40242,7 +37280,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 222 && current.label.text === node.label.text) { + if (current.kind === 222 && current.label.escapedText === node.label.escapedText) { var sourceFile = ts.getSourceFileOfNode(node); grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNodeFromSourceText(sourceFile.text, node.label)); return true; @@ -40306,7 +37344,7 @@ var ts; var classDeclaration = type.symbol.valueDeclaration; for (var _i = 0, _a = classDeclaration.members; _i < _a.length; _i++) { var member = _a[_i]; - if (!(ts.getModifierFlags(member) & 32) && ts.hasDynamicName(member)) { + if (!ts.hasModifier(member, 32) && ts.hasDynamicName(member)) { var propType = getTypeOfSymbol(member.symbol); checkIndexConstraintForProperty(member.symbol, propType, type, declaredStringIndexer, stringIndexType, 0); checkIndexConstraintForProperty(member.symbol, propType, type, declaredNumberIndexer, numberIndexType, 1); @@ -40330,7 +37368,7 @@ var ts; return; } var propDeclaration = prop.valueDeclaration; - if (indexKind === 1 && !(propDeclaration ? isNumericName(ts.getNameOfDeclaration(propDeclaration)) : isNumericLiteralName(prop.name))) { + if (indexKind === 1 && !(propDeclaration ? isNumericName(ts.getNameOfDeclaration(propDeclaration)) : isNumericLiteralName(prop.escapedName))) { return; } var errorNode; @@ -40344,7 +37382,7 @@ var ts; errorNode = indexDeclaration; } else if (getObjectFlags(containingType) & 2) { - var someBaseClassHasBothPropertyAndIndexer = ts.forEach(getBaseTypes(containingType), function (base) { return getPropertyOfObjectType(base, prop.name) && getIndexTypeOfType(base, indexKind); }); + var someBaseClassHasBothPropertyAndIndexer = ts.forEach(getBaseTypes(containingType), function (base) { return getPropertyOfObjectType(base, prop.escapedName) && getIndexTypeOfType(base, indexKind); }); errorNode = someBaseClassHasBothPropertyAndIndexer ? undefined : containingType.symbol.declarations[0]; } if (errorNode && !isTypeAssignableTo(propertyType, indexType)) { @@ -40356,7 +37394,7 @@ var ts; } } function checkTypeNameIsReserved(name, message) { - switch (name.text) { + switch (name.escapedText) { case "any": case "number": case "boolean": @@ -40364,7 +37402,7 @@ var ts; case "symbol": case "void": case "object": - error(name, message, name.text); + error(name, message, name.escapedText); } } function checkTypeParameters(typeParameterDeclarations) { @@ -40403,8 +37441,8 @@ var ts; var type = getDeclaredTypeOfSymbol(symbol); if (!areTypeParametersIdentical(declarations, type.localTypeParameters)) { var name = symbolToString(symbol); - for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { - var declaration = declarations_6[_i]; + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { + var declaration = declarations_5[_i]; error(declaration.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_type_parameters, name); } } @@ -40413,8 +37451,8 @@ var ts; function areTypeParametersIdentical(declarations, typeParameters) { var maxTypeArgumentCount = ts.length(typeParameters); var minTypeArgumentCount = getMinTypeArgumentCount(typeParameters); - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; var numTypeParameters = ts.length(declaration.typeParameters); if (numTypeParameters < minTypeArgumentCount || numTypeParameters > maxTypeArgumentCount) { return false; @@ -40422,7 +37460,7 @@ var ts; for (var i = 0; i < numTypeParameters; i++) { var source = declaration.typeParameters[i]; var target = typeParameters[i]; - if (source.name.text !== target.symbol.name) { + if (source.name.escapedText !== target.symbol.escapedName) { return false; } var sourceConstraint = source.constraint && getTypeFromTypeNode(source.constraint); @@ -40450,7 +37488,7 @@ var ts; registerForUnusedIdentifiersCheck(node); } function checkClassDeclaration(node) { - if (!node.name && !(ts.getModifierFlags(node) & 512)) { + if (!node.name && !ts.hasModifier(node, 512)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -40543,7 +37581,7 @@ var ts; var signatures = getSignaturesOfType(type, 1); if (signatures.length) { var declaration = signatures[0].declaration; - if (declaration && ts.getModifierFlags(declaration) & 8) { + if (declaration && ts.hasModifier(declaration, 8)) { var typeClassDeclaration = getClassLikeDeclarationOfSymbol(type.symbol); if (!isNodeWithinClass(node, typeClassDeclaration)) { error(node, ts.Diagnostics.Cannot_extend_a_class_0_Class_constructor_is_marked_as_private, getFullyQualifiedName(type.symbol)); @@ -40567,16 +37605,16 @@ var ts; for (var _i = 0, baseProperties_1 = baseProperties; _i < baseProperties_1.length; _i++) { var baseProperty = baseProperties_1[_i]; var base = getTargetSymbol(baseProperty); - if (base.flags & 16777216) { + if (base.flags & 4194304) { continue; } - var derived = getTargetSymbol(getPropertyOfObjectType(type, base.name)); + var derived = getTargetSymbol(getPropertyOfObjectType(type, base.escapedName)); var baseDeclarationFlags = ts.getDeclarationModifierFlagsFromSymbol(base); ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived) { if (derived === base) { var derivedClassDecl = getClassLikeDeclarationOfSymbol(type.symbol); - if (baseDeclarationFlags & 128 && (!derivedClassDecl || !(ts.getModifierFlags(derivedClassDecl) & 128))) { + if (baseDeclarationFlags & 128 && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128))) { if (derivedClassDecl.kind === 199) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } @@ -40618,17 +37656,17 @@ var ts; if (baseTypes.length < 2) { return true; } - var seen = ts.createMap(); - ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.name, { prop: p, containingType: type }); }); + var seen = ts.createUnderscoreEscapedMap(); + ts.forEach(resolveDeclaredMembers(type).declaredProperties, function (p) { seen.set(p.escapedName, { prop: p, containingType: type }); }); var ok = true; for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) { var base = baseTypes_2[_i]; var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType)); for (var _a = 0, properties_8 = properties; _a < properties_8.length; _a++) { var prop = properties_8[_a]; - var existing = seen.get(prop.name); + var existing = seen.get(prop.escapedName); if (!existing) { - seen.set(prop.name, { prop: prop, containingType: base }); + seen.set(prop.escapedName, { prop: prop, containingType: base }); } else { var isInheritedProperty = existing.containingType !== type; @@ -40684,6 +37722,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkTypeParameters(node.typeParameters); checkSourceElement(node.type); + registerForUnusedIdentifiersCheck(node); } function computeEnumMemberValues(node) { var nodeLinks = getNodeLinks(node); @@ -40785,15 +37824,22 @@ var ts; case 185: return evaluate(expr.expression); case 71: - return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), expr.text); + return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), expr.escapedText); case 180: case 179: - if (isConstantMemberAccess(expr)) { - var type = getTypeOfExpression(expr.expression); + var ex = expr; + if (isConstantMemberAccess(ex)) { + var type = getTypeOfExpression(ex.expression); if (type.symbol && type.symbol.flags & 384) { - var name = expr.kind === 179 ? - expr.name.text : - expr.argumentExpression.text; + var name = void 0; + if (ex.kind === 179) { + name = ex.name.escapedText; + } + else { + var argument = ex.argumentExpression; + ts.Debug.assert(ts.isLiteralExpression(argument)); + name = ts.escapeLeadingUnderscores(argument.text); + } return evaluateEnumMember(expr, type.symbol, name); } } @@ -40871,8 +37917,8 @@ var ts; } function getFirstNonAmbientClassOrFunctionDeclaration(symbol) { var declarations = symbol.declarations; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; if ((declaration.kind === 229 || (declaration.kind === 228 && ts.nodeIsPresent(declaration.body))) && !ts.isInAmbientContext(declaration)) { @@ -40923,7 +37969,7 @@ var ts; if (symbol.flags & 512 && symbol.declarations.length > 1 && !inAmbientContext - && ts.isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) { + && isInstantiatedModule(node, compilerOptions.preserveConstEnums || compilerOptions.isolatedModules)) { var firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol); if (firstNonAmbientClassOrFunc) { if (ts.getSourceFileOfNode(node) !== ts.getSourceFileOfNode(firstNonAmbientClassOrFunc)) { @@ -40941,7 +37987,7 @@ var ts; } if (isAmbientExternalModule) { if (ts.isExternalModuleAugmentation(node)) { - var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 134217728); + var checkBody = isGlobalAugmentation || (getSymbolOfNode(node).flags & 33554432); if (checkBody && node.body) { for (var _i = 0, _a = node.body.statements; _i < _a.length; _i++) { var statement = _a[_i]; @@ -40953,7 +37999,7 @@ var ts; if (isGlobalAugmentation) { error(node.name, ts.Diagnostics.Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_declarations); } - else if (ts.isExternalModuleNameRelative(node.name.text)) { + else if (ts.isExternalModuleNameRelative(ts.getTextOfIdentifierOrLiteral(node.name))) { error(node.name, ts.Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name); } } @@ -41011,7 +38057,7 @@ var ts; } var symbol = getSymbolOfNode(node); if (symbol) { - var reportError = !(symbol.flags & 134217728); + var reportError = !(symbol.flags & 33554432); if (!reportError) { reportError = ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); } @@ -41048,7 +38094,7 @@ var ts; ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; } - if (inAmbientExternalModule && ts.isExternalModuleNameRelative(moduleName.text)) { + if (inAmbientExternalModule && ts.isExternalModuleNameRelative(ts.getTextOfIdentifierOrLiteral(moduleName))) { if (!isTopLevelInExternalModuleAugmentation(node)) { error(node, ts.Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name); return false; @@ -41087,7 +38133,7 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_import_declaration_can_only_be_used_in_a_namespace_or_module)) { return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.hasModifiers(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_import_declaration_cannot_have_modifiers); } if (checkExternalImportOrExportDeclaration(node)) { @@ -41114,7 +38160,7 @@ var ts; checkGrammarDecorators(node) || checkGrammarModifiers(node); if (ts.isInternalModuleImportEqualsDeclaration(node) || checkExternalImportOrExportDeclaration(node)) { checkImportBinding(node); - if (ts.getModifierFlags(node) & 1) { + if (ts.hasModifier(node, 1)) { markExportAsReferenced(node); } if (ts.isInternalModuleImportEqualsDeclaration(node)) { @@ -41142,7 +38188,7 @@ var ts; if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_declaration_can_only_be_used_in_a_module)) { return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.hasModifiers(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_declaration_cannot_have_modifiers); } if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { @@ -41177,9 +38223,9 @@ var ts; checkAliasSymbol(node); if (!node.parent.parent.moduleSpecifier) { var exportedName = node.propertyName || node.name; - var symbol = resolveName(exportedName, exportedName.text, 107455 | 793064 | 1920 | 8388608, undefined, undefined); + var symbol = resolveName(exportedName, exportedName.escapedText, 107455 | 793064 | 1920 | 2097152, undefined, undefined); if (symbol && (symbol === undefinedSymbol || isGlobalSourceFile(getDeclarationContainer(symbol.declarations[0])))) { - error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, exportedName.text); + error(exportedName, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, ts.unescapeLeadingUnderscores(exportedName.escapedText)); } else { markExportAsReferenced(node); @@ -41200,7 +38246,7 @@ var ts; } return; } - if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.getModifierFlags(node) !== 0) { + if (!checkGrammarDecorators(node) && !checkGrammarModifiers(node) && ts.hasModifiers(node)) { grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers); } if (node.expression.kind === 71) { @@ -41247,10 +38293,10 @@ var ts; return; } if (exportedDeclarationsCount > 1) { - for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { - var declaration = declarations_9[_i]; + for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { + var declaration = declarations_8[_i]; if (isNotOverload(declaration)) { - diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, id)); + diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Cannot_redeclare_exported_variable_0, ts.unescapeLeadingUnderscores(id))); } } } @@ -41317,6 +38363,23 @@ var ts; case 168: case 170: return checkSourceElement(node.type); + case 275: + return checkJSDocComment(node); + case 279: + return checkSourceElement(node.typeExpression); + case 273: + checkSignatureDeclaration(node); + case 274: + case 271: + case 270: + case 268: + case 269: + if (!ts.isInJavaScriptFile(node) && !ts.isInJSDoc(node)) { + grammarErrorOnNode(node, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); + } + return; + case 267: + return checkSourceElement(node.type); case 171: return checkIndexedAccessType(node); case 172: @@ -41427,8 +38490,8 @@ var ts; return; } checkGrammarSourceFile(node); - potentialThisCollisions.length = 0; - potentialNewTargetCollisions.length = 0; + ts.clear(potentialThisCollisions); + ts.clear(potentialNewTargetCollisions); deferredNodes = []; deferredUnusedIdentifierNodes = produceDiagnostics && noUnusedIdentifiers ? [] : undefined; ts.forEach(node.statements, checkSourceElement); @@ -41446,11 +38509,11 @@ var ts; } if (potentialThisCollisions.length) { ts.forEach(potentialThisCollisions, checkIfThisIsCapturedInEnclosingScope); - potentialThisCollisions.length = 0; + ts.clear(potentialThisCollisions); } if (potentialNewTargetCollisions.length) { ts.forEach(potentialNewTargetCollisions, checkIfNewTargetIsCapturedInEnclosingScope); - potentialNewTargetCollisions.length = 0; + ts.clear(potentialNewTargetCollisions); } links.flags |= 1; } @@ -41508,8 +38571,8 @@ var ts; if (isInsideWithStatementBody(location)) { return []; } - var symbols = ts.createMap(); - var memberFlags = 0; + var symbols = ts.createSymbolTable(); + var isStatic = false; populateSymbols(); return symbolsToArray(symbols); function populateSymbols() { @@ -41518,12 +38581,8 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 265: - if (!ts.isExternalOrCommonJsModule(location)) { - break; - } case 233: - copySymbols(getSymbolOfNode(location).exports, meaning & 8914931); + copySymbols(getSymbolOfNode(location).exports, meaning & 2623475); break; case 232: copySymbols(getSymbolOfNode(location).exports, meaning & 8); @@ -41535,7 +38594,7 @@ var ts; } case 229: case 230: - if (!(memberFlags & 32)) { + if (!isStatic) { copySymbols(getSymbolOfNode(location).members, meaning & 793064); } break; @@ -41549,14 +38608,14 @@ var ts; if (ts.introducesArgumentsExoticObject(location)) { copySymbol(argumentsSymbol, meaning); } - memberFlags = ts.getModifierFlags(location); + isStatic = ts.hasModifier(location, 32); location = location.parent; } copySymbols(globals, meaning); } function copySymbol(symbol, meaning) { - if (symbol.flags & meaning) { - var id = symbol.name; + if (ts.getCombinedLocalAndExportSymbolFlags(symbol) & meaning) { + var id = symbol.escapedName; if (!symbols.has(id)) { symbols.set(id, symbol); } @@ -41590,7 +38649,7 @@ var ts; while (node.parent && node.parent.kind === 143) { node = node.parent; } - return node.parent && (node.parent.kind === 159 || node.parent.kind === 277); + return node.parent && node.parent.kind === 159; } function isHeritageClauseElementIdentifier(entityName) { var node = entityName; @@ -41653,7 +38712,7 @@ var ts; } } if (entityName.parent.kind === 243 && ts.isEntityNameExpression(entityName)) { - return resolveEntityName(entityName, 107455 | 793064 | 1920 | 8388608); + return resolveEntityName(entityName, 107455 | 793064 | 1920 | 2097152); } if (entityName.kind !== 179 && isInRightSideOfImportOrExportAssignment(entityName)) { var importEqualsDeclaration = ts.getAncestor(entityName, 237); @@ -41674,17 +38733,16 @@ var ts; else { meaning = 1920; } - meaning |= 8388608; + meaning |= 2097152; var entityNameSymbol = resolveEntityName(entityName, meaning); if (entityNameSymbol) { return entityNameSymbol; } } - if (entityName.parent.kind === 287) { - var parameter = ts.getParameterFromJSDoc(entityName.parent); - return parameter && parameter.symbol; + if (entityName.parent.kind === 279) { + return ts.getParameterSymbolFromJSDoc(entityName.parent); } - if (entityName.parent.kind === 145 && entityName.parent.parent.kind === 290) { + if (entityName.parent.kind === 145 && entityName.parent.parent.kind === 282) { ts.Debug.assert(!ts.isInJavaScriptFile(entityName)); var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent); return typeParameter && typeParameter.symbol; @@ -41699,23 +38757,22 @@ var ts; } return resolveEntityName(entityName, 107455, false, true); } - else if (entityName.kind === 179) { - var symbol = getNodeLinks(entityName).resolvedSymbol; - if (!symbol) { + else if (entityName.kind === 179 || entityName.kind === 143) { + var links = getNodeLinks(entityName); + if (links.resolvedSymbol) { + return links.resolvedSymbol; + } + if (entityName.kind === 179) { checkPropertyAccessExpression(entityName); } - return getNodeLinks(entityName).resolvedSymbol; - } - else if (entityName.kind === 143) { - var symbol = getNodeLinks(entityName).resolvedSymbol; - if (!symbol) { + else { checkQualifiedName(entityName); } - return getNodeLinks(entityName).resolvedSymbol; + return links.resolvedSymbol; } } else if (isTypeReferenceIdentifier(entityName)) { - var meaning = (entityName.parent.kind === 159 || entityName.parent.kind === 277) ? 793064 : 1920; + var meaning = entityName.parent.kind === 159 ? 793064 : 1920; return resolveEntityName(entityName, meaning, false, true); } else if (entityName.parent.kind === 253) { @@ -41747,7 +38804,7 @@ var ts; node.parent.parent.kind === 174 && node === node.parent.propertyName) { var typeOfPattern = getTypeOfNode(node.parent.parent); - var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.text); + var propertyDeclaration = typeOfPattern && getPropertyOfType(typeOfPattern, node.escapedText); if (propertyDeclaration) { return propertyDeclaration; } @@ -41799,14 +38856,14 @@ var ts; } function getShorthandAssignmentValueSymbol(location) { if (location && location.kind === 262) { - return resolveEntityName(location.name, 107455 | 8388608); + return resolveEntityName(location.name, 107455 | 2097152); } return undefined; } function getExportSpecifierLocalTargetSymbol(node) { return node.parent.parent.moduleSpecifier ? getExternalModuleMember(node.parent.parent, node) : - resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920 | 8388608); + resolveEntityName(node.propertyName || node.name, 107455 | 793064 | 1920 | 2097152); } function getTypeOfNode(node) { if (isInsideWithStatementBody(node)) { @@ -41877,7 +38934,7 @@ var ts; } function getPropertySymbolOfDestructuringAssignment(location) { var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent); - return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.text); + return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText); } function getRegularTypeOfExpression(expr) { if (ts.isRightSideOfQualifiedNameOrPropertyAccess(expr)) { @@ -41887,17 +38944,17 @@ var ts; } function getParentTypeOfClassElement(node) { var classSymbol = getSymbolOfNode(node.parent); - return ts.getModifierFlags(node) & 32 + return ts.hasModifier(node, 32) ? getTypeOfSymbol(classSymbol) : getDeclaredTypeOfSymbol(classSymbol); } function getAugmentedPropertiesOfType(type) { type = getApparentType(type); - var propsByName = createSymbolTable(getPropertiesOfType(type)); + var propsByName = ts.createSymbolTable(getPropertiesOfType(type)); if (getSignaturesOfType(type, 0).length || getSignaturesOfType(type, 1).length) { ts.forEach(getPropertiesOfType(globalFunctionType), function (p) { - if (!propsByName.has(p.name)) { - propsByName.set(p.name, p); + if (!propsByName.has(p.escapedName)) { + propsByName.set(p.escapedName, p); } }); } @@ -41906,7 +38963,7 @@ var ts; function getRootSymbols(symbol) { if (ts.getCheckFlags(symbol) & 6) { var symbols_4 = []; - var name_2 = symbol.name; + var name_2 = symbol.escapedName; ts.forEach(getSymbolLinks(symbol).containingType.types, function (t) { var symbol = getPropertyOfType(t, name_2); if (symbol) { @@ -41915,7 +38972,7 @@ var ts; }); return symbols_4; } - else if (symbol.flags & 134217728) { + else if (symbol.flags & 33554432) { var transient = symbol; if (transient.leftSpread) { return getRootSymbols(transient.leftSpread).concat(getRootSymbols(transient.rightSpread)); @@ -42009,7 +39066,7 @@ var ts; var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); if (ts.isStatementWithLocals(container)) { var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration); - if (!!resolveName(container.parent, symbol.name, 107455, undefined, undefined)) { + if (!!resolveName(container.parent, symbol.escapedName, 107455, undefined, undefined)) { links.isDeclarationWithCollidingName = true; } else if (nodeLinks_1.flags & 131072) { @@ -42112,13 +39169,13 @@ var ts; return strictNullChecks && !isOptionalParameter(parameter) && parameter.initializer && - !(ts.getModifierFlags(parameter) & 92); + !ts.hasModifier(parameter, 92); } function isOptionalUninitializedParameterProperty(parameter) { return strictNullChecks && isOptionalParameter(parameter) && !parameter.initializer && - !!(ts.getModifierFlags(parameter) & 92); + ts.hasModifier(parameter, 92); } function getNodeCheckFlags(node) { return getNodeLinks(node).flags; @@ -42152,6 +39209,14 @@ var ts; return type.flags & 32768 && getSignaturesOfType(type, 0).length > 0; } function getTypeReferenceSerializationKind(typeName, location) { + typeName = ts.getParseTreeNode(typeName, ts.isEntityName); + if (!typeName) + return ts.TypeReferenceSerializationKind.Unknown; + if (location) { + location = ts.getParseTreeNode(location); + if (!location) + return ts.TypeReferenceSerializationKind.Unknown; + } var valueSymbol = resolveEntityName(typeName, 107455, true, false, location); var typeSymbol = resolveEntityName(typeName, 793064, true, false, location); if (valueSymbol && valueSymbol === typeSymbol) { @@ -42174,22 +39239,22 @@ var ts; else if (type.flags & 1) { return ts.TypeReferenceSerializationKind.ObjectType; } - else if (isTypeOfKind(type, 1024 | 6144 | 8192)) { + else if (isTypeAssignableToKind(type, 1024 | 6144 | 8192)) { return ts.TypeReferenceSerializationKind.VoidNullableOrNeverType; } - else if (isTypeOfKind(type, 136)) { + else if (isTypeAssignableToKind(type, 136)) { return ts.TypeReferenceSerializationKind.BooleanType; } - else if (isTypeOfKind(type, 84)) { + else if (isTypeAssignableToKind(type, 84)) { return ts.TypeReferenceSerializationKind.NumberLikeType; } - else if (isTypeOfKind(type, 262178)) { + else if (isTypeAssignableToKind(type, 262178)) { return ts.TypeReferenceSerializationKind.StringLikeType; } else if (isTupleType(type)) { return ts.TypeReferenceSerializationKind.ArrayLikeType; } - else if (isTypeOfKind(type, 512)) { + else if (isTypeAssignableToKind(type, 512)) { return ts.TypeReferenceSerializationKind.ESSymbolType; } else if (isFunctionType(type)) { @@ -42221,7 +39286,7 @@ var ts; getSymbolDisplayBuilder().buildTypeDisplay(type, writer, enclosingDeclaration, flags); } function hasGlobalName(name) { - return globals.has(name); + return globals.has(ts.escapeLeadingUnderscores(name)); } function getReferencedValueSymbol(reference, startInDeclarationContainer) { var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; @@ -42235,7 +39300,7 @@ var ts; location = getDeclarationContainer(parent); } } - return resolveName(location, reference.text, 107455 | 1048576 | 8388608, undefined, undefined); + return resolveName(location, reference.escapedText, 107455 | 1048576 | 2097152, undefined, undefined); } function getReferencedValueDeclaration(reference) { if (!ts.isGeneratedIdentifier(reference)) { @@ -42264,7 +39329,7 @@ var ts; var resolvedTypeReferenceDirectives = host.getResolvedTypeReferenceDirectives(); var fileToDirective; if (resolvedTypeReferenceDirectives) { - fileToDirective = ts.createFileMap(); + fileToDirective = ts.createMap(); resolvedTypeReferenceDirectives.forEach(function (resolvedDirective, key) { if (!resolvedDirective) { return; @@ -42371,7 +39436,7 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; var file = ts.getSourceFileOfNode(decl); - if (fileToDirective.contains(file.path)) { + if (fileToDirective.has(file.path)) { return true; } } @@ -42448,7 +39513,7 @@ var ts; for (var helper = 1; helper <= 32768; helper <<= 1) { if (uncheckedHelpers & helper) { var name = getHelperName(helper); - var symbol = getSymbol(helpersModule.exports, ts.escapeIdentifier(name), 107455); + var symbol = getSymbol(helpersModule.exports, ts.escapeLeadingUnderscores(name), 107455); if (!symbol) { error(location, ts.Diagnostics.This_syntax_requires_an_imported_helper_named_1_but_module_0_has_no_exported_member_1, ts.externalHelpersModuleNameText, name); } @@ -42617,6 +39682,13 @@ var ts; } flags |= 1; break; + case 79: + var container = node.parent.kind === 265 ? node.parent : node.parent.parent; + if (container.kind === 233 && !ts.isAmbientModule(container)) { + return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); + } + flags |= 512; + break; case 124: if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); @@ -42647,7 +39719,7 @@ var ts; node.kind !== 154) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 229 && ts.getModifierFlags(node.parent) & 128)) { + if (!(node.parent.kind === 229 && ts.hasModifier(node.parent, 128))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -42843,7 +39915,7 @@ var ts; if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, ts.Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - if (ts.getModifierFlags(parameter) !== 0) { + if (ts.hasModifiers(parameter)) { return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } if (parameter.questionToken) { @@ -42880,8 +39952,8 @@ var ts; function checkGrammarForOmittedArgument(node, args) { if (args) { var sourceFile = ts.getSourceFileOfNode(node); - for (var _i = 0, args_4 = args; _i < args_4.length; _i++) { - var arg = args_4[_i]; + for (var _i = 0, args_5 = args; _i < args_5.length; _i++) { + var arg = args_5[_i]; if (arg.kind === 200) { return grammarErrorAtPos(sourceFile, arg.pos, 0, ts.Diagnostics.Argument_expression_expected); } @@ -42983,7 +40055,7 @@ var ts; } } function checkGrammarObjectLiteralExpression(node, inDestructuring) { - var seen = ts.createMap(); + var seen = ts.createUnderscoreEscapedMap(); var Property = 1; var GetAccessor = 2; var SetAccessor = 4; @@ -43055,7 +40127,7 @@ var ts; } } function checkGrammarJsxElement(node) { - var seen = ts.createMap(); + var seen = ts.createUnderscoreEscapedMap(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; if (attr.kind === 255) { @@ -43063,8 +40135,8 @@ var ts; } var jsxAttr = attr; var name = jsxAttr.name; - if (!seen.get(name.text)) { - seen.set(name.text, true); + if (!seen.get(name.escapedText)) { + seen.set(name.escapedText, true); } else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); @@ -43122,10 +40194,10 @@ var ts; else if (ts.isInAmbientContext(accessor)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_be_declared_in_an_ambient_context); } - else if (accessor.body === undefined && !(ts.getModifierFlags(accessor) & 128)) { + else if (accessor.body === undefined && !ts.hasModifier(accessor, 128)) { return grammarErrorAtPos(ts.getSourceFileOfNode(accessor), accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } - else if (accessor.body && ts.getModifierFlags(accessor) & 128) { + else if (accessor.body && ts.hasModifier(accessor, 128)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } else if (accessor.typeParameters) { @@ -43204,7 +40276,7 @@ var ts; } switch (current.kind) { case 222: - if (node.label && current.label.text === node.label.text) { + if (node.label && current.label.escapedText === node.label.escapedText) { var isMisplacedContinueLabel = node.kind === 217 && !ts.isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { @@ -43295,7 +40367,7 @@ var ts; } function checkESModuleMarker(name) { if (name.kind === 71) { - if (ts.unescapeIdentifier(name.text) === "__esModule") { + if (ts.unescapeLeadingUnderscores(name.escapedText) === "__esModule") { return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); } } @@ -43361,8 +40433,8 @@ var ts; } function checkGrammarMetaProperty(node) { if (node.keywordToken === 94) { - if (node.name.text !== "target") { - return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.text, ts.tokenToString(node.keywordToken), "target"); + if (node.name.escapedText !== "target") { + return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "target"); } } } @@ -43434,7 +40506,7 @@ var ts; node.kind === 244 || node.kind === 243 || node.kind === 236 || - ts.getModifierFlags(node) & (2 | 1 | 512)) { + ts.hasModifier(node, 2 | 1 | 512)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file); @@ -43501,7 +40573,7 @@ var ts; function getAmbientModules() { var result = []; globals.forEach(function (global, sym) { - if (ambientModuleSymbolRegex.test(sym)) { + if (ambientModuleSymbolRegex.test(ts.unescapeLeadingUnderscores(sym))) { result.push(global); } }); @@ -43533,6 +40605,3460 @@ var ts; return ts.isDeclarationName(name); } } + function isSomeImportDeclaration(decl) { + switch (decl.kind) { + case 239: + case 237: + case 240: + case 242: + return true; + case 71: + return decl.parent.kind === 242; + default: + return false; + } + } +})(ts || (ts = {})); +var ts; +(function (ts) { + function createSynthesizedNode(kind) { + var node = ts.createNode(kind, -1, -1); + node.flags |= 8; + return node; + } + function updateNode(updated, original) { + if (updated !== original) { + setOriginalNode(updated, original); + setTextRange(updated, original); + if (original.startsOnNewLine) { + updated.startsOnNewLine = true; + } + ts.aggregateTransformFlags(updated); + } + return updated; + } + ts.updateNode = updateNode; + function createNodeArray(elements, hasTrailingComma) { + if (elements) { + if (ts.isNodeArray(elements)) { + return elements; + } + } + else { + elements = []; + } + var array = elements; + array.pos = -1; + array.end = -1; + array.hasTrailingComma = hasTrailingComma; + return array; + } + ts.createNodeArray = createNodeArray; + function getSynthesizedClone(node) { + var clone = createSynthesizedNode(node.kind); + clone.flags |= node.flags; + setOriginalNode(clone, node); + for (var key in node) { + if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + continue; + } + clone[key] = node[key]; + } + return clone; + } + ts.getSynthesizedClone = getSynthesizedClone; + function createLiteral(value) { + if (typeof value === "number") { + return createNumericLiteral(value + ""); + } + if (typeof value === "boolean") { + return value ? createTrue() : createFalse(); + } + if (typeof value === "string") { + return createStringLiteral(value); + } + return createLiteralFromNode(value); + } + ts.createLiteral = createLiteral; + function createNumericLiteral(value) { + var node = createSynthesizedNode(8); + node.text = value; + node.numericLiteralFlags = 0; + return node; + } + ts.createNumericLiteral = createNumericLiteral; + function createStringLiteral(text) { + var node = createSynthesizedNode(9); + node.text = text; + return node; + } + function createLiteralFromNode(sourceNode) { + var node = createStringLiteral(ts.getTextOfIdentifierOrLiteral(sourceNode)); + node.textSourceNode = sourceNode; + return node; + } + function createIdentifier(text, typeArguments) { + var node = createSynthesizedNode(71); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.originalKeywordKind = text ? ts.stringToToken(text) : 0; + node.autoGenerateKind = 0; + node.autoGenerateId = 0; + if (typeArguments) { + node.typeArguments = createNodeArray(typeArguments); + } + return node; + } + ts.createIdentifier = createIdentifier; + function updateIdentifier(node, typeArguments) { + return node.typeArguments !== typeArguments + ? updateNode(createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText), typeArguments), node) + : node; + } + ts.updateIdentifier = updateIdentifier; + var nextAutoGenerateId = 0; + function createTempVariable(recordTempVariable) { + var name = createIdentifier(""); + name.autoGenerateKind = 1; + name.autoGenerateId = nextAutoGenerateId; + nextAutoGenerateId++; + if (recordTempVariable) { + recordTempVariable(name); + } + return name; + } + ts.createTempVariable = createTempVariable; + function createLoopVariable() { + var name = createIdentifier(""); + name.autoGenerateKind = 2; + name.autoGenerateId = nextAutoGenerateId; + nextAutoGenerateId++; + return name; + } + ts.createLoopVariable = createLoopVariable; + function createUniqueName(text) { + var name = createIdentifier(text); + name.autoGenerateKind = 3; + name.autoGenerateId = nextAutoGenerateId; + nextAutoGenerateId++; + return name; + } + ts.createUniqueName = createUniqueName; + function getGeneratedNameForNode(node) { + var name = createIdentifier(""); + name.autoGenerateKind = 4; + name.autoGenerateId = nextAutoGenerateId; + name.original = node; + nextAutoGenerateId++; + return name; + } + ts.getGeneratedNameForNode = getGeneratedNameForNode; + function createToken(token) { + return createSynthesizedNode(token); + } + ts.createToken = createToken; + function createSuper() { + return createSynthesizedNode(97); + } + ts.createSuper = createSuper; + function createThis() { + return createSynthesizedNode(99); + } + ts.createThis = createThis; + function createNull() { + return createSynthesizedNode(95); + } + ts.createNull = createNull; + function createTrue() { + return createSynthesizedNode(101); + } + ts.createTrue = createTrue; + function createFalse() { + return createSynthesizedNode(86); + } + ts.createFalse = createFalse; + function createQualifiedName(left, right) { + var node = createSynthesizedNode(143); + node.left = left; + node.right = asName(right); + return node; + } + ts.createQualifiedName = createQualifiedName; + function updateQualifiedName(node, left, right) { + return node.left !== left + || node.right !== right + ? updateNode(createQualifiedName(left, right), node) + : node; + } + ts.updateQualifiedName = updateQualifiedName; + function createComputedPropertyName(expression) { + var node = createSynthesizedNode(144); + node.expression = expression; + return node; + } + ts.createComputedPropertyName = createComputedPropertyName; + function updateComputedPropertyName(node, expression) { + return node.expression !== expression + ? updateNode(createComputedPropertyName(expression), node) + : node; + } + ts.updateComputedPropertyName = updateComputedPropertyName; + function createTypeParameterDeclaration(name, constraint, defaultType) { + var node = createSynthesizedNode(145); + node.name = asName(name); + node.constraint = constraint; + node.default = defaultType; + return node; + } + ts.createTypeParameterDeclaration = createTypeParameterDeclaration; + function updateTypeParameterDeclaration(node, name, constraint, defaultType) { + return node.name !== name + || node.constraint !== constraint + || node.default !== defaultType + ? updateNode(createTypeParameterDeclaration(name, constraint, defaultType), node) + : node; + } + ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration; + function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + var node = createSynthesizedNode(146); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.dotDotDotToken = dotDotDotToken; + node.name = asName(name); + node.questionToken = questionToken; + node.type = type; + node.initializer = initializer ? ts.parenthesizeExpressionForList(initializer) : undefined; + return node; + } + ts.createParameter = createParameter; + function updateParameter(node, decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer), node) + : node; + } + ts.updateParameter = updateParameter; + function createDecorator(expression) { + var node = createSynthesizedNode(147); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createDecorator = createDecorator; + function updateDecorator(node, expression) { + return node.expression !== expression + ? updateNode(createDecorator(expression), node) + : node; + } + ts.updateDecorator = updateDecorator; + function createPropertySignature(modifiers, name, questionToken, type, initializer) { + var node = createSynthesizedNode(148); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.questionToken = questionToken; + node.type = type; + node.initializer = initializer; + return node; + } + ts.createPropertySignature = createPropertySignature; + function updatePropertySignature(node, modifiers, name, questionToken, type, initializer) { + return node.modifiers !== modifiers + || node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createPropertySignature(modifiers, name, questionToken, type, initializer), node) + : node; + } + ts.updatePropertySignature = updatePropertySignature; + function createProperty(decorators, modifiers, name, questionToken, type, initializer) { + var node = createSynthesizedNode(149); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.questionToken = questionToken; + node.type = type; + node.initializer = initializer; + return node; + } + ts.createProperty = createProperty; + function updateProperty(node, decorators, modifiers, name, questionToken, type, initializer) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.questionToken !== questionToken + || node.type !== type + || node.initializer !== initializer + ? updateNode(createProperty(decorators, modifiers, name, questionToken, type, initializer), node) + : node; + } + ts.updateProperty = updateProperty; + function createMethodSignature(typeParameters, parameters, type, name, questionToken) { + var node = createSignatureDeclaration(150, typeParameters, parameters, type); + node.name = asName(name); + node.questionToken = questionToken; + return node; + } + ts.createMethodSignature = createMethodSignature; + function updateMethodSignature(node, typeParameters, parameters, type, name, questionToken) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.name !== name + || node.questionToken !== questionToken + ? updateNode(createMethodSignature(typeParameters, parameters, type, name, questionToken), node) + : node; + } + ts.updateMethodSignature = updateMethodSignature; + function createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(151); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.asteriskToken = asteriskToken; + node.name = asName(name); + node.questionToken = questionToken; + node.typeParameters = asNodeArray(typeParameters); + node.parameters = createNodeArray(parameters); + node.type = type; + node.body = body; + return node; + } + ts.createMethod = createMethod; + function updateMethod(node, decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.questionToken !== questionToken + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body), node) + : node; + } + ts.updateMethod = updateMethod; + function createConstructor(decorators, modifiers, parameters, body) { + var node = createSynthesizedNode(152); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.typeParameters = undefined; + node.parameters = createNodeArray(parameters); + node.type = undefined; + node.body = body; + return node; + } + ts.createConstructor = createConstructor; + function updateConstructor(node, decorators, modifiers, parameters, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.parameters !== parameters + || node.body !== body + ? updateNode(createConstructor(decorators, modifiers, parameters, body), node) + : node; + } + ts.updateConstructor = updateConstructor; + function createGetAccessor(decorators, modifiers, name, parameters, type, body) { + var node = createSynthesizedNode(153); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = undefined; + node.parameters = createNodeArray(parameters); + node.type = type; + node.body = body; + return node; + } + ts.createGetAccessor = createGetAccessor; + function updateGetAccessor(node, decorators, modifiers, name, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createGetAccessor(decorators, modifiers, name, parameters, type, body), node) + : node; + } + ts.updateGetAccessor = updateGetAccessor; + function createSetAccessor(decorators, modifiers, name, parameters, body) { + var node = createSynthesizedNode(154); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = undefined; + node.parameters = createNodeArray(parameters); + node.body = body; + return node; + } + ts.createSetAccessor = createSetAccessor; + function updateSetAccessor(node, decorators, modifiers, name, parameters, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.parameters !== parameters + || node.body !== body + ? updateNode(createSetAccessor(decorators, modifiers, name, parameters, body), node) + : node; + } + ts.updateSetAccessor = updateSetAccessor; + function createCallSignature(typeParameters, parameters, type) { + return createSignatureDeclaration(155, typeParameters, parameters, type); + } + ts.createCallSignature = createCallSignature; + function updateCallSignature(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateCallSignature = updateCallSignature; + function createConstructSignature(typeParameters, parameters, type) { + return createSignatureDeclaration(156, typeParameters, parameters, type); + } + ts.createConstructSignature = createConstructSignature; + function updateConstructSignature(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructSignature = updateConstructSignature; + function createIndexSignature(decorators, modifiers, parameters, type) { + var node = createSynthesizedNode(157); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.parameters = createNodeArray(parameters); + node.type = type; + return node; + } + ts.createIndexSignature = createIndexSignature; + function updateIndexSignature(node, decorators, modifiers, parameters, type) { + return node.parameters !== parameters + || node.type !== type + || node.decorators !== decorators + || node.modifiers !== modifiers + ? updateNode(createIndexSignature(decorators, modifiers, parameters, type), node) + : node; + } + ts.updateIndexSignature = updateIndexSignature; + function createSignatureDeclaration(kind, typeParameters, parameters, type) { + var node = createSynthesizedNode(kind); + node.typeParameters = asNodeArray(typeParameters); + node.parameters = asNodeArray(parameters); + node.type = type; + return node; + } + ts.createSignatureDeclaration = createSignatureDeclaration; + function updateSignatureDeclaration(node, typeParameters, parameters, type) { + return node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + ? updateNode(createSignatureDeclaration(node.kind, typeParameters, parameters, type), node) + : node; + } + function createKeywordTypeNode(kind) { + return createSynthesizedNode(kind); + } + ts.createKeywordTypeNode = createKeywordTypeNode; + function createTypePredicateNode(parameterName, type) { + var node = createSynthesizedNode(158); + node.parameterName = asName(parameterName); + node.type = type; + return node; + } + ts.createTypePredicateNode = createTypePredicateNode; + function updateTypePredicateNode(node, parameterName, type) { + return node.parameterName !== parameterName + || node.type !== type + ? updateNode(createTypePredicateNode(parameterName, type), node) + : node; + } + ts.updateTypePredicateNode = updateTypePredicateNode; + function createTypeReferenceNode(typeName, typeArguments) { + var node = createSynthesizedNode(159); + node.typeName = asName(typeName); + node.typeArguments = typeArguments && ts.parenthesizeTypeParameters(typeArguments); + return node; + } + ts.createTypeReferenceNode = createTypeReferenceNode; + function updateTypeReferenceNode(node, typeName, typeArguments) { + return node.typeName !== typeName + || node.typeArguments !== typeArguments + ? updateNode(createTypeReferenceNode(typeName, typeArguments), node) + : node; + } + ts.updateTypeReferenceNode = updateTypeReferenceNode; + function createFunctionTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(160, typeParameters, parameters, type); + } + ts.createFunctionTypeNode = createFunctionTypeNode; + function updateFunctionTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateFunctionTypeNode = updateFunctionTypeNode; + function createConstructorTypeNode(typeParameters, parameters, type) { + return createSignatureDeclaration(161, typeParameters, parameters, type); + } + ts.createConstructorTypeNode = createConstructorTypeNode; + function updateConstructorTypeNode(node, typeParameters, parameters, type) { + return updateSignatureDeclaration(node, typeParameters, parameters, type); + } + ts.updateConstructorTypeNode = updateConstructorTypeNode; + function createTypeQueryNode(exprName) { + var node = createSynthesizedNode(162); + node.exprName = exprName; + return node; + } + ts.createTypeQueryNode = createTypeQueryNode; + function updateTypeQueryNode(node, exprName) { + return node.exprName !== exprName + ? updateNode(createTypeQueryNode(exprName), node) + : node; + } + ts.updateTypeQueryNode = updateTypeQueryNode; + function createTypeLiteralNode(members) { + var node = createSynthesizedNode(163); + node.members = createNodeArray(members); + return node; + } + ts.createTypeLiteralNode = createTypeLiteralNode; + function updateTypeLiteralNode(node, members) { + return node.members !== members + ? updateNode(createTypeLiteralNode(members), node) + : node; + } + ts.updateTypeLiteralNode = updateTypeLiteralNode; + function createArrayTypeNode(elementType) { + var node = createSynthesizedNode(164); + node.elementType = ts.parenthesizeArrayTypeMember(elementType); + return node; + } + ts.createArrayTypeNode = createArrayTypeNode; + function updateArrayTypeNode(node, elementType) { + return node.elementType !== elementType + ? updateNode(createArrayTypeNode(elementType), node) + : node; + } + ts.updateArrayTypeNode = updateArrayTypeNode; + function createTupleTypeNode(elementTypes) { + var node = createSynthesizedNode(165); + node.elementTypes = createNodeArray(elementTypes); + return node; + } + ts.createTupleTypeNode = createTupleTypeNode; + function updateTypleTypeNode(node, elementTypes) { + return node.elementTypes !== elementTypes + ? updateNode(createTupleTypeNode(elementTypes), node) + : node; + } + ts.updateTypleTypeNode = updateTypleTypeNode; + function createUnionTypeNode(types) { + return createUnionOrIntersectionTypeNode(166, types); + } + ts.createUnionTypeNode = createUnionTypeNode; + function updateUnionTypeNode(node, types) { + return updateUnionOrIntersectionTypeNode(node, types); + } + ts.updateUnionTypeNode = updateUnionTypeNode; + function createIntersectionTypeNode(types) { + return createUnionOrIntersectionTypeNode(167, types); + } + ts.createIntersectionTypeNode = createIntersectionTypeNode; + function updateIntersectionTypeNode(node, types) { + return updateUnionOrIntersectionTypeNode(node, types); + } + ts.updateIntersectionTypeNode = updateIntersectionTypeNode; + function createUnionOrIntersectionTypeNode(kind, types) { + var node = createSynthesizedNode(kind); + node.types = ts.parenthesizeElementTypeMembers(types); + return node; + } + ts.createUnionOrIntersectionTypeNode = createUnionOrIntersectionTypeNode; + function updateUnionOrIntersectionTypeNode(node, types) { + return node.types !== types + ? updateNode(createUnionOrIntersectionTypeNode(node.kind, types), node) + : node; + } + function createParenthesizedType(type) { + var node = createSynthesizedNode(168); + node.type = type; + return node; + } + ts.createParenthesizedType = createParenthesizedType; + function updateParenthesizedType(node, type) { + return node.type !== type + ? updateNode(createParenthesizedType(type), node) + : node; + } + ts.updateParenthesizedType = updateParenthesizedType; + function createThisTypeNode() { + return createSynthesizedNode(169); + } + ts.createThisTypeNode = createThisTypeNode; + function createTypeOperatorNode(type) { + var node = createSynthesizedNode(170); + node.operator = 127; + node.type = ts.parenthesizeElementTypeMember(type); + return node; + } + ts.createTypeOperatorNode = createTypeOperatorNode; + function updateTypeOperatorNode(node, type) { + return node.type !== type ? updateNode(createTypeOperatorNode(type), node) : node; + } + ts.updateTypeOperatorNode = updateTypeOperatorNode; + function createIndexedAccessTypeNode(objectType, indexType) { + var node = createSynthesizedNode(171); + node.objectType = ts.parenthesizeElementTypeMember(objectType); + node.indexType = indexType; + return node; + } + ts.createIndexedAccessTypeNode = createIndexedAccessTypeNode; + function updateIndexedAccessTypeNode(node, objectType, indexType) { + return node.objectType !== objectType + || node.indexType !== indexType + ? updateNode(createIndexedAccessTypeNode(objectType, indexType), node) + : node; + } + ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode; + function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) { + var node = createSynthesizedNode(172); + node.readonlyToken = readonlyToken; + node.typeParameter = typeParameter; + node.questionToken = questionToken; + node.type = type; + return node; + } + ts.createMappedTypeNode = createMappedTypeNode; + function updateMappedTypeNode(node, readonlyToken, typeParameter, questionToken, type) { + return node.readonlyToken !== readonlyToken + || node.typeParameter !== typeParameter + || node.questionToken !== questionToken + || node.type !== type + ? updateNode(createMappedTypeNode(readonlyToken, typeParameter, questionToken, type), node) + : node; + } + ts.updateMappedTypeNode = updateMappedTypeNode; + function createLiteralTypeNode(literal) { + var node = createSynthesizedNode(173); + node.literal = literal; + return node; + } + ts.createLiteralTypeNode = createLiteralTypeNode; + function updateLiteralTypeNode(node, literal) { + return node.literal !== literal + ? updateNode(createLiteralTypeNode(literal), node) + : node; + } + ts.updateLiteralTypeNode = updateLiteralTypeNode; + function createObjectBindingPattern(elements) { + var node = createSynthesizedNode(174); + node.elements = createNodeArray(elements); + return node; + } + ts.createObjectBindingPattern = createObjectBindingPattern; + function updateObjectBindingPattern(node, elements) { + return node.elements !== elements + ? updateNode(createObjectBindingPattern(elements), node) + : node; + } + ts.updateObjectBindingPattern = updateObjectBindingPattern; + function createArrayBindingPattern(elements) { + var node = createSynthesizedNode(175); + node.elements = createNodeArray(elements); + return node; + } + ts.createArrayBindingPattern = createArrayBindingPattern; + function updateArrayBindingPattern(node, elements) { + return node.elements !== elements + ? updateNode(createArrayBindingPattern(elements), node) + : node; + } + ts.updateArrayBindingPattern = updateArrayBindingPattern; + function createBindingElement(dotDotDotToken, propertyName, name, initializer) { + var node = createSynthesizedNode(176); + node.dotDotDotToken = dotDotDotToken; + node.propertyName = asName(propertyName); + node.name = asName(name); + node.initializer = initializer; + return node; + } + ts.createBindingElement = createBindingElement; + function updateBindingElement(node, dotDotDotToken, propertyName, name, initializer) { + return node.propertyName !== propertyName + || node.dotDotDotToken !== dotDotDotToken + || node.name !== name + || node.initializer !== initializer + ? updateNode(createBindingElement(dotDotDotToken, propertyName, name, initializer), node) + : node; + } + ts.updateBindingElement = updateBindingElement; + function createArrayLiteral(elements, multiLine) { + var node = createSynthesizedNode(177); + node.elements = ts.parenthesizeListElements(createNodeArray(elements)); + if (multiLine) + node.multiLine = true; + return node; + } + ts.createArrayLiteral = createArrayLiteral; + function updateArrayLiteral(node, elements) { + return node.elements !== elements + ? updateNode(createArrayLiteral(elements, node.multiLine), node) + : node; + } + ts.updateArrayLiteral = updateArrayLiteral; + function createObjectLiteral(properties, multiLine) { + var node = createSynthesizedNode(178); + node.properties = createNodeArray(properties); + if (multiLine) + node.multiLine = true; + return node; + } + ts.createObjectLiteral = createObjectLiteral; + function updateObjectLiteral(node, properties) { + return node.properties !== properties + ? updateNode(createObjectLiteral(properties, node.multiLine), node) + : node; + } + ts.updateObjectLiteral = updateObjectLiteral; + function createPropertyAccess(expression, name) { + var node = createSynthesizedNode(179); + node.expression = ts.parenthesizeForAccess(expression); + node.name = asName(name); + setEmitFlags(node, 131072); + return node; + } + ts.createPropertyAccess = createPropertyAccess; + function updatePropertyAccess(node, expression, name) { + return node.expression !== expression + || node.name !== name + ? updateNode(setEmitFlags(createPropertyAccess(expression, name), ts.getEmitFlags(node)), node) + : node; + } + ts.updatePropertyAccess = updatePropertyAccess; + function createElementAccess(expression, index) { + var node = createSynthesizedNode(180); + node.expression = ts.parenthesizeForAccess(expression); + node.argumentExpression = asExpression(index); + return node; + } + ts.createElementAccess = createElementAccess; + function updateElementAccess(node, expression, argumentExpression) { + return node.expression !== expression + || node.argumentExpression !== argumentExpression + ? updateNode(createElementAccess(expression, argumentExpression), node) + : node; + } + ts.updateElementAccess = updateElementAccess; + function createCall(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(181); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray)); + return node; + } + ts.createCall = createCall; + function updateCall(node, expression, typeArguments, argumentsArray) { + return node.expression !== expression + || node.typeArguments !== typeArguments + || node.arguments !== argumentsArray + ? updateNode(createCall(expression, typeArguments, argumentsArray), node) + : node; + } + ts.updateCall = updateCall; + function createNew(expression, typeArguments, argumentsArray) { + var node = createSynthesizedNode(182); + node.expression = ts.parenthesizeForNew(expression); + node.typeArguments = asNodeArray(typeArguments); + node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined; + return node; + } + ts.createNew = createNew; + function updateNew(node, expression, typeArguments, argumentsArray) { + return node.expression !== expression + || node.typeArguments !== typeArguments + || node.arguments !== argumentsArray + ? updateNode(createNew(expression, typeArguments, argumentsArray), node) + : node; + } + ts.updateNew = updateNew; + function createTaggedTemplate(tag, template) { + var node = createSynthesizedNode(183); + node.tag = ts.parenthesizeForAccess(tag); + node.template = template; + return node; + } + ts.createTaggedTemplate = createTaggedTemplate; + function updateTaggedTemplate(node, tag, template) { + return node.tag !== tag + || node.template !== template + ? updateNode(createTaggedTemplate(tag, template), node) + : node; + } + ts.updateTaggedTemplate = updateTaggedTemplate; + function createTypeAssertion(type, expression) { + var node = createSynthesizedNode(184); + node.type = type; + node.expression = ts.parenthesizePrefixOperand(expression); + return node; + } + ts.createTypeAssertion = createTypeAssertion; + function updateTypeAssertion(node, type, expression) { + return node.type !== type + || node.expression !== expression + ? updateNode(createTypeAssertion(type, expression), node) + : node; + } + ts.updateTypeAssertion = updateTypeAssertion; + function createParen(expression) { + var node = createSynthesizedNode(185); + node.expression = expression; + return node; + } + ts.createParen = createParen; + function updateParen(node, expression) { + return node.expression !== expression + ? updateNode(createParen(expression), node) + : node; + } + ts.updateParen = updateParen; + function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(186); + node.modifiers = asNodeArray(modifiers); + node.asteriskToken = asteriskToken; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.parameters = createNodeArray(parameters); + node.type = type; + node.body = body; + return node; + } + ts.createFunctionExpression = createFunctionExpression; + function updateFunctionExpression(node, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.name !== name + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; + } + ts.updateFunctionExpression = updateFunctionExpression; + function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { + var node = createSynthesizedNode(187); + node.modifiers = asNodeArray(modifiers); + node.typeParameters = asNodeArray(typeParameters); + node.parameters = createNodeArray(parameters); + node.type = type; + node.equalsGreaterThanToken = equalsGreaterThanToken || createToken(36); + node.body = ts.parenthesizeConciseBody(body); + return node; + } + ts.createArrowFunction = createArrowFunction; + function updateArrowFunction(node, modifiers, typeParameters, parameters, type, equalsGreaterThanTokenOrBody, bodyOrUndefined) { + var equalsGreaterThanToken; + var body; + if (bodyOrUndefined === undefined) { + equalsGreaterThanToken = node.equalsGreaterThanToken; + body = ts.cast(equalsGreaterThanTokenOrBody, ts.isConciseBody); + } + else { + equalsGreaterThanToken = ts.cast(equalsGreaterThanTokenOrBody, function (n) { + return n.kind === 36; + }); + body = bodyOrUndefined; + } + return node.modifiers !== modifiers + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.equalsGreaterThanToken !== equalsGreaterThanToken + || node.body !== body + ? updateNode(createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body), node) + : node; + } + ts.updateArrowFunction = updateArrowFunction; + function createDelete(expression) { + var node = createSynthesizedNode(188); + node.expression = ts.parenthesizePrefixOperand(expression); + return node; + } + ts.createDelete = createDelete; + function updateDelete(node, expression) { + return node.expression !== expression + ? updateNode(createDelete(expression), node) + : node; + } + ts.updateDelete = updateDelete; + function createTypeOf(expression) { + var node = createSynthesizedNode(189); + node.expression = ts.parenthesizePrefixOperand(expression); + return node; + } + ts.createTypeOf = createTypeOf; + function updateTypeOf(node, expression) { + return node.expression !== expression + ? updateNode(createTypeOf(expression), node) + : node; + } + ts.updateTypeOf = updateTypeOf; + function createVoid(expression) { + var node = createSynthesizedNode(190); + node.expression = ts.parenthesizePrefixOperand(expression); + return node; + } + ts.createVoid = createVoid; + function updateVoid(node, expression) { + return node.expression !== expression + ? updateNode(createVoid(expression), node) + : node; + } + ts.updateVoid = updateVoid; + function createAwait(expression) { + var node = createSynthesizedNode(191); + node.expression = ts.parenthesizePrefixOperand(expression); + return node; + } + ts.createAwait = createAwait; + function updateAwait(node, expression) { + return node.expression !== expression + ? updateNode(createAwait(expression), node) + : node; + } + ts.updateAwait = updateAwait; + function createPrefix(operator, operand) { + var node = createSynthesizedNode(192); + node.operator = operator; + node.operand = ts.parenthesizePrefixOperand(operand); + return node; + } + ts.createPrefix = createPrefix; + function updatePrefix(node, operand) { + return node.operand !== operand + ? updateNode(createPrefix(node.operator, operand), node) + : node; + } + ts.updatePrefix = updatePrefix; + function createPostfix(operand, operator) { + var node = createSynthesizedNode(193); + node.operand = ts.parenthesizePostfixOperand(operand); + node.operator = operator; + return node; + } + ts.createPostfix = createPostfix; + function updatePostfix(node, operand) { + return node.operand !== operand + ? updateNode(createPostfix(operand, node.operator), node) + : node; + } + ts.updatePostfix = updatePostfix; + function createBinary(left, operator, right) { + var node = createSynthesizedNode(194); + var operatorToken = asToken(operator); + var operatorKind = operatorToken.kind; + node.left = ts.parenthesizeBinaryOperand(operatorKind, left, true, undefined); + node.operatorToken = operatorToken; + node.right = ts.parenthesizeBinaryOperand(operatorKind, right, false, node.left); + return node; + } + ts.createBinary = createBinary; + function updateBinary(node, left, right, operator) { + return node.left !== left + || node.right !== right + ? updateNode(createBinary(left, operator || node.operatorToken, right), node) + : node; + } + ts.updateBinary = updateBinary; + function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) { + var node = createSynthesizedNode(195); + node.condition = ts.parenthesizeForConditionalHead(condition); + node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(55); + node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue); + node.colonToken = whenFalse ? colonToken : createToken(56); + node.whenFalse = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenFalse : whenTrueOrWhenFalse); + return node; + } + ts.createConditional = createConditional; + function updateConditional(node, condition) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (args.length === 2) { + var whenTrue_1 = args[0], whenFalse_1 = args[1]; + return updateConditional(node, condition, node.questionToken, whenTrue_1, node.colonToken, whenFalse_1); + } + ts.Debug.assert(args.length === 4); + var questionToken = args[0], whenTrue = args[1], colonToken = args[2], whenFalse = args[3]; + return node.condition !== condition + || node.questionToken !== questionToken + || node.whenTrue !== whenTrue + || node.colonToken !== colonToken + || node.whenFalse !== whenFalse + ? updateNode(createConditional(condition, questionToken, whenTrue, colonToken, whenFalse), node) + : node; + } + ts.updateConditional = updateConditional; + function createTemplateExpression(head, templateSpans) { + var node = createSynthesizedNode(196); + node.head = head; + node.templateSpans = createNodeArray(templateSpans); + return node; + } + ts.createTemplateExpression = createTemplateExpression; + function updateTemplateExpression(node, head, templateSpans) { + return node.head !== head + || node.templateSpans !== templateSpans + ? updateNode(createTemplateExpression(head, templateSpans), node) + : node; + } + ts.updateTemplateExpression = updateTemplateExpression; + function createYield(asteriskTokenOrExpression, expression) { + var node = createSynthesizedNode(197); + node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 39 ? asteriskTokenOrExpression : undefined; + node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 39 ? asteriskTokenOrExpression : expression; + return node; + } + ts.createYield = createYield; + function updateYield(node, asteriskToken, expression) { + return node.expression !== expression + || node.asteriskToken !== asteriskToken + ? updateNode(createYield(asteriskToken, expression), node) + : node; + } + ts.updateYield = updateYield; + function createSpread(expression) { + var node = createSynthesizedNode(198); + node.expression = ts.parenthesizeExpressionForList(expression); + return node; + } + ts.createSpread = createSpread; + function updateSpread(node, expression) { + return node.expression !== expression + ? updateNode(createSpread(expression), node) + : node; + } + ts.updateSpread = updateSpread; + function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(199); + node.decorators = undefined; + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); + node.members = createNodeArray(members); + return node; + } + ts.createClassExpression = createClassExpression; + function updateClassExpression(node, modifiers, name, typeParameters, heritageClauses, members) { + return node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassExpression(modifiers, name, typeParameters, heritageClauses, members), node) + : node; + } + ts.updateClassExpression = updateClassExpression; + function createOmittedExpression() { + return createSynthesizedNode(200); + } + ts.createOmittedExpression = createOmittedExpression; + function createExpressionWithTypeArguments(typeArguments, expression) { + var node = createSynthesizedNode(201); + node.expression = ts.parenthesizeForAccess(expression); + node.typeArguments = asNodeArray(typeArguments); + return node; + } + ts.createExpressionWithTypeArguments = createExpressionWithTypeArguments; + function updateExpressionWithTypeArguments(node, typeArguments, expression) { + return node.typeArguments !== typeArguments + || node.expression !== expression + ? updateNode(createExpressionWithTypeArguments(typeArguments, expression), node) + : node; + } + ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments; + function createAsExpression(expression, type) { + var node = createSynthesizedNode(202); + node.expression = expression; + node.type = type; + return node; + } + ts.createAsExpression = createAsExpression; + function updateAsExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? updateNode(createAsExpression(expression, type), node) + : node; + } + ts.updateAsExpression = updateAsExpression; + function createNonNullExpression(expression) { + var node = createSynthesizedNode(203); + node.expression = ts.parenthesizeForAccess(expression); + return node; + } + ts.createNonNullExpression = createNonNullExpression; + function updateNonNullExpression(node, expression) { + return node.expression !== expression + ? updateNode(createNonNullExpression(expression), node) + : node; + } + ts.updateNonNullExpression = updateNonNullExpression; + function createMetaProperty(keywordToken, name) { + var node = createSynthesizedNode(204); + node.keywordToken = keywordToken; + node.name = name; + return node; + } + ts.createMetaProperty = createMetaProperty; + function updateMetaProperty(node, name) { + return node.name !== name + ? updateNode(createMetaProperty(node.keywordToken, name), node) + : node; + } + ts.updateMetaProperty = updateMetaProperty; + function createTemplateSpan(expression, literal) { + var node = createSynthesizedNode(205); + node.expression = expression; + node.literal = literal; + return node; + } + ts.createTemplateSpan = createTemplateSpan; + function updateTemplateSpan(node, expression, literal) { + return node.expression !== expression + || node.literal !== literal + ? updateNode(createTemplateSpan(expression, literal), node) + : node; + } + ts.updateTemplateSpan = updateTemplateSpan; + function createSemicolonClassElement() { + return createSynthesizedNode(206); + } + ts.createSemicolonClassElement = createSemicolonClassElement; + function createBlock(statements, multiLine) { + var block = createSynthesizedNode(207); + block.statements = createNodeArray(statements); + if (multiLine) + block.multiLine = multiLine; + return block; + } + ts.createBlock = createBlock; + function updateBlock(node, statements) { + return node.statements !== statements + ? updateNode(createBlock(statements, node.multiLine), node) + : node; + } + ts.updateBlock = updateBlock; + function createVariableStatement(modifiers, declarationList) { + var node = createSynthesizedNode(208); + node.decorators = undefined; + node.modifiers = asNodeArray(modifiers); + node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; + return node; + } + ts.createVariableStatement = createVariableStatement; + function updateVariableStatement(node, modifiers, declarationList) { + return node.modifiers !== modifiers + || node.declarationList !== declarationList + ? updateNode(createVariableStatement(modifiers, declarationList), node) + : node; + } + ts.updateVariableStatement = updateVariableStatement; + function createEmptyStatement() { + return createSynthesizedNode(209); + } + ts.createEmptyStatement = createEmptyStatement; + function createStatement(expression) { + var node = createSynthesizedNode(210); + node.expression = ts.parenthesizeExpressionForExpressionStatement(expression); + return node; + } + ts.createStatement = createStatement; + function updateStatement(node, expression) { + return node.expression !== expression + ? updateNode(createStatement(expression), node) + : node; + } + ts.updateStatement = updateStatement; + function createIf(expression, thenStatement, elseStatement) { + var node = createSynthesizedNode(211); + node.expression = expression; + node.thenStatement = thenStatement; + node.elseStatement = elseStatement; + return node; + } + ts.createIf = createIf; + function updateIf(node, expression, thenStatement, elseStatement) { + return node.expression !== expression + || node.thenStatement !== thenStatement + || node.elseStatement !== elseStatement + ? updateNode(createIf(expression, thenStatement, elseStatement), node) + : node; + } + ts.updateIf = updateIf; + function createDo(statement, expression) { + var node = createSynthesizedNode(212); + node.statement = statement; + node.expression = expression; + return node; + } + ts.createDo = createDo; + function updateDo(node, statement, expression) { + return node.statement !== statement + || node.expression !== expression + ? updateNode(createDo(statement, expression), node) + : node; + } + ts.updateDo = updateDo; + function createWhile(expression, statement) { + var node = createSynthesizedNode(213); + node.expression = expression; + node.statement = statement; + return node; + } + ts.createWhile = createWhile; + function updateWhile(node, expression, statement) { + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWhile(expression, statement), node) + : node; + } + ts.updateWhile = updateWhile; + function createFor(initializer, condition, incrementor, statement) { + var node = createSynthesizedNode(214); + node.initializer = initializer; + node.condition = condition; + node.incrementor = incrementor; + node.statement = statement; + return node; + } + ts.createFor = createFor; + function updateFor(node, initializer, condition, incrementor, statement) { + return node.initializer !== initializer + || node.condition !== condition + || node.incrementor !== incrementor + || node.statement !== statement + ? updateNode(createFor(initializer, condition, incrementor, statement), node) + : node; + } + ts.updateFor = updateFor; + function createForIn(initializer, expression, statement) { + var node = createSynthesizedNode(215); + node.initializer = initializer; + node.expression = expression; + node.statement = statement; + return node; + } + ts.createForIn = createForIn; + function updateForIn(node, initializer, expression, statement) { + return node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForIn(initializer, expression, statement), node) + : node; + } + ts.updateForIn = updateForIn; + function createForOf(awaitModifier, initializer, expression, statement) { + var node = createSynthesizedNode(216); + node.awaitModifier = awaitModifier; + node.initializer = initializer; + node.expression = expression; + node.statement = statement; + return node; + } + ts.createForOf = createForOf; + function updateForOf(node, awaitModifier, initializer, expression, statement) { + return node.awaitModifier !== awaitModifier + || node.initializer !== initializer + || node.expression !== expression + || node.statement !== statement + ? updateNode(createForOf(awaitModifier, initializer, expression, statement), node) + : node; + } + ts.updateForOf = updateForOf; + function createContinue(label) { + var node = createSynthesizedNode(217); + node.label = asName(label); + return node; + } + ts.createContinue = createContinue; + function updateContinue(node, label) { + return node.label !== label + ? updateNode(createContinue(label), node) + : node; + } + ts.updateContinue = updateContinue; + function createBreak(label) { + var node = createSynthesizedNode(218); + node.label = asName(label); + return node; + } + ts.createBreak = createBreak; + function updateBreak(node, label) { + return node.label !== label + ? updateNode(createBreak(label), node) + : node; + } + ts.updateBreak = updateBreak; + function createReturn(expression) { + var node = createSynthesizedNode(219); + node.expression = expression; + return node; + } + ts.createReturn = createReturn; + function updateReturn(node, expression) { + return node.expression !== expression + ? updateNode(createReturn(expression), node) + : node; + } + ts.updateReturn = updateReturn; + function createWith(expression, statement) { + var node = createSynthesizedNode(220); + node.expression = expression; + node.statement = statement; + return node; + } + ts.createWith = createWith; + function updateWith(node, expression, statement) { + return node.expression !== expression + || node.statement !== statement + ? updateNode(createWith(expression, statement), node) + : node; + } + ts.updateWith = updateWith; + function createSwitch(expression, caseBlock) { + var node = createSynthesizedNode(221); + node.expression = ts.parenthesizeExpressionForList(expression); + node.caseBlock = caseBlock; + return node; + } + ts.createSwitch = createSwitch; + function updateSwitch(node, expression, caseBlock) { + return node.expression !== expression + || node.caseBlock !== caseBlock + ? updateNode(createSwitch(expression, caseBlock), node) + : node; + } + ts.updateSwitch = updateSwitch; + function createLabel(label, statement) { + var node = createSynthesizedNode(222); + node.label = asName(label); + node.statement = statement; + return node; + } + ts.createLabel = createLabel; + function updateLabel(node, label, statement) { + return node.label !== label + || node.statement !== statement + ? updateNode(createLabel(label, statement), node) + : node; + } + ts.updateLabel = updateLabel; + function createThrow(expression) { + var node = createSynthesizedNode(223); + node.expression = expression; + return node; + } + ts.createThrow = createThrow; + function updateThrow(node, expression) { + return node.expression !== expression + ? updateNode(createThrow(expression), node) + : node; + } + ts.updateThrow = updateThrow; + function createTry(tryBlock, catchClause, finallyBlock) { + var node = createSynthesizedNode(224); + node.tryBlock = tryBlock; + node.catchClause = catchClause; + node.finallyBlock = finallyBlock; + return node; + } + ts.createTry = createTry; + function updateTry(node, tryBlock, catchClause, finallyBlock) { + return node.tryBlock !== tryBlock + || node.catchClause !== catchClause + || node.finallyBlock !== finallyBlock + ? updateNode(createTry(tryBlock, catchClause, finallyBlock), node) + : node; + } + ts.updateTry = updateTry; + function createDebuggerStatement() { + return createSynthesizedNode(225); + } + ts.createDebuggerStatement = createDebuggerStatement; + function createVariableDeclaration(name, type, initializer) { + var node = createSynthesizedNode(226); + node.name = asName(name); + node.type = type; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; + return node; + } + ts.createVariableDeclaration = createVariableDeclaration; + function updateVariableDeclaration(node, name, type, initializer) { + return node.name !== name + || node.type !== type + || node.initializer !== initializer + ? updateNode(createVariableDeclaration(name, type, initializer), node) + : node; + } + ts.updateVariableDeclaration = updateVariableDeclaration; + function createVariableDeclarationList(declarations, flags) { + var node = createSynthesizedNode(227); + node.flags |= flags & 3; + node.declarations = createNodeArray(declarations); + return node; + } + ts.createVariableDeclarationList = createVariableDeclarationList; + function updateVariableDeclarationList(node, declarations) { + return node.declarations !== declarations + ? updateNode(createVariableDeclarationList(declarations, node.flags), node) + : node; + } + ts.updateVariableDeclarationList = updateVariableDeclarationList; + function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + var node = createSynthesizedNode(228); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.asteriskToken = asteriskToken; + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.parameters = createNodeArray(parameters); + node.type = type; + node.body = body; + return node; + } + ts.createFunctionDeclaration = createFunctionDeclaration; + function updateFunctionDeclaration(node, decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.asteriskToken !== asteriskToken + || node.name !== name + || node.typeParameters !== typeParameters + || node.parameters !== parameters + || node.type !== type + || node.body !== body + ? updateNode(createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body), node) + : node; + } + ts.updateFunctionDeclaration = updateFunctionDeclaration; + function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(229); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); + node.members = createNodeArray(members); + return node; + } + ts.createClassDeclaration = createClassDeclaration; + function updateClassDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node) + : node; + } + ts.updateClassDeclaration = updateClassDeclaration; + function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) { + var node = createSynthesizedNode(230); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.heritageClauses = asNodeArray(heritageClauses); + node.members = createNodeArray(members); + return node; + } + ts.createInterfaceDeclaration = createInterfaceDeclaration; + function updateInterfaceDeclaration(node, decorators, modifiers, name, typeParameters, heritageClauses, members) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.heritageClauses !== heritageClauses + || node.members !== members + ? updateNode(createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members), node) + : node; + } + ts.updateInterfaceDeclaration = updateInterfaceDeclaration; + function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) { + var node = createSynthesizedNode(231); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.typeParameters = asNodeArray(typeParameters); + node.type = type; + return node; + } + ts.createTypeAliasDeclaration = createTypeAliasDeclaration; + function updateTypeAliasDeclaration(node, decorators, modifiers, name, typeParameters, type) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.typeParameters !== typeParameters + || node.type !== type + ? updateNode(createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type), node) + : node; + } + ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration; + function createEnumDeclaration(decorators, modifiers, name, members) { + var node = createSynthesizedNode(232); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.members = createNodeArray(members); + return node; + } + ts.createEnumDeclaration = createEnumDeclaration; + function updateEnumDeclaration(node, decorators, modifiers, name, members) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.members !== members + ? updateNode(createEnumDeclaration(decorators, modifiers, name, members), node) + : node; + } + ts.updateEnumDeclaration = updateEnumDeclaration; + function createModuleDeclaration(decorators, modifiers, name, body, flags) { + var node = createSynthesizedNode(233); + node.flags |= flags & (16 | 4 | 512); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = name; + node.body = body; + return node; + } + ts.createModuleDeclaration = createModuleDeclaration; + function updateModuleDeclaration(node, decorators, modifiers, name, body) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.body !== body + ? updateNode(createModuleDeclaration(decorators, modifiers, name, body, node.flags), node) + : node; + } + ts.updateModuleDeclaration = updateModuleDeclaration; + function createModuleBlock(statements) { + var node = createSynthesizedNode(234); + node.statements = createNodeArray(statements); + return node; + } + ts.createModuleBlock = createModuleBlock; + function updateModuleBlock(node, statements) { + return node.statements !== statements + ? updateNode(createModuleBlock(statements), node) + : node; + } + ts.updateModuleBlock = updateModuleBlock; + function createCaseBlock(clauses) { + var node = createSynthesizedNode(235); + node.clauses = createNodeArray(clauses); + return node; + } + ts.createCaseBlock = createCaseBlock; + function updateCaseBlock(node, clauses) { + return node.clauses !== clauses + ? updateNode(createCaseBlock(clauses), node) + : node; + } + ts.updateCaseBlock = updateCaseBlock; + function createNamespaceExportDeclaration(name) { + var node = createSynthesizedNode(236); + node.name = asName(name); + return node; + } + ts.createNamespaceExportDeclaration = createNamespaceExportDeclaration; + function updateNamespaceExportDeclaration(node, name) { + return node.name !== name + ? updateNode(createNamespaceExportDeclaration(name), node) + : node; + } + ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration; + function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) { + var node = createSynthesizedNode(237); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.name = asName(name); + node.moduleReference = moduleReference; + return node; + } + ts.createImportEqualsDeclaration = createImportEqualsDeclaration; + function updateImportEqualsDeclaration(node, decorators, modifiers, name, moduleReference) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.name !== name + || node.moduleReference !== moduleReference + ? updateNode(createImportEqualsDeclaration(decorators, modifiers, name, moduleReference), node) + : node; + } + ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration; + function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) { + var node = createSynthesizedNode(238); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.importClause = importClause; + node.moduleSpecifier = moduleSpecifier; + return node; + } + ts.createImportDeclaration = createImportDeclaration; + function updateImportDeclaration(node, decorators, modifiers, importClause, moduleSpecifier) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.importClause !== importClause + || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier), node) + : node; + } + ts.updateImportDeclaration = updateImportDeclaration; + function createImportClause(name, namedBindings) { + var node = createSynthesizedNode(239); + node.name = name; + node.namedBindings = namedBindings; + return node; + } + ts.createImportClause = createImportClause; + function updateImportClause(node, name, namedBindings) { + return node.name !== name + || node.namedBindings !== namedBindings + ? updateNode(createImportClause(name, namedBindings), node) + : node; + } + ts.updateImportClause = updateImportClause; + function createNamespaceImport(name) { + var node = createSynthesizedNode(240); + node.name = name; + return node; + } + ts.createNamespaceImport = createNamespaceImport; + function updateNamespaceImport(node, name) { + return node.name !== name + ? updateNode(createNamespaceImport(name), node) + : node; + } + ts.updateNamespaceImport = updateNamespaceImport; + function createNamedImports(elements) { + var node = createSynthesizedNode(241); + node.elements = createNodeArray(elements); + return node; + } + ts.createNamedImports = createNamedImports; + function updateNamedImports(node, elements) { + return node.elements !== elements + ? updateNode(createNamedImports(elements), node) + : node; + } + ts.updateNamedImports = updateNamedImports; + function createImportSpecifier(propertyName, name) { + var node = createSynthesizedNode(242); + node.propertyName = propertyName; + node.name = name; + return node; + } + ts.createImportSpecifier = createImportSpecifier; + function updateImportSpecifier(node, propertyName, name) { + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createImportSpecifier(propertyName, name), node) + : node; + } + ts.updateImportSpecifier = updateImportSpecifier; + function createExportAssignment(decorators, modifiers, isExportEquals, expression) { + var node = createSynthesizedNode(243); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.isExportEquals = isExportEquals; + node.expression = expression; + return node; + } + ts.createExportAssignment = createExportAssignment; + function updateExportAssignment(node, decorators, modifiers, expression) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.expression !== expression + ? updateNode(createExportAssignment(decorators, modifiers, node.isExportEquals, expression), node) + : node; + } + ts.updateExportAssignment = updateExportAssignment; + function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) { + var node = createSynthesizedNode(244); + node.decorators = asNodeArray(decorators); + node.modifiers = asNodeArray(modifiers); + node.exportClause = exportClause; + node.moduleSpecifier = moduleSpecifier; + return node; + } + ts.createExportDeclaration = createExportDeclaration; + function updateExportDeclaration(node, decorators, modifiers, exportClause, moduleSpecifier) { + return node.decorators !== decorators + || node.modifiers !== modifiers + || node.exportClause !== exportClause + || node.moduleSpecifier !== moduleSpecifier + ? updateNode(createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier), node) + : node; + } + ts.updateExportDeclaration = updateExportDeclaration; + function createNamedExports(elements) { + var node = createSynthesizedNode(245); + node.elements = createNodeArray(elements); + return node; + } + ts.createNamedExports = createNamedExports; + function updateNamedExports(node, elements) { + return node.elements !== elements + ? updateNode(createNamedExports(elements), node) + : node; + } + ts.updateNamedExports = updateNamedExports; + function createExportSpecifier(propertyName, name) { + var node = createSynthesizedNode(246); + node.propertyName = asName(propertyName); + node.name = asName(name); + return node; + } + ts.createExportSpecifier = createExportSpecifier; + function updateExportSpecifier(node, propertyName, name) { + return node.propertyName !== propertyName + || node.name !== name + ? updateNode(createExportSpecifier(propertyName, name), node) + : node; + } + ts.updateExportSpecifier = updateExportSpecifier; + function createExternalModuleReference(expression) { + var node = createSynthesizedNode(248); + node.expression = expression; + return node; + } + ts.createExternalModuleReference = createExternalModuleReference; + function updateExternalModuleReference(node, expression) { + return node.expression !== expression + ? updateNode(createExternalModuleReference(expression), node) + : node; + } + ts.updateExternalModuleReference = updateExternalModuleReference; + function createJsxElement(openingElement, children, closingElement) { + var node = createSynthesizedNode(249); + node.openingElement = openingElement; + node.children = createNodeArray(children); + node.closingElement = closingElement; + return node; + } + ts.createJsxElement = createJsxElement; + function updateJsxElement(node, openingElement, children, closingElement) { + return node.openingElement !== openingElement + || node.children !== children + || node.closingElement !== closingElement + ? updateNode(createJsxElement(openingElement, children, closingElement), node) + : node; + } + ts.updateJsxElement = updateJsxElement; + function createJsxSelfClosingElement(tagName, attributes) { + var node = createSynthesizedNode(250); + node.tagName = tagName; + node.attributes = attributes; + return node; + } + ts.createJsxSelfClosingElement = createJsxSelfClosingElement; + function updateJsxSelfClosingElement(node, tagName, attributes) { + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxSelfClosingElement(tagName, attributes), node) + : node; + } + ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement; + function createJsxOpeningElement(tagName, attributes) { + var node = createSynthesizedNode(251); + node.tagName = tagName; + node.attributes = attributes; + return node; + } + ts.createJsxOpeningElement = createJsxOpeningElement; + function updateJsxOpeningElement(node, tagName, attributes) { + return node.tagName !== tagName + || node.attributes !== attributes + ? updateNode(createJsxOpeningElement(tagName, attributes), node) + : node; + } + ts.updateJsxOpeningElement = updateJsxOpeningElement; + function createJsxClosingElement(tagName) { + var node = createSynthesizedNode(252); + node.tagName = tagName; + return node; + } + ts.createJsxClosingElement = createJsxClosingElement; + function updateJsxClosingElement(node, tagName) { + return node.tagName !== tagName + ? updateNode(createJsxClosingElement(tagName), node) + : node; + } + ts.updateJsxClosingElement = updateJsxClosingElement; + function createJsxAttribute(name, initializer) { + var node = createSynthesizedNode(253); + node.name = name; + node.initializer = initializer; + return node; + } + ts.createJsxAttribute = createJsxAttribute; + function updateJsxAttribute(node, name, initializer) { + return node.name !== name + || node.initializer !== initializer + ? updateNode(createJsxAttribute(name, initializer), node) + : node; + } + ts.updateJsxAttribute = updateJsxAttribute; + function createJsxAttributes(properties) { + var node = createSynthesizedNode(254); + node.properties = createNodeArray(properties); + return node; + } + ts.createJsxAttributes = createJsxAttributes; + function updateJsxAttributes(node, properties) { + return node.properties !== properties + ? updateNode(createJsxAttributes(properties), node) + : node; + } + ts.updateJsxAttributes = updateJsxAttributes; + function createJsxSpreadAttribute(expression) { + var node = createSynthesizedNode(255); + node.expression = expression; + return node; + } + ts.createJsxSpreadAttribute = createJsxSpreadAttribute; + function updateJsxSpreadAttribute(node, expression) { + return node.expression !== expression + ? updateNode(createJsxSpreadAttribute(expression), node) + : node; + } + ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute; + function createJsxExpression(dotDotDotToken, expression) { + var node = createSynthesizedNode(256); + node.dotDotDotToken = dotDotDotToken; + node.expression = expression; + return node; + } + ts.createJsxExpression = createJsxExpression; + function updateJsxExpression(node, expression) { + return node.expression !== expression + ? updateNode(createJsxExpression(node.dotDotDotToken, expression), node) + : node; + } + ts.updateJsxExpression = updateJsxExpression; + function createCaseClause(expression, statements) { + var node = createSynthesizedNode(257); + node.expression = ts.parenthesizeExpressionForList(expression); + node.statements = createNodeArray(statements); + return node; + } + ts.createCaseClause = createCaseClause; + function updateCaseClause(node, expression, statements) { + return node.expression !== expression + || node.statements !== statements + ? updateNode(createCaseClause(expression, statements), node) + : node; + } + ts.updateCaseClause = updateCaseClause; + function createDefaultClause(statements) { + var node = createSynthesizedNode(258); + node.statements = createNodeArray(statements); + return node; + } + ts.createDefaultClause = createDefaultClause; + function updateDefaultClause(node, statements) { + return node.statements !== statements + ? updateNode(createDefaultClause(statements), node) + : node; + } + ts.updateDefaultClause = updateDefaultClause; + function createHeritageClause(token, types) { + var node = createSynthesizedNode(259); + node.token = token; + node.types = createNodeArray(types); + return node; + } + ts.createHeritageClause = createHeritageClause; + function updateHeritageClause(node, types) { + return node.types !== types + ? updateNode(createHeritageClause(node.token, types), node) + : node; + } + ts.updateHeritageClause = updateHeritageClause; + function createCatchClause(variableDeclaration, block) { + var node = createSynthesizedNode(260); + node.variableDeclaration = typeof variableDeclaration === "string" ? createVariableDeclaration(variableDeclaration) : variableDeclaration; + node.block = block; + return node; + } + ts.createCatchClause = createCatchClause; + function updateCatchClause(node, variableDeclaration, block) { + return node.variableDeclaration !== variableDeclaration + || node.block !== block + ? updateNode(createCatchClause(variableDeclaration, block), node) + : node; + } + ts.updateCatchClause = updateCatchClause; + function createPropertyAssignment(name, initializer) { + var node = createSynthesizedNode(261); + node.name = asName(name); + node.questionToken = undefined; + node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined; + return node; + } + ts.createPropertyAssignment = createPropertyAssignment; + function updatePropertyAssignment(node, name, initializer) { + return node.name !== name + || node.initializer !== initializer + ? updateNode(createPropertyAssignment(name, initializer), node) + : node; + } + ts.updatePropertyAssignment = updatePropertyAssignment; + function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { + var node = createSynthesizedNode(262); + node.name = asName(name); + node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined; + return node; + } + ts.createShorthandPropertyAssignment = createShorthandPropertyAssignment; + function updateShorthandPropertyAssignment(node, name, objectAssignmentInitializer) { + return node.name !== name + || node.objectAssignmentInitializer !== objectAssignmentInitializer + ? updateNode(createShorthandPropertyAssignment(name, objectAssignmentInitializer), node) + : node; + } + ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment; + function createSpreadAssignment(expression) { + var node = createSynthesizedNode(263); + node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; + return node; + } + ts.createSpreadAssignment = createSpreadAssignment; + function updateSpreadAssignment(node, expression) { + return node.expression !== expression + ? updateNode(createSpreadAssignment(expression), node) + : node; + } + ts.updateSpreadAssignment = updateSpreadAssignment; + function createEnumMember(name, initializer) { + var node = createSynthesizedNode(264); + node.name = asName(name); + node.initializer = initializer && ts.parenthesizeExpressionForList(initializer); + return node; + } + ts.createEnumMember = createEnumMember; + function updateEnumMember(node, name, initializer) { + return node.name !== name + || node.initializer !== initializer + ? updateNode(createEnumMember(name, initializer), node) + : node; + } + ts.updateEnumMember = updateEnumMember; + function updateSourceFileNode(node, statements) { + if (node.statements !== statements) { + var updated = createSynthesizedNode(265); + updated.flags |= node.flags; + updated.statements = createNodeArray(statements); + updated.endOfFileToken = node.endOfFileToken; + updated.fileName = node.fileName; + updated.path = node.path; + updated.text = node.text; + if (node.amdDependencies !== undefined) + updated.amdDependencies = node.amdDependencies; + if (node.moduleName !== undefined) + updated.moduleName = node.moduleName; + if (node.referencedFiles !== undefined) + updated.referencedFiles = node.referencedFiles; + if (node.typeReferenceDirectives !== undefined) + updated.typeReferenceDirectives = node.typeReferenceDirectives; + if (node.languageVariant !== undefined) + updated.languageVariant = node.languageVariant; + if (node.isDeclarationFile !== undefined) + updated.isDeclarationFile = node.isDeclarationFile; + if (node.renamedDependencies !== undefined) + updated.renamedDependencies = node.renamedDependencies; + if (node.hasNoDefaultLib !== undefined) + updated.hasNoDefaultLib = node.hasNoDefaultLib; + if (node.languageVersion !== undefined) + updated.languageVersion = node.languageVersion; + if (node.scriptKind !== undefined) + updated.scriptKind = node.scriptKind; + if (node.externalModuleIndicator !== undefined) + updated.externalModuleIndicator = node.externalModuleIndicator; + if (node.commonJsModuleIndicator !== undefined) + updated.commonJsModuleIndicator = node.commonJsModuleIndicator; + if (node.identifiers !== undefined) + updated.identifiers = node.identifiers; + if (node.nodeCount !== undefined) + updated.nodeCount = node.nodeCount; + if (node.identifierCount !== undefined) + updated.identifierCount = node.identifierCount; + if (node.symbolCount !== undefined) + updated.symbolCount = node.symbolCount; + if (node.parseDiagnostics !== undefined) + updated.parseDiagnostics = node.parseDiagnostics; + if (node.bindDiagnostics !== undefined) + updated.bindDiagnostics = node.bindDiagnostics; + if (node.lineMap !== undefined) + updated.lineMap = node.lineMap; + if (node.classifiableNames !== undefined) + updated.classifiableNames = node.classifiableNames; + if (node.resolvedModules !== undefined) + updated.resolvedModules = node.resolvedModules; + if (node.resolvedTypeReferenceDirectiveNames !== undefined) + updated.resolvedTypeReferenceDirectiveNames = node.resolvedTypeReferenceDirectiveNames; + if (node.imports !== undefined) + updated.imports = node.imports; + if (node.moduleAugmentations !== undefined) + updated.moduleAugmentations = node.moduleAugmentations; + return updateNode(updated, node); + } + return node; + } + ts.updateSourceFileNode = updateSourceFileNode; + function getMutableClone(node) { + var clone = getSynthesizedClone(node); + clone.pos = node.pos; + clone.end = node.end; + clone.parent = node.parent; + return clone; + } + ts.getMutableClone = getMutableClone; + function createNotEmittedStatement(original) { + var node = createSynthesizedNode(287); + node.original = original; + setTextRange(node, original); + return node; + } + ts.createNotEmittedStatement = createNotEmittedStatement; + function createEndOfDeclarationMarker(original) { + var node = createSynthesizedNode(291); + node.emitNode = {}; + node.original = original; + return node; + } + ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker; + function createMergeDeclarationMarker(original) { + var node = createSynthesizedNode(290); + node.emitNode = {}; + node.original = original; + return node; + } + ts.createMergeDeclarationMarker = createMergeDeclarationMarker; + function createPartiallyEmittedExpression(expression, original) { + var node = createSynthesizedNode(288); + node.expression = expression; + node.original = original; + setTextRange(node, original); + return node; + } + ts.createPartiallyEmittedExpression = createPartiallyEmittedExpression; + function updatePartiallyEmittedExpression(node, expression) { + if (node.expression !== expression) { + return updateNode(createPartiallyEmittedExpression(expression, node.original), node); + } + return node; + } + ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression; + function flattenCommaElements(node) { + if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) { + if (node.kind === 289) { + return node.elements; + } + if (ts.isBinaryExpression(node) && node.operatorToken.kind === 26) { + return [node.left, node.right]; + } + } + return node; + } + function createCommaList(elements) { + var node = createSynthesizedNode(289); + node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); + return node; + } + ts.createCommaList = createCommaList; + function updateCommaList(node, elements) { + return node.elements !== elements + ? updateNode(createCommaList(elements), node) + : node; + } + ts.updateCommaList = updateCommaList; + function createBundle(sourceFiles) { + var node = ts.createNode(266); + node.sourceFiles = sourceFiles; + return node; + } + ts.createBundle = createBundle; + function updateBundle(node, sourceFiles) { + if (node.sourceFiles !== sourceFiles) { + return createBundle(sourceFiles); + } + return node; + } + ts.updateBundle = updateBundle; + function createImmediatelyInvokedFunctionExpression(statements, param, paramValue) { + return createCall(createFunctionExpression(undefined, undefined, undefined, undefined, param ? [param] : [], undefined, createBlock(statements, true)), undefined, paramValue ? [paramValue] : []); + } + ts.createImmediatelyInvokedFunctionExpression = createImmediatelyInvokedFunctionExpression; + function createImmediatelyInvokedArrowFunction(statements, param, paramValue) { + return createCall(createArrowFunction(undefined, undefined, param ? [param] : [], undefined, undefined, createBlock(statements, true)), undefined, paramValue ? [paramValue] : []); + } + ts.createImmediatelyInvokedArrowFunction = createImmediatelyInvokedArrowFunction; + function createComma(left, right) { + return createBinary(left, 26, right); + } + ts.createComma = createComma; + function createLessThan(left, right) { + return createBinary(left, 27, right); + } + ts.createLessThan = createLessThan; + function createAssignment(left, right) { + return createBinary(left, 58, right); + } + ts.createAssignment = createAssignment; + function createStrictEquality(left, right) { + return createBinary(left, 34, right); + } + ts.createStrictEquality = createStrictEquality; + function createStrictInequality(left, right) { + return createBinary(left, 35, right); + } + ts.createStrictInequality = createStrictInequality; + function createAdd(left, right) { + return createBinary(left, 37, right); + } + ts.createAdd = createAdd; + function createSubtract(left, right) { + return createBinary(left, 38, right); + } + ts.createSubtract = createSubtract; + function createPostfixIncrement(operand) { + return createPostfix(operand, 43); + } + ts.createPostfixIncrement = createPostfixIncrement; + function createLogicalAnd(left, right) { + return createBinary(left, 53, right); + } + ts.createLogicalAnd = createLogicalAnd; + function createLogicalOr(left, right) { + return createBinary(left, 54, right); + } + ts.createLogicalOr = createLogicalOr; + function createLogicalNot(operand) { + return createPrefix(51, operand); + } + ts.createLogicalNot = createLogicalNot; + function createVoidZero() { + return createVoid(createLiteral(0)); + } + ts.createVoidZero = createVoidZero; + function createExportDefault(expression) { + return createExportAssignment(undefined, undefined, false, expression); + } + ts.createExportDefault = createExportDefault; + function createExternalModuleExport(exportName) { + return createExportDeclaration(undefined, undefined, createNamedExports([createExportSpecifier(undefined, exportName)])); + } + ts.createExternalModuleExport = createExternalModuleExport; + function asName(name) { + return typeof name === "string" ? createIdentifier(name) : name; + } + function asExpression(value) { + return typeof value === "string" || typeof value === "number" ? createLiteral(value) : value; + } + function asNodeArray(array) { + return array ? createNodeArray(array) : undefined; + } + function asToken(value) { + return typeof value === "number" ? createToken(value) : value; + } + function disposeEmitNodes(sourceFile) { + sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(sourceFile)); + var emitNode = sourceFile && sourceFile.emitNode; + var annotatedNodes = emitNode && emitNode.annotatedNodes; + if (annotatedNodes) { + for (var _i = 0, annotatedNodes_1 = annotatedNodes; _i < annotatedNodes_1.length; _i++) { + var node = annotatedNodes_1[_i]; + node.emitNode = undefined; + } + } + } + ts.disposeEmitNodes = disposeEmitNodes; + function getOrCreateEmitNode(node) { + if (!node.emitNode) { + if (ts.isParseTreeNode(node)) { + if (node.kind === 265) { + return node.emitNode = { annotatedNodes: [node] }; + } + var sourceFile = ts.getSourceFileOfNode(node); + getOrCreateEmitNode(sourceFile).annotatedNodes.push(node); + } + node.emitNode = {}; + } + return node.emitNode; + } + ts.getOrCreateEmitNode = getOrCreateEmitNode; + function setTextRange(range, location) { + if (location) { + range.pos = location.pos; + range.end = location.end; + } + return range; + } + ts.setTextRange = setTextRange; + function setEmitFlags(node, emitFlags) { + getOrCreateEmitNode(node).flags = emitFlags; + return node; + } + ts.setEmitFlags = setEmitFlags; + function getSourceMapRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.sourceMapRange) || node; + } + ts.getSourceMapRange = getSourceMapRange; + function setSourceMapRange(node, range) { + getOrCreateEmitNode(node).sourceMapRange = range; + return node; + } + ts.setSourceMapRange = setSourceMapRange; + var SourceMapSource; + function createSourceMapSource(fileName, text, skipTrivia) { + return new (SourceMapSource || (SourceMapSource = ts.objectAllocator.getSourceMapSourceConstructor()))(fileName, text, skipTrivia); + } + ts.createSourceMapSource = createSourceMapSource; + function getTokenSourceMapRange(node, token) { + var emitNode = node.emitNode; + var tokenSourceMapRanges = emitNode && emitNode.tokenSourceMapRanges; + return tokenSourceMapRanges && tokenSourceMapRanges[token]; + } + ts.getTokenSourceMapRange = getTokenSourceMapRange; + function setTokenSourceMapRange(node, token, range) { + var emitNode = getOrCreateEmitNode(node); + var tokenSourceMapRanges = emitNode.tokenSourceMapRanges || (emitNode.tokenSourceMapRanges = []); + tokenSourceMapRanges[token] = range; + return node; + } + ts.setTokenSourceMapRange = setTokenSourceMapRange; + function getCommentRange(node) { + var emitNode = node.emitNode; + return (emitNode && emitNode.commentRange) || node; + } + ts.getCommentRange = getCommentRange; + function setCommentRange(node, range) { + getOrCreateEmitNode(node).commentRange = range; + return node; + } + ts.setCommentRange = setCommentRange; + function getSyntheticLeadingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.leadingComments; + } + ts.getSyntheticLeadingComments = getSyntheticLeadingComments; + function setSyntheticLeadingComments(node, comments) { + getOrCreateEmitNode(node).leadingComments = comments; + return node; + } + ts.setSyntheticLeadingComments = setSyntheticLeadingComments; + function addSyntheticLeadingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticLeadingComments(node, ts.append(getSyntheticLeadingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticLeadingComment = addSyntheticLeadingComment; + function getSyntheticTrailingComments(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.trailingComments; + } + ts.getSyntheticTrailingComments = getSyntheticTrailingComments; + function setSyntheticTrailingComments(node, comments) { + getOrCreateEmitNode(node).trailingComments = comments; + return node; + } + ts.setSyntheticTrailingComments = setSyntheticTrailingComments; + function addSyntheticTrailingComment(node, kind, text, hasTrailingNewLine) { + return setSyntheticTrailingComments(node, ts.append(getSyntheticTrailingComments(node), { kind: kind, pos: -1, end: -1, hasTrailingNewLine: hasTrailingNewLine, text: text })); + } + ts.addSyntheticTrailingComment = addSyntheticTrailingComment; + function getConstantValue(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.constantValue; + } + ts.getConstantValue = getConstantValue; + function setConstantValue(node, value) { + var emitNode = getOrCreateEmitNode(node); + emitNode.constantValue = value; + return node; + } + ts.setConstantValue = setConstantValue; + function addEmitHelper(node, helper) { + var emitNode = getOrCreateEmitNode(node); + emitNode.helpers = ts.append(emitNode.helpers, helper); + return node; + } + ts.addEmitHelper = addEmitHelper; + function addEmitHelpers(node, helpers) { + if (ts.some(helpers)) { + var emitNode = getOrCreateEmitNode(node); + for (var _i = 0, helpers_1 = helpers; _i < helpers_1.length; _i++) { + var helper = helpers_1[_i]; + if (!ts.contains(emitNode.helpers, helper)) { + emitNode.helpers = ts.append(emitNode.helpers, helper); + } + } + } + return node; + } + ts.addEmitHelpers = addEmitHelpers; + function removeEmitHelper(node, helper) { + var emitNode = node.emitNode; + if (emitNode) { + var helpers = emitNode.helpers; + if (helpers) { + return ts.orderedRemoveItem(helpers, helper); + } + } + return false; + } + ts.removeEmitHelper = removeEmitHelper; + function getEmitHelpers(node) { + var emitNode = node.emitNode; + return emitNode && emitNode.helpers; + } + ts.getEmitHelpers = getEmitHelpers; + function moveEmitHelpers(source, target, predicate) { + var sourceEmitNode = source.emitNode; + var sourceEmitHelpers = sourceEmitNode && sourceEmitNode.helpers; + if (!ts.some(sourceEmitHelpers)) + return; + var targetEmitNode = getOrCreateEmitNode(target); + var helpersRemoved = 0; + for (var i = 0; i < sourceEmitHelpers.length; i++) { + var helper = sourceEmitHelpers[i]; + if (predicate(helper)) { + helpersRemoved++; + if (!ts.contains(targetEmitNode.helpers, helper)) { + targetEmitNode.helpers = ts.append(targetEmitNode.helpers, helper); + } + } + else if (helpersRemoved > 0) { + sourceEmitHelpers[i - helpersRemoved] = helper; + } + } + if (helpersRemoved > 0) { + sourceEmitHelpers.length -= helpersRemoved; + } + } + ts.moveEmitHelpers = moveEmitHelpers; + function compareEmitHelpers(x, y) { + if (x === y) + return 0; + if (x.priority === y.priority) + return 0; + if (x.priority === undefined) + return 1; + if (y.priority === undefined) + return -1; + return ts.compareValues(x.priority, y.priority); + } + ts.compareEmitHelpers = compareEmitHelpers; + function setOriginalNode(node, original) { + node.original = original; + if (original) { + var emitNode = original.emitNode; + if (emitNode) + node.emitNode = mergeEmitNode(emitNode, node.emitNode); + } + return node; + } + ts.setOriginalNode = setOriginalNode; + function mergeEmitNode(sourceEmitNode, destEmitNode) { + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers; + if (!destEmitNode) + destEmitNode = {}; + if (leadingComments) + destEmitNode.leadingComments = ts.addRange(leadingComments.slice(), destEmitNode.leadingComments); + if (trailingComments) + destEmitNode.trailingComments = ts.addRange(trailingComments.slice(), destEmitNode.trailingComments); + if (flags) + destEmitNode.flags = flags; + if (commentRange) + destEmitNode.commentRange = commentRange; + if (sourceMapRange) + destEmitNode.sourceMapRange = sourceMapRange; + if (tokenSourceMapRanges) + destEmitNode.tokenSourceMapRanges = mergeTokenSourceMapRanges(tokenSourceMapRanges, destEmitNode.tokenSourceMapRanges); + if (constantValue !== undefined) + destEmitNode.constantValue = constantValue; + if (helpers) + destEmitNode.helpers = ts.addRange(destEmitNode.helpers, helpers); + return destEmitNode; + } + function mergeTokenSourceMapRanges(sourceRanges, destRanges) { + if (!destRanges) + destRanges = []; + for (var key in sourceRanges) { + destRanges[key] = sourceRanges[key]; + } + return destRanges; + } +})(ts || (ts = {})); +(function (ts) { + ts.nullTransformationContext = { + enableEmitNotification: ts.noop, + enableSubstitution: ts.noop, + endLexicalEnvironment: function () { return undefined; }, + getCompilerOptions: ts.notImplemented, + getEmitHost: ts.notImplemented, + getEmitResolver: ts.notImplemented, + hoistFunctionDeclaration: ts.noop, + hoistVariableDeclaration: ts.noop, + isEmitNotificationEnabled: ts.notImplemented, + isSubstitutionEnabled: ts.notImplemented, + onEmitNode: ts.noop, + onSubstituteNode: ts.notImplemented, + readEmitHelpers: ts.notImplemented, + requestEmitHelper: ts.noop, + resumeLexicalEnvironment: ts.noop, + startLexicalEnvironment: ts.noop, + suspendLexicalEnvironment: ts.noop + }; + function createTypeCheck(value, tag) { + return tag === "undefined" + ? ts.createStrictEquality(value, ts.createVoidZero()) + : ts.createStrictEquality(ts.createTypeOf(value), ts.createLiteral(tag)); + } + ts.createTypeCheck = createTypeCheck; + function createMemberAccessForPropertyName(target, memberName, location) { + if (ts.isComputedPropertyName(memberName)) { + return ts.setTextRange(ts.createElementAccess(target, memberName.expression), location); + } + else { + var expression = ts.setTextRange(ts.isIdentifier(memberName) + ? ts.createPropertyAccess(target, memberName) + : ts.createElementAccess(target, memberName), memberName); + ts.getOrCreateEmitNode(expression).flags |= 64; + return expression; + } + } + ts.createMemberAccessForPropertyName = createMemberAccessForPropertyName; + function createFunctionCall(func, thisArg, argumentsList, location) { + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "call"), undefined, [ + thisArg + ].concat(argumentsList)), location); + } + ts.createFunctionCall = createFunctionCall; + function createFunctionApply(func, thisArg, argumentsExpression, location) { + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(func, "apply"), undefined, [ + thisArg, + argumentsExpression + ]), location); + } + ts.createFunctionApply = createFunctionApply; + function createArraySlice(array, start) { + var argumentsList = []; + if (start !== undefined) { + argumentsList.push(typeof start === "number" ? ts.createLiteral(start) : start); + } + return ts.createCall(ts.createPropertyAccess(array, "slice"), undefined, argumentsList); + } + ts.createArraySlice = createArraySlice; + function createArrayConcat(array, values) { + return ts.createCall(ts.createPropertyAccess(array, "concat"), undefined, values); + } + ts.createArrayConcat = createArrayConcat; + function createMathPow(left, right, location) { + return ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Math"), "pow"), undefined, [left, right]), location); + } + ts.createMathPow = createMathPow; + function createReactNamespace(reactNamespace, parent) { + var react = ts.createIdentifier(reactNamespace || "React"); + react.flags &= ~8; + react.parent = ts.getParseTreeNode(parent); + return react; + } + function createJsxFactoryExpressionFromEntityName(jsxFactory, parent) { + if (ts.isQualifiedName(jsxFactory)) { + var left = createJsxFactoryExpressionFromEntityName(jsxFactory.left, parent); + var right = ts.createIdentifier(ts.unescapeLeadingUnderscores(jsxFactory.right.escapedText)); + right.escapedText = jsxFactory.right.escapedText; + return ts.createPropertyAccess(left, right); + } + else { + return createReactNamespace(ts.unescapeLeadingUnderscores(jsxFactory.escapedText), parent); + } + } + function createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parent) { + return jsxFactoryEntity ? + createJsxFactoryExpressionFromEntityName(jsxFactoryEntity, parent) : + ts.createPropertyAccess(createReactNamespace(reactNamespace, parent), "createElement"); + } + function createExpressionForJsxElement(jsxFactoryEntity, reactNamespace, tagName, props, children, parentElement, location) { + var argumentsList = [tagName]; + if (props) { + argumentsList.push(props); + } + if (children && children.length > 0) { + if (!props) { + argumentsList.push(ts.createNull()); + } + if (children.length > 1) { + for (var _i = 0, children_1 = children; _i < children_1.length; _i++) { + var child = children_1[_i]; + child.startsOnNewLine = true; + argumentsList.push(child); + } + } + else { + argumentsList.push(children[0]); + } + } + return ts.setTextRange(ts.createCall(createJsxFactoryExpression(jsxFactoryEntity, reactNamespace, parentElement), undefined, argumentsList), location); + } + ts.createExpressionForJsxElement = createExpressionForJsxElement; + function getHelperName(name) { + return ts.setEmitFlags(ts.createIdentifier(name), 4096 | 2); + } + ts.getHelperName = getHelperName; + var valuesHelper = { + name: "typescript:values", + scoped: false, + text: "\n var __values = (this && this.__values) || function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m) return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };\n " + }; + function createValuesHelper(context, expression, location) { + context.requestEmitHelper(valuesHelper); + return ts.setTextRange(ts.createCall(getHelperName("__values"), undefined, [expression]), location); + } + ts.createValuesHelper = createValuesHelper; + var readHelper = { + name: "typescript:read", + scoped: false, + text: "\n var __read = (this && this.__read) || function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n };\n " + }; + function createReadHelper(context, iteratorRecord, count, location) { + context.requestEmitHelper(readHelper); + return ts.setTextRange(ts.createCall(getHelperName("__read"), undefined, count !== undefined + ? [iteratorRecord, ts.createLiteral(count)] + : [iteratorRecord]), location); + } + ts.createReadHelper = createReadHelper; + var spreadHelper = { + name: "typescript:spread", + scoped: false, + text: "\n var __spread = (this && this.__spread) || function () {\n for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i]));\n return ar;\n };" + }; + function createSpreadHelper(context, argumentList, location) { + context.requestEmitHelper(readHelper); + context.requestEmitHelper(spreadHelper); + return ts.setTextRange(ts.createCall(getHelperName("__spread"), undefined, argumentList), location); + } + ts.createSpreadHelper = createSpreadHelper; + function createForOfBindingStatement(node, boundValue) { + if (ts.isVariableDeclarationList(node)) { + var firstDeclaration = ts.firstOrUndefined(node.declarations); + var updatedDeclaration = ts.updateVariableDeclaration(firstDeclaration, firstDeclaration.name, undefined, boundValue); + return ts.setTextRange(ts.createVariableStatement(undefined, ts.updateVariableDeclarationList(node, [updatedDeclaration])), node); + } + else { + var updatedExpression = ts.setTextRange(ts.createAssignment(node, boundValue), node); + return ts.setTextRange(ts.createStatement(updatedExpression), node); + } + } + ts.createForOfBindingStatement = createForOfBindingStatement; + function insertLeadingStatement(dest, source) { + if (ts.isBlock(dest)) { + return ts.updateBlock(dest, ts.setTextRange(ts.createNodeArray([source].concat(dest.statements)), dest.statements)); + } + else { + return ts.createBlock(ts.createNodeArray([dest, source]), true); + } + } + ts.insertLeadingStatement = insertLeadingStatement; + function restoreEnclosingLabel(node, outermostLabeledStatement, afterRestoreLabelCallback) { + if (!outermostLabeledStatement) { + return node; + } + var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 222 + ? restoreEnclosingLabel(node, outermostLabeledStatement.statement) + : node); + if (afterRestoreLabelCallback) { + afterRestoreLabelCallback(outermostLabeledStatement); + } + return updated; + } + ts.restoreEnclosingLabel = restoreEnclosingLabel; + function shouldBeCapturedInTempVariable(node, cacheIdentifiers) { + var target = skipParentheses(node); + switch (target.kind) { + case 71: + return cacheIdentifiers; + case 99: + case 8: + case 9: + return false; + case 177: + var elements = target.elements; + if (elements.length === 0) { + return false; + } + return true; + case 178: + return target.properties.length > 0; + default: + return true; + } + } + function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) { + var callee = skipOuterExpressions(expression, 7); + var thisArg; + var target; + if (ts.isSuperProperty(callee)) { + thisArg = ts.createThis(); + target = callee; + } + else if (callee.kind === 97) { + thisArg = ts.createThis(); + target = languageVersion < 2 + ? ts.setTextRange(ts.createIdentifier("_super"), callee) + : callee; + } + else if (ts.getEmitFlags(callee) & 4096) { + thisArg = ts.createVoidZero(); + target = parenthesizeForAccess(callee); + } + else { + switch (callee.kind) { + case 179: { + if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.name); + ts.setTextRange(target, callee); + } + else { + thisArg = callee.expression; + target = callee; + } + break; + } + case 180: { + if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) { + thisArg = ts.createTempVariable(recordTempVariable); + target = ts.createElementAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression); + ts.setTextRange(target, callee); + } + else { + thisArg = callee.expression; + target = callee; + } + break; + } + default: { + thisArg = ts.createVoidZero(); + target = parenthesizeForAccess(expression); + break; + } + } + } + return { target: target, thisArg: thisArg }; + } + ts.createCallBinding = createCallBinding; + function inlineExpressions(expressions) { + return expressions.length > 10 + ? ts.createCommaList(expressions) + : ts.reduceLeft(expressions, ts.createComma); + } + ts.inlineExpressions = inlineExpressions; + function createExpressionFromEntityName(node) { + if (ts.isQualifiedName(node)) { + var left = createExpressionFromEntityName(node.left); + var right = ts.getMutableClone(node.right); + return ts.setTextRange(ts.createPropertyAccess(left, right), node); + } + else { + return ts.getMutableClone(node); + } + } + ts.createExpressionFromEntityName = createExpressionFromEntityName; + function createExpressionForPropertyName(memberName) { + if (ts.isIdentifier(memberName)) { + return ts.createLiteral(memberName); + } + else if (ts.isComputedPropertyName(memberName)) { + return ts.getMutableClone(memberName.expression); + } + else { + return ts.getMutableClone(memberName); + } + } + ts.createExpressionForPropertyName = createExpressionForPropertyName; + function createExpressionForObjectLiteralElementLike(node, property, receiver) { + switch (property.kind) { + case 153: + case 154: + return createExpressionForAccessorDeclaration(node.properties, property, receiver, node.multiLine); + case 261: + return createExpressionForPropertyAssignment(property, receiver); + case 262: + return createExpressionForShorthandPropertyAssignment(property, receiver); + case 151: + return createExpressionForMethodDeclaration(property, receiver); + } + } + ts.createExpressionForObjectLiteralElementLike = createExpressionForObjectLiteralElementLike; + function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) { + var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor; + if (property === firstAccessor) { + var properties_9 = []; + if (getAccessor) { + var getterFunction = ts.createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body); + ts.setTextRange(getterFunction, getAccessor); + ts.setOriginalNode(getterFunction, getAccessor); + var getter = ts.createPropertyAssignment("get", getterFunction); + properties_9.push(getter); + } + if (setAccessor) { + var setterFunction = ts.createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body); + ts.setTextRange(setterFunction, setAccessor); + ts.setOriginalNode(setterFunction, setAccessor); + var setter = ts.createPropertyAssignment("set", setterFunction); + properties_9.push(setter); + } + properties_9.push(ts.createPropertyAssignment("enumerable", ts.createTrue())); + properties_9.push(ts.createPropertyAssignment("configurable", ts.createTrue())); + var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [ + receiver, + createExpressionForPropertyName(property.name), + ts.createObjectLiteral(properties_9, multiLine) + ]), firstAccessor); + return ts.aggregateTransformFlags(expression); + } + return undefined; + } + function createExpressionForPropertyAssignment(property, receiver) { + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), property.initializer), property), property)); + } + function createExpressionForShorthandPropertyAssignment(property, receiver) { + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, property.name, property.name), ts.getSynthesizedClone(property.name)), property), property)); + } + function createExpressionForMethodDeclaration(method, receiver) { + return ts.aggregateTransformFlags(ts.setOriginalNode(ts.setTextRange(ts.createAssignment(createMemberAccessForPropertyName(receiver, method.name, method.name), ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(method.modifiers, method.asteriskToken, undefined, undefined, method.parameters, undefined, method.body), method), method)), method), method)); + } + function getInternalName(node, allowComments, allowSourceMaps) { + return getName(node, allowComments, allowSourceMaps, 16384 | 32768); + } + ts.getInternalName = getInternalName; + function isInternalName(node) { + return (ts.getEmitFlags(node) & 32768) !== 0; + } + ts.isInternalName = isInternalName; + function getLocalName(node, allowComments, allowSourceMaps) { + return getName(node, allowComments, allowSourceMaps, 16384); + } + ts.getLocalName = getLocalName; + function isLocalName(node) { + return (ts.getEmitFlags(node) & 16384) !== 0; + } + ts.isLocalName = isLocalName; + function getExportName(node, allowComments, allowSourceMaps) { + return getName(node, allowComments, allowSourceMaps, 8192); + } + ts.getExportName = getExportName; + function isExportName(node) { + return (ts.getEmitFlags(node) & 8192) !== 0; + } + ts.isExportName = isExportName; + function getDeclarationName(node, allowComments, allowSourceMaps) { + return getName(node, allowComments, allowSourceMaps); + } + ts.getDeclarationName = getDeclarationName; + function getName(node, allowComments, allowSourceMaps, emitFlags) { + var nodeName = ts.getNameOfDeclaration(node); + if (nodeName && ts.isIdentifier(nodeName) && !ts.isGeneratedIdentifier(nodeName)) { + var name = ts.getMutableClone(nodeName); + emitFlags |= ts.getEmitFlags(nodeName); + if (!allowSourceMaps) + emitFlags |= 48; + if (!allowComments) + emitFlags |= 1536; + if (emitFlags) + ts.setEmitFlags(name, emitFlags); + return name; + } + return ts.getGeneratedNameForNode(node); + } + function getExternalModuleOrNamespaceExportName(ns, node, allowComments, allowSourceMaps) { + if (ns && ts.hasModifier(node, 1)) { + return getNamespaceMemberName(ns, getName(node), allowComments, allowSourceMaps); + } + return getExportName(node, allowComments, allowSourceMaps); + } + ts.getExternalModuleOrNamespaceExportName = getExternalModuleOrNamespaceExportName; + function getNamespaceMemberName(ns, name, allowComments, allowSourceMaps) { + var qualifiedName = ts.createPropertyAccess(ns, ts.nodeIsSynthesized(name) ? name : ts.getSynthesizedClone(name)); + ts.setTextRange(qualifiedName, name); + var emitFlags; + if (!allowSourceMaps) + emitFlags |= 48; + if (!allowComments) + emitFlags |= 1536; + if (emitFlags) + ts.setEmitFlags(qualifiedName, emitFlags); + return qualifiedName; + } + ts.getNamespaceMemberName = getNamespaceMemberName; + function convertToFunctionBody(node, multiLine) { + return ts.isBlock(node) ? node : ts.setTextRange(ts.createBlock([ts.setTextRange(ts.createReturn(node), node)], multiLine), node); + } + ts.convertToFunctionBody = convertToFunctionBody; + function convertFunctionDeclarationToExpression(node) { + ts.Debug.assert(!!node.body); + var updated = ts.createFunctionExpression(node.modifiers, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body); + ts.setOriginalNode(updated, node); + ts.setTextRange(updated, node); + if (node.startsOnNewLine) { + updated.startsOnNewLine = true; + } + ts.aggregateTransformFlags(updated); + return updated; + } + ts.convertFunctionDeclarationToExpression = convertFunctionDeclarationToExpression; + function isUseStrictPrologue(node) { + return ts.isStringLiteral(node.expression) && node.expression.text === "use strict"; + } + function addPrologue(target, source, ensureUseStrict, visitor) { + var offset = addStandardPrologue(target, source, ensureUseStrict); + return addCustomPrologue(target, source, offset, visitor); + } + ts.addPrologue = addPrologue; + function addStandardPrologue(target, source, ensureUseStrict) { + ts.Debug.assert(target.length === 0, "Prologue directives should be at the first statement in the target statements array"); + var foundUseStrict = false; + var statementOffset = 0; + var numStatements = source.length; + while (statementOffset < numStatements) { + var statement = source[statementOffset]; + if (ts.isPrologueDirective(statement)) { + if (isUseStrictPrologue(statement)) { + foundUseStrict = true; + } + target.push(statement); + } + else { + break; + } + statementOffset++; + } + if (ensureUseStrict && !foundUseStrict) { + target.push(startOnNewLine(ts.createStatement(ts.createLiteral("use strict")))); + } + return statementOffset; + } + ts.addStandardPrologue = addStandardPrologue; + function addCustomPrologue(target, source, statementOffset, visitor) { + var numStatements = source.length; + while (statementOffset < numStatements) { + var statement = source[statementOffset]; + if (ts.getEmitFlags(statement) & 1048576) { + target.push(visitor ? ts.visitNode(statement, visitor, ts.isStatement) : statement); + } + else { + break; + } + statementOffset++; + } + return statementOffset; + } + ts.addCustomPrologue = addCustomPrologue; + function startsWithUseStrict(statements) { + var firstStatement = ts.firstOrUndefined(statements); + return firstStatement !== undefined + && ts.isPrologueDirective(firstStatement) + && isUseStrictPrologue(firstStatement); + } + ts.startsWithUseStrict = startsWithUseStrict; + function ensureUseStrict(statements) { + var foundUseStrict = false; + for (var _i = 0, statements_3 = statements; _i < statements_3.length; _i++) { + var statement = statements_3[_i]; + if (ts.isPrologueDirective(statement)) { + if (isUseStrictPrologue(statement)) { + foundUseStrict = true; + break; + } + } + else { + break; + } + } + if (!foundUseStrict) { + return ts.setTextRange(ts.createNodeArray([ + startOnNewLine(ts.createStatement(ts.createLiteral("use strict"))) + ].concat(statements)), statements); + } + return statements; + } + ts.ensureUseStrict = ensureUseStrict; + function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { + var skipped = ts.skipPartiallyEmittedExpressions(operand); + if (skipped.kind === 185) { + return operand; + } + return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) + ? ts.createParen(operand) + : operand; + } + ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand; + function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { + var binaryOperatorPrecedence = ts.getOperatorPrecedence(194, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(194, binaryOperator); + var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); + var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); + switch (ts.compareValues(operandPrecedence, binaryOperatorPrecedence)) { + case -1: + if (!isLeftSideOfBinary + && binaryOperatorAssociativity === 1 + && operand.kind === 197) { + return false; + } + return true; + case 1: + return false; + case 0: + if (isLeftSideOfBinary) { + return binaryOperatorAssociativity === 1; + } + else { + if (ts.isBinaryExpression(emittedOperand) + && emittedOperand.operatorToken.kind === binaryOperator) { + if (operatorHasAssociativeProperty(binaryOperator)) { + return false; + } + if (binaryOperator === 37) { + var leftKind = leftOperand ? getLiteralKindOfBinaryPlusOperand(leftOperand) : 0; + if (ts.isLiteralKind(leftKind) && leftKind === getLiteralKindOfBinaryPlusOperand(emittedOperand)) { + return false; + } + } + } + var operandAssociativity = ts.getExpressionAssociativity(emittedOperand); + return operandAssociativity === 0; + } + } + } + function operatorHasAssociativeProperty(binaryOperator) { + return binaryOperator === 39 + || binaryOperator === 49 + || binaryOperator === 48 + || binaryOperator === 50; + } + function getLiteralKindOfBinaryPlusOperand(node) { + node = ts.skipPartiallyEmittedExpressions(node); + if (ts.isLiteralKind(node.kind)) { + return node.kind; + } + if (node.kind === 194 && node.operatorToken.kind === 37) { + if (node.cachedLiteralKind !== undefined) { + return node.cachedLiteralKind; + } + var leftKind = getLiteralKindOfBinaryPlusOperand(node.left); + var literalKind = ts.isLiteralKind(leftKind) + && leftKind === getLiteralKindOfBinaryPlusOperand(node.right) + ? leftKind + : 0; + node.cachedLiteralKind = literalKind; + return literalKind; + } + return 0; + } + function parenthesizeForConditionalHead(condition) { + var conditionalPrecedence = ts.getOperatorPrecedence(195, 55); + var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); + var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); + if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) { + return ts.createParen(condition); + } + return condition; + } + ts.parenthesizeForConditionalHead = parenthesizeForConditionalHead; + function parenthesizeSubexpressionOfConditionalExpression(e) { + return e.kind === 194 && e.operatorToken.kind === 26 + ? ts.createParen(e) + : e; + } + ts.parenthesizeSubexpressionOfConditionalExpression = parenthesizeSubexpressionOfConditionalExpression; + function parenthesizeForNew(expression) { + var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); + switch (emittedExpression.kind) { + case 181: + return ts.createParen(expression); + case 182: + return emittedExpression.arguments + ? expression + : ts.createParen(expression); + } + return parenthesizeForAccess(expression); + } + ts.parenthesizeForNew = parenthesizeForNew; + function parenthesizeForAccess(expression) { + var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); + if (ts.isLeftHandSideExpression(emittedExpression) + && (emittedExpression.kind !== 182 || emittedExpression.arguments)) { + return expression; + } + return ts.setTextRange(ts.createParen(expression), expression); + } + ts.parenthesizeForAccess = parenthesizeForAccess; + function parenthesizePostfixOperand(operand) { + return ts.isLeftHandSideExpression(operand) + ? operand + : ts.setTextRange(ts.createParen(operand), operand); + } + ts.parenthesizePostfixOperand = parenthesizePostfixOperand; + function parenthesizePrefixOperand(operand) { + return ts.isUnaryExpression(operand) + ? operand + : ts.setTextRange(ts.createParen(operand), operand); + } + ts.parenthesizePrefixOperand = parenthesizePrefixOperand; + function parenthesizeListElements(elements) { + var result; + for (var i = 0; i < elements.length; i++) { + var element = parenthesizeExpressionForList(elements[i]); + if (result !== undefined || element !== elements[i]) { + if (result === undefined) { + result = elements.slice(0, i); + } + result.push(element); + } + } + if (result !== undefined) { + return ts.setTextRange(ts.createNodeArray(result, elements.hasTrailingComma), elements); + } + return elements; + } + ts.parenthesizeListElements = parenthesizeListElements; + function parenthesizeExpressionForList(expression) { + var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); + var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); + var commaPrecedence = ts.getOperatorPrecedence(194, 26); + return expressionPrecedence > commaPrecedence + ? expression + : ts.setTextRange(ts.createParen(expression), expression); + } + ts.parenthesizeExpressionForList = parenthesizeExpressionForList; + function parenthesizeExpressionForExpressionStatement(expression) { + var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); + if (ts.isCallExpression(emittedExpression)) { + var callee = emittedExpression.expression; + var kind = ts.skipPartiallyEmittedExpressions(callee).kind; + if (kind === 186 || kind === 187) { + var mutableCall = ts.getMutableClone(emittedExpression); + mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee); + return recreateOuterExpressions(expression, mutableCall, 4); + } + } + else { + var leftmostExpressionKind = getLeftmostExpression(emittedExpression).kind; + if (leftmostExpressionKind === 178 || leftmostExpressionKind === 186) { + return ts.setTextRange(ts.createParen(expression), expression); + } + } + return expression; + } + ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement; + function parenthesizeElementTypeMember(member) { + switch (member.kind) { + case 166: + case 167: + case 160: + case 161: + return ts.createParenthesizedType(member); + } + return member; + } + ts.parenthesizeElementTypeMember = parenthesizeElementTypeMember; + function parenthesizeArrayTypeMember(member) { + switch (member.kind) { + case 162: + case 170: + return ts.createParenthesizedType(member); + } + return parenthesizeElementTypeMember(member); + } + ts.parenthesizeArrayTypeMember = parenthesizeArrayTypeMember; + function parenthesizeElementTypeMembers(members) { + return ts.createNodeArray(ts.sameMap(members, parenthesizeElementTypeMember)); + } + ts.parenthesizeElementTypeMembers = parenthesizeElementTypeMembers; + function parenthesizeTypeParameters(typeParameters) { + if (ts.some(typeParameters)) { + var params = []; + for (var i = 0; i < typeParameters.length; ++i) { + var entry = typeParameters[i]; + params.push(i === 0 && ts.isFunctionOrConstructorTypeNode(entry) && entry.typeParameters ? + ts.createParenthesizedType(entry) : + entry); + } + return ts.createNodeArray(params); + } + } + ts.parenthesizeTypeParameters = parenthesizeTypeParameters; + function getLeftmostExpression(node) { + while (true) { + switch (node.kind) { + case 193: + node = node.operand; + continue; + case 194: + node = node.left; + continue; + case 195: + node = node.condition; + continue; + case 181: + case 180: + case 179: + node = node.expression; + continue; + case 288: + node = node.expression; + continue; + } + return node; + } + } + function parenthesizeConciseBody(body) { + if (!ts.isBlock(body) && getLeftmostExpression(body).kind === 178) { + return ts.setTextRange(ts.createParen(body), body); + } + return body; + } + ts.parenthesizeConciseBody = parenthesizeConciseBody; + var OuterExpressionKinds; + (function (OuterExpressionKinds) { + OuterExpressionKinds[OuterExpressionKinds["Parentheses"] = 1] = "Parentheses"; + OuterExpressionKinds[OuterExpressionKinds["Assertions"] = 2] = "Assertions"; + OuterExpressionKinds[OuterExpressionKinds["PartiallyEmittedExpressions"] = 4] = "PartiallyEmittedExpressions"; + OuterExpressionKinds[OuterExpressionKinds["All"] = 7] = "All"; + })(OuterExpressionKinds = ts.OuterExpressionKinds || (ts.OuterExpressionKinds = {})); + function isOuterExpression(node, kinds) { + if (kinds === void 0) { kinds = 7; } + switch (node.kind) { + case 185: + return (kinds & 1) !== 0; + case 184: + case 202: + case 203: + return (kinds & 2) !== 0; + case 288: + return (kinds & 4) !== 0; + } + return false; + } + ts.isOuterExpression = isOuterExpression; + function skipOuterExpressions(node, kinds) { + if (kinds === void 0) { kinds = 7; } + var previousNode; + do { + previousNode = node; + if (kinds & 1) { + node = skipParentheses(node); + } + if (kinds & 2) { + node = skipAssertions(node); + } + if (kinds & 4) { + node = ts.skipPartiallyEmittedExpressions(node); + } + } while (previousNode !== node); + return node; + } + ts.skipOuterExpressions = skipOuterExpressions; + function skipParentheses(node) { + while (node.kind === 185) { + node = node.expression; + } + return node; + } + ts.skipParentheses = skipParentheses; + function skipAssertions(node) { + while (ts.isAssertionExpression(node) || node.kind === 203) { + node = node.expression; + } + return node; + } + ts.skipAssertions = skipAssertions; + function updateOuterExpression(outerExpression, expression) { + switch (outerExpression.kind) { + case 185: return ts.updateParen(outerExpression, expression); + case 184: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 202: return ts.updateAsExpression(outerExpression, expression, outerExpression.type); + case 203: return ts.updateNonNullExpression(outerExpression, expression); + case 288: return ts.updatePartiallyEmittedExpression(outerExpression, expression); + } + } + function isIgnorableParen(node) { + return node.kind === 185 + && ts.nodeIsSynthesized(node) + && ts.nodeIsSynthesized(ts.getSourceMapRange(node)) + && ts.nodeIsSynthesized(ts.getCommentRange(node)) + && !ts.some(ts.getSyntheticLeadingComments(node)) + && !ts.some(ts.getSyntheticTrailingComments(node)); + } + function recreateOuterExpressions(outerExpression, innerExpression, kinds) { + if (kinds === void 0) { kinds = 7; } + if (outerExpression && isOuterExpression(outerExpression, kinds) && !isIgnorableParen(outerExpression)) { + return updateOuterExpression(outerExpression, recreateOuterExpressions(outerExpression.expression, innerExpression)); + } + return innerExpression; + } + ts.recreateOuterExpressions = recreateOuterExpressions; + function startOnNewLine(node) { + node.startsOnNewLine = true; + return node; + } + ts.startOnNewLine = startOnNewLine; + function getExternalHelpersModuleName(node) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = parseNode && parseNode.emitNode; + return emitNode && emitNode.externalHelpersModuleName; + } + ts.getExternalHelpersModuleName = getExternalHelpersModuleName; + function getOrCreateExternalHelpersModuleNameIfNeeded(node, compilerOptions, hasExportStarsToExportValues) { + if (compilerOptions.importHelpers && ts.isEffectiveExternalModule(node, compilerOptions)) { + var externalHelpersModuleName = getExternalHelpersModuleName(node); + if (externalHelpersModuleName) { + return externalHelpersModuleName; + } + var moduleKind = ts.getEmitModuleKind(compilerOptions); + var create = hasExportStarsToExportValues + && moduleKind !== ts.ModuleKind.System + && moduleKind !== ts.ModuleKind.ES2015; + if (!create) { + var helpers = ts.getEmitHelpers(node); + if (helpers) { + for (var _i = 0, helpers_2 = helpers; _i < helpers_2.length; _i++) { + var helper = helpers_2[_i]; + if (!helper.scoped) { + create = true; + break; + } + } + } + } + if (create) { + var parseNode = ts.getOriginalNode(node, ts.isSourceFile); + var emitNode = ts.getOrCreateEmitNode(parseNode); + return emitNode.externalHelpersModuleName || (emitNode.externalHelpersModuleName = ts.createUniqueName(ts.externalHelpersModuleNameText)); + } + } + } + ts.getOrCreateExternalHelpersModuleNameIfNeeded = getOrCreateExternalHelpersModuleNameIfNeeded; + function getLocalNameForExternalImport(node, sourceFile) { + var namespaceDeclaration = ts.getNamespaceDeclarationNode(node); + if (namespaceDeclaration && !ts.isDefaultImport(node)) { + var name = namespaceDeclaration.name; + return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, namespaceDeclaration.name)); + } + if (node.kind === 238 && node.importClause) { + return ts.getGeneratedNameForNode(node); + } + if (node.kind === 244 && node.moduleSpecifier) { + return ts.getGeneratedNameForNode(node); + } + return undefined; + } + ts.getLocalNameForExternalImport = getLocalNameForExternalImport; + function getExternalModuleNameLiteral(importNode, sourceFile, host, resolver, compilerOptions) { + var moduleName = ts.getExternalModuleName(importNode); + if (moduleName.kind === 9) { + return tryGetModuleNameFromDeclaration(importNode, host, resolver, compilerOptions) + || tryRenameExternalModule(moduleName, sourceFile) + || ts.getSynthesizedClone(moduleName); + } + return undefined; + } + ts.getExternalModuleNameLiteral = getExternalModuleNameLiteral; + function tryRenameExternalModule(moduleName, sourceFile) { + var rename = sourceFile.renamedDependencies && sourceFile.renamedDependencies.get(moduleName.text); + return rename && ts.createLiteral(rename); + } + function tryGetModuleNameFromFile(file, host, options) { + if (!file) { + return undefined; + } + if (file.moduleName) { + return ts.createLiteral(file.moduleName); + } + if (!file.isDeclarationFile && (options.out || options.outFile)) { + return ts.createLiteral(ts.getExternalModuleNameFromPath(host, file.fileName)); + } + return undefined; + } + ts.tryGetModuleNameFromFile = tryGetModuleNameFromFile; + function tryGetModuleNameFromDeclaration(declaration, host, resolver, compilerOptions) { + return tryGetModuleNameFromFile(resolver.getExternalModuleFileFromDeclaration(declaration), host, compilerOptions); + } + function getInitializerOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + return bindingElement.initializer; + } + if (ts.isPropertyAssignment(bindingElement)) { + return ts.isAssignmentExpression(bindingElement.initializer, true) + ? bindingElement.initializer.right + : undefined; + } + if (ts.isShorthandPropertyAssignment(bindingElement)) { + return bindingElement.objectAssignmentInitializer; + } + if (ts.isAssignmentExpression(bindingElement, true)) { + return bindingElement.right; + } + if (ts.isSpreadElement(bindingElement)) { + return getInitializerOfBindingOrAssignmentElement(bindingElement.expression); + } + } + ts.getInitializerOfBindingOrAssignmentElement = getInitializerOfBindingOrAssignmentElement; + function getTargetOfBindingOrAssignmentElement(bindingElement) { + if (ts.isDeclarationBindingElement(bindingElement)) { + return bindingElement.name; + } + if (ts.isObjectLiteralElementLike(bindingElement)) { + switch (bindingElement.kind) { + case 261: + return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); + case 262: + return bindingElement.name; + case 263: + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + return undefined; + } + if (ts.isAssignmentExpression(bindingElement, true)) { + return getTargetOfBindingOrAssignmentElement(bindingElement.left); + } + if (ts.isSpreadElement(bindingElement)) { + return getTargetOfBindingOrAssignmentElement(bindingElement.expression); + } + return bindingElement; + } + ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; + function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 146: + case 176: + return bindingElement.dotDotDotToken; + case 198: + case 263: + return bindingElement; + } + return undefined; + } + ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement; + function getPropertyNameOfBindingOrAssignmentElement(bindingElement) { + switch (bindingElement.kind) { + case 176: + if (bindingElement.propertyName) { + var propertyName = bindingElement.propertyName; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 261: + if (bindingElement.name) { + var propertyName = bindingElement.name; + return ts.isComputedPropertyName(propertyName) && ts.isStringOrNumericLiteral(propertyName.expression) + ? propertyName.expression + : propertyName; + } + break; + case 263: + return bindingElement.name; + } + var target = getTargetOfBindingOrAssignmentElement(bindingElement); + if (target && ts.isPropertyName(target)) { + return ts.isComputedPropertyName(target) && ts.isStringOrNumericLiteral(target.expression) + ? target.expression + : target; + } + ts.Debug.fail("Invalid property name for binding element."); + } + ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; + function getElementsOfBindingOrAssignmentPattern(name) { + switch (name.kind) { + case 174: + case 175: + case 177: + return name.elements; + case 178: + return name.properties; + } + } + ts.getElementsOfBindingOrAssignmentPattern = getElementsOfBindingOrAssignmentPattern; + function convertToArrayAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return ts.setOriginalNode(ts.setTextRange(ts.createSpread(element.name), element), element); + } + var expression = convertToAssignmentElementTarget(element.name); + return element.initializer + ? ts.setOriginalNode(ts.setTextRange(ts.createAssignment(expression, element.initializer), element), element) + : expression; + } + ts.Debug.assertNode(element, ts.isExpression); + return element; + } + ts.convertToArrayAssignmentElement = convertToArrayAssignmentElement; + function convertToObjectAssignmentElement(element) { + if (ts.isBindingElement(element)) { + if (element.dotDotDotToken) { + ts.Debug.assertNode(element.name, ts.isIdentifier); + return ts.setOriginalNode(ts.setTextRange(ts.createSpreadAssignment(element.name), element), element); + } + if (element.propertyName) { + var expression = convertToAssignmentElementTarget(element.name); + return ts.setOriginalNode(ts.setTextRange(ts.createPropertyAssignment(element.propertyName, element.initializer ? ts.createAssignment(expression, element.initializer) : expression), element), element); + } + ts.Debug.assertNode(element.name, ts.isIdentifier); + return ts.setOriginalNode(ts.setTextRange(ts.createShorthandPropertyAssignment(element.name, element.initializer), element), element); + } + ts.Debug.assertNode(element, ts.isObjectLiteralElementLike); + return element; + } + ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement; + function convertToAssignmentPattern(node) { + switch (node.kind) { + case 175: + case 177: + return convertToArrayAssignmentPattern(node); + case 174: + case 178: + return convertToObjectAssignmentPattern(node); + } + } + ts.convertToAssignmentPattern = convertToAssignmentPattern; + function convertToObjectAssignmentPattern(node) { + if (ts.isObjectBindingPattern(node)) { + return ts.setOriginalNode(ts.setTextRange(ts.createObjectLiteral(ts.map(node.elements, convertToObjectAssignmentElement)), node), node); + } + ts.Debug.assertNode(node, ts.isObjectLiteralExpression); + return node; + } + ts.convertToObjectAssignmentPattern = convertToObjectAssignmentPattern; + function convertToArrayAssignmentPattern(node) { + if (ts.isArrayBindingPattern(node)) { + return ts.setOriginalNode(ts.setTextRange(ts.createArrayLiteral(ts.map(node.elements, convertToArrayAssignmentElement)), node), node); + } + ts.Debug.assertNode(node, ts.isArrayLiteralExpression); + return node; + } + ts.convertToArrayAssignmentPattern = convertToArrayAssignmentPattern; + function convertToAssignmentElementTarget(node) { + if (ts.isBindingPattern(node)) { + return convertToAssignmentPattern(node); + } + ts.Debug.assertNode(node, ts.isExpression); + return node; + } + ts.convertToAssignmentElementTarget = convertToAssignmentElementTarget; })(ts || (ts = {})); var ts; (function (ts) { @@ -43659,7 +44185,7 @@ var ts; case 148: return ts.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 149: - return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); + return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression)); case 150: return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken)); case 151: @@ -43733,7 +44259,7 @@ var ts; case 186: return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); case 187: - return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context)); + return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context)); case 188: return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression)); case 189: @@ -43749,7 +44275,7 @@ var ts; case 194: return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken)); case 195: - return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.whenFalse, visitor, ts.isExpression)); + return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression)); case 196: return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); case 197: @@ -43880,9 +44406,9 @@ var ts; return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression)); case 265: return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 297: + case 288: return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression)); - case 298: + case 289: return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression)); default: return node; @@ -43920,7 +44446,7 @@ var ts; case 209: case 200: case 225: - case 296: + case 287: break; case 143: result = reduceNode(node.left, cbNode, result); @@ -44080,9 +44606,6 @@ var ts; result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.type, cbNode, result); break; - case 203: - result = reduceNode(node.expression, cbNode, result); - break; case 205: result = reduceNode(node.expression, cbNode, result); result = reduceNode(node.literal, cbNode, result); @@ -44281,10 +44804,10 @@ var ts; case 265: result = reduceNodes(node.statements, cbNodes, result); break; - case 297: + case 288: result = reduceNode(node.expression, cbNode, result); break; - case 298: + case 289: result = reduceNodes(node.elements, cbNodes, result); break; default: @@ -44413,6 +44936,147 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + function getOriginalNodeId(node) { + node = ts.getOriginalNode(node); + return node ? ts.getNodeId(node) : 0; + } + ts.getOriginalNodeId = getOriginalNodeId; + function collectExternalModuleInfo(sourceFile, resolver, compilerOptions) { + var externalImports = []; + var exportSpecifiers = ts.createMultiMap(); + var exportedBindings = []; + var uniqueExports = ts.createMap(); + var exportedNames; + var hasExportDefault = false; + var exportEquals = undefined; + var hasExportStarsToExportValues = false; + for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { + var node = _a[_i]; + switch (node.kind) { + case 238: + externalImports.push(node); + break; + case 237: + if (node.moduleReference.kind === 248) { + externalImports.push(node); + } + break; + case 244: + if (node.moduleSpecifier) { + if (!node.exportClause) { + externalImports.push(node); + hasExportStarsToExportValues = true; + } + else { + externalImports.push(node); + } + } + else { + for (var _b = 0, _c = node.exportClause.elements; _b < _c.length; _b++) { + var specifier = _c[_b]; + if (!uniqueExports.get(ts.unescapeLeadingUnderscores(specifier.name.escapedText))) { + var name = specifier.propertyName || specifier.name; + exportSpecifiers.add(ts.unescapeLeadingUnderscores(name.escapedText), specifier); + var decl = resolver.getReferencedImportDeclaration(name) + || resolver.getReferencedValueDeclaration(name); + if (decl) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(decl), specifier.name); + } + uniqueExports.set(ts.unescapeLeadingUnderscores(specifier.name.escapedText), true); + exportedNames = ts.append(exportedNames, specifier.name); + } + } + } + break; + case 243: + if (node.isExportEquals && !exportEquals) { + exportEquals = node; + } + break; + case 208: + if (ts.hasModifier(node, 1)) { + for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) { + var decl = _e[_d]; + exportedNames = collectExportedVariableInfo(decl, uniqueExports, exportedNames); + } + } + break; + case 228: + if (ts.hasModifier(node, 1)) { + if (ts.hasModifier(node, 512)) { + if (!hasExportDefault) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + var name = node.name; + if (!uniqueExports.get(ts.unescapeLeadingUnderscores(name.escapedText))) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name); + uniqueExports.set(ts.unescapeLeadingUnderscores(name.escapedText), true); + exportedNames = ts.append(exportedNames, name); + } + } + } + break; + case 229: + if (ts.hasModifier(node, 1)) { + if (ts.hasModifier(node, 512)) { + if (!hasExportDefault) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), ts.getDeclarationName(node)); + hasExportDefault = true; + } + } + else { + var name = node.name; + if (name && !uniqueExports.get(ts.unescapeLeadingUnderscores(name.escapedText))) { + multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), name); + uniqueExports.set(ts.unescapeLeadingUnderscores(name.escapedText), true); + exportedNames = ts.append(exportedNames, name); + } + } + } + break; + } + } + var externalHelpersModuleName = ts.getOrCreateExternalHelpersModuleNameIfNeeded(sourceFile, compilerOptions, hasExportStarsToExportValues); + var externalHelpersImportDeclaration = externalHelpersModuleName && ts.createImportDeclaration(undefined, undefined, ts.createImportClause(undefined, ts.createNamespaceImport(externalHelpersModuleName)), ts.createLiteral(ts.externalHelpersModuleNameText)); + if (externalHelpersImportDeclaration) { + externalImports.unshift(externalHelpersImportDeclaration); + } + return { externalImports: externalImports, exportSpecifiers: exportSpecifiers, exportEquals: exportEquals, hasExportStarsToExportValues: hasExportStarsToExportValues, exportedBindings: exportedBindings, exportedNames: exportedNames, externalHelpersImportDeclaration: externalHelpersImportDeclaration }; + } + ts.collectExternalModuleInfo = collectExternalModuleInfo; + function collectExportedVariableInfo(decl, uniqueExports, exportedNames) { + if (ts.isBindingPattern(decl.name)) { + for (var _i = 0, _a = decl.name.elements; _i < _a.length; _i++) { + var element = _a[_i]; + if (!ts.isOmittedExpression(element)) { + exportedNames = collectExportedVariableInfo(element, uniqueExports, exportedNames); + } + } + } + else if (!ts.isGeneratedIdentifier(decl.name)) { + if (!uniqueExports.get(ts.unescapeLeadingUnderscores(decl.name.escapedText))) { + uniqueExports.set(ts.unescapeLeadingUnderscores(decl.name.escapedText), true); + exportedNames = ts.append(exportedNames, decl.name); + } + } + return exportedNames; + } + function multiMapSparseArrayAdd(map, key, value) { + var values = map[key]; + if (values) { + values.push(value); + } + else { + map[key] = values = [value]; + } + return values; + } +})(ts || (ts = {})); +var ts; +(function (ts) { var FlattenLevel; (function (FlattenLevel) { FlattenLevel[FlattenLevel["All"] = 0] = "All"; @@ -44608,7 +45272,8 @@ var ts; ? undefined : numElements, location), false, location); } - else if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0)) { + else if (numElements !== 1 && (flattenContext.level < 1 || numElements === 0) + || ts.every(elements, ts.isOmittedExpression)) { var reuseIdentifierExpressions = !ts.isDeclarationBindingElement(parent) || numElements !== 0; value = ensureIdentifier(flattenContext, value, reuseIdentifierExpressions, location); } @@ -44662,11 +45327,11 @@ var ts; } else if (ts.isStringOrNumericLiteral(propertyName)) { var argumentExpression = ts.getSynthesizedClone(propertyName); - argumentExpression.text = ts.unescapeIdentifier(argumentExpression.text); + argumentExpression.text = argumentExpression.text; return ts.createElementAccess(value, argumentExpression); } else { - var name = ts.createIdentifier(ts.unescapeIdentifier(propertyName.text)); + var name = ts.createIdentifier(ts.unescapeLeadingUnderscores(propertyName.escapedText)); return ts.createPropertyAccess(value, name); } } @@ -44815,7 +45480,12 @@ var ts; if (ts.hasModifier(node, 2)) { break; } - recordEmittedDeclarationInScope(node); + if (node.name) { + recordEmittedDeclarationInScope(node); + } + else { + ts.Debug.assert(node.kind === 229 || ts.hasModifier(node, 512)); + } break; } } @@ -45059,8 +45729,10 @@ var ts; ts.setEmitFlags(statement, 1536 | 384); statements.push(statement); ts.addRange(statements, context.endLexicalEnvironment()); + var iife = ts.createImmediatelyInvokedArrowFunction(statements); + ts.setEmitFlags(iife, 33554432); var varStatement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList([ - ts.createVariableDeclaration(ts.getLocalName(node, false, false), undefined, ts.createImmediatelyInvokedFunctionExpression(statements)) + ts.createVariableDeclaration(ts.getLocalName(node, false, false), undefined, iife) ])); ts.setOriginalNode(varStatement, node); ts.setCommentRange(varStatement, node); @@ -45229,8 +45901,8 @@ var ts; && member.initializer !== undefined; } function addInitializedPropertyStatements(statements, properties, receiver) { - for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) { - var property = properties_9[_i]; + for (var _i = 0, properties_10 = properties; _i < properties_10.length; _i++) { + var property = properties_10[_i]; var statement = ts.createStatement(transformInitializedProperty(property, receiver)); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); @@ -45239,8 +45911,8 @@ var ts; } function generateInitializedPropertyExpressions(properties, receiver) { var expressions = []; - for (var _i = 0, properties_10 = properties; _i < properties_10.length; _i++) { - var property = properties_10[_i]; + for (var _i = 0, properties_11 = properties; _i < properties_11.length; _i++) { + var property = properties_11[_i]; var expression = transformInitializedProperty(property, receiver); expression.startsOnNewLine = true; ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); @@ -45513,7 +46185,7 @@ var ts; var numParameters = parameters.length; for (var i = 0; i < numParameters; i++) { var parameter = parameters[i]; - if (i === 0 && ts.isIdentifier(parameter.name) && parameter.name.text === "this") { + if (i === 0 && ts.isIdentifier(parameter.name) && parameter.name.escapedText === "this") { continue; } if (parameter.dotDotDotToken) { @@ -45613,13 +46285,13 @@ var ts; for (var _i = 0, _a = node.types; _i < _a.length; _i++) { var typeNode = _a[_i]; var serializedIndividual = serializeTypeNode(typeNode); - if (ts.isIdentifier(serializedIndividual) && serializedIndividual.text === "Object") { + if (ts.isIdentifier(serializedIndividual) && serializedIndividual.escapedText === "Object") { return serializedIndividual; } else if (serializedUnion) { if (!ts.isIdentifier(serializedUnion) || !ts.isIdentifier(serializedIndividual) || - serializedUnion.text !== serializedIndividual.text) { + serializedUnion.escapedText !== serializedIndividual.escapedText) { return ts.createIdentifier("Object"); } } @@ -45666,7 +46338,7 @@ var ts; var name = ts.getMutableClone(node); name.flags &= ~8; name.original = undefined; - name.parent = currentScope; + name.parent = ts.getParseTreeNode(currentScope); if (useFallback) { return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(name), ts.createLiteral("undefined")), name); } @@ -45700,7 +46372,7 @@ var ts; : name.expression; } else if (ts.isIdentifier(name)) { - return ts.createLiteral(ts.unescapeIdentifier(name.text)); + return ts.createLiteral(ts.unescapeLeadingUnderscores(name.escapedText)); } else { return ts.getSynthesizedClone(name); @@ -45796,7 +46468,7 @@ var ts; return updated; } function visitArrowFunction(node) { - var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); + var updated = ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.equalsGreaterThanToken, ts.visitFunctionBody(node.body, visitor, context)); return updated; } function visitParameter(node) { @@ -45935,24 +46607,24 @@ var ts; && moduleKind !== ts.ModuleKind.System); } function recordEmittedDeclarationInScope(node) { - var name = node.symbol && node.symbol.name; - if (name) { - if (!currentScopeFirstDeclarationsOfName) { - currentScopeFirstDeclarationsOfName = ts.createMap(); - } - if (!currentScopeFirstDeclarationsOfName.has(name)) { - currentScopeFirstDeclarationsOfName.set(name, node); - } + if (!currentScopeFirstDeclarationsOfName) { + currentScopeFirstDeclarationsOfName = ts.createUnderscoreEscapedMap(); + } + var name = declaredNameInScope(node); + if (!currentScopeFirstDeclarationsOfName.has(name)) { + currentScopeFirstDeclarationsOfName.set(name, node); } } function isFirstEmittedDeclarationInScope(node) { if (currentScopeFirstDeclarationsOfName) { - var name = node.symbol && node.symbol.name; - if (name) { - return currentScopeFirstDeclarationsOfName.get(name) === node; - } + var name = declaredNameInScope(node); + return currentScopeFirstDeclarationsOfName.get(name) === node; } - return false; + return true; + } + function declaredNameInScope(node) { + ts.Debug.assertNode(node.name, ts.isIdentifier); + return node.name.escapedText; } function addVarForEnumOrModuleDeclaration(statements, node) { var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([ @@ -45983,7 +46655,7 @@ var ts; if (!shouldEmitModuleDeclaration(node)) { return ts.createNotEmittedStatement(node); } - ts.Debug.assert(ts.isIdentifier(node.name), "TypeScript module should have an Identifier name."); + ts.Debug.assertNode(node.name, ts.isIdentifier, "A TypeScript namespace should have an Identifier name."); enableSubstitutionForNamespaceExports(); var statements = []; var emitFlags = 2; @@ -46151,7 +46823,7 @@ var ts; } function addExportMemberAssignment(statements, node) { var expression = ts.createAssignment(ts.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true), ts.getLocalName(node)); - ts.setSourceMapRange(expression, ts.createRange(node.name.pos, node.end)); + ts.setSourceMapRange(expression, ts.createRange(node.name ? node.name.pos : node.pos, node.end)); var statement = ts.createStatement(expression); ts.setSourceMapRange(statement, ts.createRange(-1, node.end)); statements.push(statement); @@ -46176,7 +46848,7 @@ var ts; function getClassAliasIfNeeded(node) { if (resolver.getNodeCheckFlags(node) & 8388608) { enableSubstitutionForClassAliases(); - var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? ts.unescapeIdentifier(node.name.text) : "default"); + var classAlias = ts.createUniqueName(node.name && !ts.isGeneratedIdentifier(node.name) ? ts.unescapeLeadingUnderscores(node.name.escapedText) : "default"); classAliases[ts.getOriginalNodeId(node)] = classAlias; hoistVariableDeclaration(classAlias); return classAlias; @@ -46449,7 +47121,7 @@ var ts; : ts.visitFunctionBody(node.body, visitor, context)); } function visitArrowFunction(node) { - return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 + return ts.updateArrowFunction(node, ts.visitNodes(node.modifiers, visitor, ts.isModifier), undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.equalsGreaterThanToken, ts.getFunctionFlags(node) & 2 ? transformAsyncFunctionBody(node) : ts.visitFunctionBody(node.body, visitor, context)); } @@ -46557,7 +47229,7 @@ var ts; } function substitutePropertyAccessExpression(node) { if (node.expression.kind === 97) { - return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + return createSuperAccessInAsyncMethod(ts.createLiteral(ts.unescapeLeadingUnderscores(node.name.escapedText)), node); } return node; } @@ -46707,6 +47379,8 @@ var ts; return visitExpressionStatement(node); case 185: return visitParenthesizedExpression(node, noDestructuringValue); + case 260: + return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); } @@ -46756,7 +47430,7 @@ var ts; chunkObject.push(ts.createPropertyAssignment(p.name, ts.visitNode(p.initializer, visitor, ts.isExpression))); } else { - chunkObject.push(e); + chunkObject.push(ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } } } @@ -46781,6 +47455,12 @@ var ts; function visitParenthesizedExpression(node, noDestructuringValue) { return ts.visitEachChild(node, noDestructuringValue ? visitorNoDestructuringValue : visitor, context); } + function visitCatchClause(node) { + if (!node.variableDeclaration) { + return ts.updateCatchClause(node, ts.createVariableDeclaration(ts.createTempVariable(undefined)), ts.visitNode(node.block, visitor, ts.isBlock)); + } + return ts.visitEachChild(node, visitor, context); + } function visitBinaryExpression(node, noDestructuringValue) { if (ts.isDestructuringAssignment(node) && node.left.transformFlags & 1048576) { return ts.flattenDestructuringAssignment(node, visitor, context, 1, !noDestructuringValue); @@ -46940,7 +47620,7 @@ var ts; function visitArrowFunction(node) { var savedEnclosingFunctionFlags = enclosingFunctionFlags; enclosingFunctionFlags = ts.getFunctionFlags(node); - var updated = ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node)); + var updated = ts.updateArrowFunction(node, node.modifiers, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, node.equalsGreaterThanToken, transformFunctionBody(node)); enclosingFunctionFlags = savedEnclosingFunctionFlags; return updated; } @@ -47056,7 +47736,7 @@ var ts; } function substitutePropertyAccessExpression(node) { if (node.expression.kind === 97) { - return createSuperAccessInAsyncMethod(ts.createLiteral(node.name.text), node); + return createSuperAccessInAsyncMethod(ts.createLiteral(ts.unescapeLeadingUnderscores(node.name.escapedText)), node); } return node; } @@ -47227,7 +47907,7 @@ var ts; objectProperties = ts.createAssignHelper(context, segments); } } - var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.filter(ts.map(children, transformJsxChildToExpression), ts.isDefined), node, location); + var element = ts.createExpressionForJsxElement(context.getEmitResolver().getJsxFactoryEntity(), compilerOptions.reactNamespace, tagName, objectProperties, ts.mapDefined(children, transformJsxChildToExpression), node, location); if (isChild) { ts.startOnNewLine(element); } @@ -47314,8 +47994,8 @@ var ts; } else { var name = node.tagName; - if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.text)) { - return ts.createLiteral(name.text); + if (ts.isIdentifier(name) && ts.isIntrinsicJsxName(name.escapedText)) { + return ts.createLiteral(ts.unescapeLeadingUnderscores(name.escapedText)); } else { return ts.createExpressionFromEntityName(name); @@ -47324,11 +48004,11 @@ var ts; } function getAttributeName(node) { var name = node.name; - if (/^[A-Za-z_]\w*$/.test(name.text)) { + if (/^[A-Za-z_]\w*$/.test(ts.unescapeLeadingUnderscores(name.escapedText))) { return name; } else { - return ts.createLiteral(name.text); + return ts.createLiteral(ts.unescapeLeadingUnderscores(name.escapedText)); } } function visitJsxExpression(node) { @@ -47765,58 +48445,12 @@ var ts; && node.kind === 219 && !node.expression; } - function isClassLikeVariableStatement(node) { - if (!ts.isVariableStatement(node)) - return false; - var variable = ts.singleOrUndefined(node.declarationList.declarations); - return variable - && variable.initializer - && ts.isIdentifier(variable.name) - && (ts.isClassLike(variable.initializer) - || (ts.isAssignmentExpression(variable.initializer) - && ts.isIdentifier(variable.initializer.left) - && ts.isClassLike(variable.initializer.right))); - } - function isTypeScriptClassWrapper(node) { - var call = ts.tryCast(node, ts.isCallExpression); - if (!call || ts.isParseTreeNode(call) || - ts.some(call.typeArguments) || - ts.some(call.arguments)) { - return false; - } - var func = ts.tryCast(ts.skipOuterExpressions(call.expression), ts.isFunctionExpression); - if (!func || ts.isParseTreeNode(func) || - ts.some(func.typeParameters) || - ts.some(func.parameters) || - func.type || - !func.body) { - return false; - } - var statements = func.body.statements; - if (statements.length < 2) { - return false; - } - var firstStatement = statements[0]; - if (ts.isParseTreeNode(firstStatement) || - !ts.isClassLike(firstStatement) && - !isClassLikeVariableStatement(firstStatement)) { - return false; - } - var lastStatement = ts.elementAt(statements, -1); - var returnStatement = ts.tryCast(ts.isVariableStatement(lastStatement) ? ts.elementAt(statements, -2) : lastStatement, ts.isReturnStatement); - if (!returnStatement || - !returnStatement.expression || - !ts.isIdentifier(ts.skipOuterExpressions(returnStatement.expression))) { - return false; - } - return true; - } function shouldVisitNode(node) { return (node.transformFlags & 128) !== 0 || convertedLoopState !== undefined - || (hierarchyFacts & 4096 && ts.isStatement(node)) + || (hierarchyFacts & 4096 && (ts.isStatement(node) || (node.kind === 207))) || (ts.isIterationStatement(node, false) && shouldConvertIterationStatementBody(node)) - || isTypeScriptClassWrapper(node); + || (ts.getEmitFlags(node) & 33554432) !== 0; } function visitor(node) { if (shouldVisitNode(node)) { @@ -48001,7 +48635,7 @@ var ts; if (ts.isGeneratedIdentifier(node)) { return node; } - if (node.text !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { + if (node.escapedText !== "arguments" || !resolver.isArgumentsLocalBinding(node)) { return node; } return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = ts.createUniqueName("arguments")); @@ -48009,7 +48643,7 @@ var ts; function visitBreakOrContinueStatement(node) { if (convertedLoopState) { var jump = node.kind === 218 ? 2 : 4; - var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(node.label.text)) || + var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.unescapeLeadingUnderscores(node.label.escapedText))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; @@ -48025,12 +48659,12 @@ var ts; } else { if (node.kind === 218) { - labelMarker = "break-" + node.label.text; - setLabeledJump(convertedLoopState, true, node.label.text, labelMarker); + labelMarker = "break-" + node.label.escapedText; + setLabeledJump(convertedLoopState, true, ts.unescapeLeadingUnderscores(node.label.escapedText), labelMarker); } else { - labelMarker = "continue-" + node.label.text; - setLabeledJump(convertedLoopState, false, node.label.text, labelMarker); + labelMarker = "continue-" + node.label.escapedText; + setLabeledJump(convertedLoopState, false, ts.unescapeLeadingUnderscores(node.label.escapedText), labelMarker); } } var returnExpression = ts.createLiteral(labelMarker); @@ -48094,9 +48728,11 @@ var ts; var outer = ts.createPartiallyEmittedExpression(inner); outer.end = ts.skipTrivia(currentText, node.pos); ts.setEmitFlags(outer, 1536); - return ts.createParen(ts.createCall(outer, undefined, extendsClauseElement + var result = ts.createParen(ts.createCall(outer, undefined, extendsClauseElement ? [ts.visitNode(extendsClauseElement.expression, visitor, ts.isExpression)] : [])); + ts.addSyntheticLeadingComment(result, 3, "* @class "); + return result; } function transformClassBody(node, extendsClauseElement) { var statements = []; @@ -48681,11 +49317,12 @@ var ts; ts.setTextRange(declarationList, node); ts.setCommentRange(declarationList, node); if (node.transformFlags & 8388608 - && (ts.isBindingPattern(node.declarations[0].name) - || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { + && (ts.isBindingPattern(node.declarations[0].name) || ts.isBindingPattern(ts.lastOrUndefined(node.declarations).name))) { var firstDeclaration = ts.firstOrUndefined(declarations); - var lastDeclaration = ts.lastOrUndefined(declarations); - ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + if (firstDeclaration) { + var lastDeclaration = ts.lastOrUndefined(declarations); + ts.setSourceMapRange(declarationList, ts.createRange(firstDeclaration.pos, lastDeclaration.end)); + } } return declarationList; } @@ -48732,10 +49369,10 @@ var ts; return updated; } function recordLabel(node) { - convertedLoopState.labels.set(node.label.text, node.label.text); + convertedLoopState.labels.set(ts.unescapeLeadingUnderscores(node.label.escapedText), true); } function resetLabel(node) { - convertedLoopState.labels.set(node.label.text, undefined); + convertedLoopState.labels.set(ts.unescapeLeadingUnderscores(node.label.escapedText), false); } function visitLabeledStatement(node) { if (convertedLoopState && !convertedLoopState.labels) { @@ -49162,7 +49799,7 @@ var ts; else { loopParameters.push(ts.createParameter(undefined, undefined, undefined, name)); if (resolver.getNodeCheckFlags(decl) & 2097152) { - var outParamName = ts.createUniqueName("out_" + ts.unescapeIdentifier(name.text)); + var outParamName = ts.createUniqueName("out_" + ts.unescapeLeadingUnderscores(name.escapedText)); loopOutParameters.push({ originalName: name, outParamName: outParamName }); } } @@ -49224,6 +49861,7 @@ var ts; function visitCatchClause(node) { var ancestorFacts = enterSubtree(4032, 0); var updated; + ts.Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downleveling ES2015."); if (ts.isBindingPattern(node.variableDeclaration.name)) { var temp = ts.createTempVariable(undefined); var newVariableDeclaration = ts.createVariableDeclaration(temp); @@ -49292,7 +49930,7 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitCallExpression(node) { - if (isTypeScriptClassWrapper(node)) { + if (ts.getEmitFlags(node) & 33554432) { return visitTypeScriptClassWrapper(node); } if (node.transformFlags & 64) { @@ -49301,7 +49939,7 @@ var ts; return ts.updateCall(node, ts.visitNode(node.expression, callExpressionVisitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } function visitTypeScriptClassWrapper(node) { - var body = ts.cast(ts.skipOuterExpressions(node.expression), ts.isFunctionExpression).body; + var body = ts.cast(ts.cast(ts.skipOuterExpressions(node.expression), ts.isArrowFunction).body, ts.isBlock); var classStatements = ts.visitNodes(body.statements, visitor, ts.isStatement, 0, 1); var remainingStatements = ts.visitNodes(body.statements, visitor, ts.isStatement, 1, body.statements.length - 1); var varStatement = ts.cast(ts.firstOrUndefined(classStatements), ts.isVariableStatement); @@ -49378,7 +50016,7 @@ var ts; if (ts.isCallExpression(firstSegment) && ts.isIdentifier(firstSegment.expression) && (ts.getEmitFlags(firstSegment.expression) & 4096) - && firstSegment.expression.text === "___spread") { + && firstSegment.expression.escapedText === "___spread") { return segments[0]; } } @@ -49497,7 +50135,7 @@ var ts; : ts.createIdentifier("_super"); } function visitMetaProperty(node) { - if (node.keywordToken === 94 && node.name.text === "target") { + if (node.keywordToken === 94 && node.name.escapedText === "target") { if (hierarchyFacts & 8192) { hierarchyFacts |= 32768; } @@ -49640,7 +50278,7 @@ var ts; return false; } var expression = callArgument.expression; - return ts.isIdentifier(expression) && expression.text === "arguments"; + return ts.isIdentifier(expression) && expression.escapedText === "arguments"; } } ts.transformES2015 = transformES2015; @@ -50470,13 +51108,17 @@ var ts; return node; } function transformAndEmitContinueStatement(node) { - var label = findContinueTarget(node.label ? node.label.text : undefined); - ts.Debug.assert(label > 0, "Expected continue statment to point to a valid Label."); - emitBreak(label, node); + var label = findContinueTarget(node.label ? ts.unescapeLeadingUnderscores(node.label.escapedText) : undefined); + if (label > 0) { + emitBreak(label, node); + } + else { + emitStatement(node); + } } function visitContinueStatement(node) { if (inStatementContainingYield) { - var label = findContinueTarget(node.label && node.label.text); + var label = findContinueTarget(node.label && ts.unescapeLeadingUnderscores(node.label.escapedText)); if (label > 0) { return createInlineBreak(label, node); } @@ -50484,13 +51126,17 @@ var ts; return ts.visitEachChild(node, visitor, context); } function transformAndEmitBreakStatement(node) { - var label = findBreakTarget(node.label ? node.label.text : undefined); - ts.Debug.assert(label > 0, "Expected break statment to point to a valid Label."); - emitBreak(label, node); + var label = findBreakTarget(node.label ? ts.unescapeLeadingUnderscores(node.label.escapedText) : undefined); + if (label > 0) { + emitBreak(label, node); + } + else { + emitStatement(node); + } } function visitBreakStatement(node) { if (inStatementContainingYield) { - var label = findBreakTarget(node.label && node.label.text); + var label = findBreakTarget(node.label && ts.unescapeLeadingUnderscores(node.label.escapedText)); if (label > 0) { return createInlineBreak(label, node); } @@ -50585,7 +51231,7 @@ var ts; } function transformAndEmitLabeledStatement(node) { if (containsYield(node)) { - beginLabeledBlock(node.label.text); + beginLabeledBlock(ts.unescapeLeadingUnderscores(node.label.escapedText)); transformAndEmitEmbeddedStatement(node.statement); endLabeledBlock(); } @@ -50595,7 +51241,7 @@ var ts; } function visitLabeledStatement(node) { if (inStatementContainingYield) { - beginScriptLabeledBlock(node.label.text); + beginScriptLabeledBlock(ts.unescapeLeadingUnderscores(node.label.escapedText)); } node = ts.visitEachChild(node, visitor, context); if (inStatementContainingYield) { @@ -50650,7 +51296,7 @@ var ts; return node; } function substituteExpressionIdentifier(node) { - if (!ts.isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(node.text)) { + if (!ts.isGeneratedIdentifier(node) && renamedCatchVariables && renamedCatchVariables.has(ts.unescapeLeadingUnderscores(node.escapedText))) { var original = ts.getOriginalNode(node); if (ts.isIdentifier(original) && original.parent) { var declaration = resolver.getReferencedValueDeclaration(original); @@ -50743,9 +51389,6 @@ var ts; var block = endBlock(); markLabel(block.endLabel); } - function isWithBlock(block) { - return block.kind === 1; - } function beginExceptionBlock() { var startLabel = defineLabel(); var endLabel = defineLabel(); @@ -50767,7 +51410,7 @@ var ts; hoistVariableDeclaration(variable.name); } else { - var text = variable.name.text; + var text = ts.unescapeLeadingUnderscores(variable.name.escapedText); name = declareLocal(text); if (!renamedCatchVariables) { renamedCatchVariables = ts.createMap(); @@ -50814,9 +51457,6 @@ var ts; emitNop(); exception.state = 3; } - function isExceptionBlock(block) { - return block.kind === 0; - } function beginScriptLoopBlock() { beginBlock({ kind: 3, @@ -50831,7 +51471,7 @@ var ts; kind: 3, isScript: false, breakLabel: breakLabel, - continueLabel: continueLabel + continueLabel: continueLabel, }); return breakLabel; } @@ -50855,7 +51495,7 @@ var ts; beginBlock({ kind: 2, isScript: false, - breakLabel: breakLabel + breakLabel: breakLabel, }); return breakLabel; } @@ -50916,43 +51556,45 @@ var ts; return false; } function findBreakTarget(labelText) { - ts.Debug.assert(blocks !== undefined); - if (labelText) { - for (var i = blockStack.length - 1; i >= 0; i--) { - var block = blockStack[i]; - if (supportsLabeledBreakOrContinue(block) && block.labelText === labelText) { - return block.breakLabel; - } - else if (supportsUnlabeledBreak(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { - return block.breakLabel; + if (blockStack) { + if (labelText) { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsLabeledBreakOrContinue(block) && block.labelText === labelText) { + return block.breakLabel; + } + else if (supportsUnlabeledBreak(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { + return block.breakLabel; + } } } - } - else { - for (var i = blockStack.length - 1; i >= 0; i--) { - var block = blockStack[i]; - if (supportsUnlabeledBreak(block)) { - return block.breakLabel; + else { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsUnlabeledBreak(block)) { + return block.breakLabel; + } } } } return 0; } function findContinueTarget(labelText) { - ts.Debug.assert(blocks !== undefined); - if (labelText) { - for (var i = blockStack.length - 1; i >= 0; i--) { - var block = blockStack[i]; - if (supportsUnlabeledContinue(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { - return block.continueLabel; + if (blockStack) { + if (labelText) { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsUnlabeledContinue(block) && hasImmediateContainingLabeledBlock(labelText, i - 1)) { + return block.continueLabel; + } } } - } - else { - for (var i = blockStack.length - 1; i >= 0; i--) { - var block = blockStack[i]; - if (supportsUnlabeledContinue(block)) { - return block.continueLabel; + else { + for (var i = blockStack.length - 1; i >= 0; i--) { + var block = blockStack[i]; + if (supportsUnlabeledContinue(block)) { + return block.continueLabel; + } } } } @@ -50980,7 +51622,7 @@ var ts; return literal; } function createInlineBreak(label, location) { - ts.Debug.assert(label > 0, "Invalid label: " + label); + ts.Debug.assertLessThan(0, label, "Invalid label"); return ts.setTextRange(ts.createReturn(ts.createArrayLiteral([ createInstruction(3), createLabel(label) @@ -51188,31 +51830,33 @@ var ts; for (; blockIndex < blockActions.length && blockOffsets[blockIndex] <= operationIndex; blockIndex++) { var block = blocks[blockIndex]; var blockAction = blockActions[blockIndex]; - if (isExceptionBlock(block)) { - if (blockAction === 0) { - if (!exceptionBlockStack) { - exceptionBlockStack = []; + switch (block.kind) { + case 0: + if (blockAction === 0) { + if (!exceptionBlockStack) { + exceptionBlockStack = []; + } + if (!statements) { + statements = []; + } + exceptionBlockStack.push(currentExceptionBlock); + currentExceptionBlock = block; } - if (!statements) { - statements = []; + else if (blockAction === 1) { + currentExceptionBlock = exceptionBlockStack.pop(); } - exceptionBlockStack.push(currentExceptionBlock); - currentExceptionBlock = block; - } - else if (blockAction === 1) { - currentExceptionBlock = exceptionBlockStack.pop(); - } - } - else if (isWithBlock(block)) { - if (blockAction === 0) { - if (!withBlockStack) { - withBlockStack = []; + break; + case 1: + if (blockAction === 0) { + if (!withBlockStack) { + withBlockStack = []; + } + withBlockStack.push(block); } - withBlockStack.push(block); - } - else if (blockAction === 1) { - withBlockStack.pop(); - } + else if (blockAction === 1) { + withBlockStack.pop(); + } + break; } } } @@ -51393,7 +52037,7 @@ var ts; return node; } function trySubstituteReservedName(name) { - var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(name.text) : undefined); + var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(ts.unescapeLeadingUnderscores(name.escapedText)) : undefined); if (token >= 72 && token <= 107) { return ts.setTextRange(ts.createLiteral(name), name); } @@ -51574,17 +52218,23 @@ var ts; } function addExportEqualsIfNeeded(statements, emitAsReturn) { if (currentModuleInfo.exportEquals) { - if (emitAsReturn) { - var statement = ts.createReturn(currentModuleInfo.exportEquals.expression); - ts.setTextRange(statement, currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 384 | 1536); - statements.push(statement); - } - else { - var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), currentModuleInfo.exportEquals.expression)); - ts.setTextRange(statement, currentModuleInfo.exportEquals); - ts.setEmitFlags(statement, 1536); - statements.push(statement); + var expressionResult = importCallExpressionVisitor(currentModuleInfo.exportEquals.expression); + if (expressionResult) { + if (expressionResult instanceof Array) { + return ts.Debug.fail("export= expression should never be replaced with multiple expressions!"); + } + if (emitAsReturn) { + var statement = ts.createReturn(expressionResult); + ts.setTextRange(statement, currentModuleInfo.exportEquals); + ts.setEmitFlags(statement, 384 | 1536); + statements.push(statement); + } + else { + var statement = ts.createStatement(ts.createAssignment(ts.createPropertyAccess(ts.createIdentifier("module"), "exports"), expressionResult)); + ts.setTextRange(statement, currentModuleInfo.exportEquals); + ts.setEmitFlags(statement, 1536); + statements.push(statement); + } } } } @@ -51604,9 +52254,9 @@ var ts; return visitFunctionDeclaration(node); case 229: return visitClassDeclaration(node); - case 299: + case 290: return visitMergeDeclarationMarker(node); - case 300: + case 291: return visitEndOfDeclarationMarker(node); default: return ts.visitEachChild(node, importCallExpressionVisitor, context); @@ -51775,7 +52425,7 @@ var ts; function visitClassDeclaration(node) { var statements; if (ts.hasModifier(node, 1)) { - statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.heritageClauses, importCallExpressionVisitor), node.members), node), node)); + statements = ts.append(statements, ts.setOriginalNode(ts.setTextRange(ts.createClassDeclaration(undefined, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.getDeclarationName(node, true, true), undefined, ts.visitNodes(node.heritageClauses, importCallExpressionVisitor), ts.visitNodes(node.members, importCallExpressionVisitor)), node), node)); } else { statements = ts.append(statements, ts.visitEachChild(node, importCallExpressionVisitor, context)); @@ -51918,7 +52568,7 @@ var ts; return statements; } if (ts.hasModifier(decl, 1)) { - var exportName = ts.hasModifier(decl, 512) ? ts.createIdentifier("default") : decl.name; + var exportName = ts.hasModifier(decl, 512) ? ts.createIdentifier("default") : ts.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, ts.getLocalName(decl), decl); } if (decl.name) { @@ -51928,7 +52578,7 @@ var ts; } function appendExportsOfDeclaration(statements, decl) { var name = ts.getDeclarationName(decl); - var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(name.text); + var exportSpecifiers = currentModuleInfo.exportSpecifiers.get(ts.unescapeLeadingUnderscores(name.escapedText)); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_1 = exportSpecifiers; _i < exportSpecifiers_1.length; _i++) { var exportSpecifier = exportSpecifiers_1[_i]; @@ -52257,7 +52907,7 @@ var ts; if (moduleInfo.exportedNames) { for (var _b = 0, _c = moduleInfo.exportedNames; _b < _c.length; _b++) { var exportedLocalName = _c[_b]; - if (exportedLocalName.text === "default") { + if (exportedLocalName.escapedText === "default") { continue; } exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(exportedLocalName), ts.createTrue())); @@ -52274,7 +52924,7 @@ var ts; } for (var _f = 0, _g = exportDecl.exportClause.elements; _f < _g.length; _f++) { var element = _g[_f]; - exportedNames.push(ts.createPropertyAssignment(ts.createLiteral((element.name || element.propertyName).text), ts.createTrue())); + exportedNames.push(ts.createPropertyAssignment(ts.createLiteral(ts.unescapeLeadingUnderscores((element.name || element.propertyName).escapedText)), ts.createTrue())); } } var exportedNamesStorageRef = ts.createUniqueName("exportedNames"); @@ -52331,7 +52981,7 @@ var ts; var properties = []; for (var _c = 0, _d = entry.exportClause.elements; _c < _d.length; _c++) { var e = _d[_c]; - properties.push(ts.createPropertyAssignment(ts.createLiteral(e.name.text), ts.createElementAccess(parameterName, ts.createLiteral((e.propertyName || e.name).text)))); + properties.push(ts.createPropertyAssignment(ts.createLiteral(ts.unescapeLeadingUnderscores(e.name.escapedText)), ts.createElementAccess(parameterName, ts.createLiteral(ts.unescapeLeadingUnderscores((e.propertyName || e.name).escapedText))))); } statements.push(ts.createStatement(ts.createCall(exportFunction, undefined, [ts.createObjectLiteral(properties, true)]))); } @@ -52576,7 +53226,7 @@ var ts; var excludeName = void 0; if (exportSelf) { statements = appendExportStatement(statements, decl.name, ts.getLocalName(decl)); - excludeName = decl.name.text; + excludeName = ts.unescapeLeadingUnderscores(decl.name.escapedText); } statements = appendExportsOfDeclaration(statements, decl, excludeName); } @@ -52590,7 +53240,7 @@ var ts; if (ts.hasModifier(decl, 1)) { var exportName = ts.hasModifier(decl, 512) ? ts.createLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, ts.getLocalName(decl)); - excludeName = exportName.text; + excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } if (decl.name) { statements = appendExportsOfDeclaration(statements, decl, excludeName); @@ -52602,11 +53252,11 @@ var ts; return statements; } var name = ts.getDeclarationName(decl); - var exportSpecifiers = moduleInfo.exportSpecifiers.get(name.text); + var exportSpecifiers = moduleInfo.exportSpecifiers.get(ts.unescapeLeadingUnderscores(name.escapedText)); if (exportSpecifiers) { for (var _i = 0, exportSpecifiers_2 = exportSpecifiers; _i < exportSpecifiers_2.length; _i++) { var exportSpecifier = exportSpecifiers_2[_i]; - if (exportSpecifier.name.text !== excludeName) { + if (exportSpecifier.name.escapedText !== excludeName) { statements = appendExportStatement(statements, exportSpecifier.name, name); } } @@ -52665,9 +53315,9 @@ var ts; return visitCatchClause(node); case 207: return visitBlock(node); - case 299: + case 290: return visitMergeDeclarationMarker(node); - case 300: + case 291: return visitEndOfDeclarationMarker(node); default: return destructuringAndImportCallVisitor(node); @@ -53080,7 +53730,7 @@ var ts; } ts.getTransformers = getTransformers; function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(301); + var enabledSyntaxKindFeatures = new Array(292); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentVariableDeclarationsStack = []; @@ -54231,7 +54881,7 @@ var ts; if (baseTypeNode && !ts.isEntityNameExpression(baseTypeNode.expression)) { tempVarName = baseTypeNode.expression.kind === 95 ? "null" : - emitTempVariableDeclaration(baseTypeNode.expression, node.name.text + "_base", { + emitTempVariableDeclaration(baseTypeNode.expression, node.name.escapedText + "_base", { diagnosticMessage: ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1, errorNode: baseTypeNode, typeName: node.name @@ -54403,6 +55053,9 @@ var ts; return ts.forEach(node.declarationList.declarations, function (varDeclaration) { return resolver.isDeclarationVisible(varDeclaration); }); } function writeVariableStatement(node) { + if (ts.every(node.declarationList && node.declarationList.declarations, function (decl) { return decl.name && ts.isEmptyBindingPattern(decl.name); })) { + return; + } emitJsDocComments(node); emitModuleElementDeclarationFlags(node); if (ts.isLet(node.declarationList)) { @@ -55020,7 +55673,7 @@ var ts; source = undefined; if (source) setSourceFile(source); - if (node.kind !== 296 + if (node.kind !== 287 && (emitFlags & 16) === 0 && pos >= 0) { emitPos(skipSourceTrivia(pos)); @@ -55037,7 +55690,7 @@ var ts; } if (source) setSourceFile(source); - if (node.kind !== 296 + if (node.kind !== 287 && (emitFlags & 32) === 0 && end >= 0) { emitPos(end); @@ -55179,7 +55832,7 @@ var ts; if (extendedDiagnostics) { ts.performance.mark("preEmitNodeWithComment"); } - var isEmittedNode = node.kind !== 296; + var isEmittedNode = node.kind !== 287; var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0 || node.kind === 10; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 10; if (!skipLeadingComments) { @@ -55368,14 +56021,14 @@ var ts; writer.writeLine(); } } - function emitTrailingCommentsOfPosition(pos) { + function emitTrailingCommentsOfPosition(pos, prefixSpace) { if (disabled) { return; } if (extendedDiagnostics) { ts.performance.mark("beforeEmitTrailingCommentsOfPosition"); } - forEachTrailingCommentToEmit(pos, emitTrailingCommentOfPosition); + forEachTrailingCommentToEmit(pos, prefixSpace ? emitTrailingComment : emitTrailingCommentOfPosition); if (extendedDiagnostics) { ts.performance.measure("commentTime", "beforeEmitTrailingCommentsOfPosition"); } @@ -55455,15 +56108,7 @@ var ts; emitPos(commentEnd); } function isTripleSlashComment(commentPos, commentEnd) { - if (currentText.charCodeAt(commentPos + 1) === 47 && - commentPos + 2 < commentEnd && - currentText.charCodeAt(commentPos + 2) === 47) { - var textSubStr = currentText.substring(commentPos, commentEnd); - return textSubStr.match(ts.fullTripleSlashReferencePathRegEx) || - textSubStr.match(ts.fullTripleSlashAMDReferencePathRegEx) ? - true : false; - } - return false; + return ts.isRecognizedTripleSlashComment(currentText, commentPos, commentEnd); } } ts.createCommentWriter = createCommentWriter; @@ -55472,6 +56117,50 @@ var ts; (function (ts) { var delimiters = createDelimiterMap(); var brackets = createBracketsMap(); + function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, emitOnlyDtsFiles) { + var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : ts.getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile); + var options = host.getCompilerOptions(); + if (options.outFile || options.out) { + if (sourceFiles.length) { + var jsFilePath = options.outFile || options.out; + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = options.declaration ? ts.removeFileExtension(jsFilePath) + ".d.ts" : ""; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, ts.createBundle(sourceFiles), emitOnlyDtsFiles); + } + } + else { + for (var _a = 0, sourceFiles_1 = sourceFiles; _a < sourceFiles_1.length; _a++) { + var sourceFile = sourceFiles_1[_a]; + var jsFilePath = ts.getOwnEmitOutputFilePath(sourceFile, host, getOutputExtension(sourceFile, options)); + var sourceMapFilePath = getSourceMapFilePath(jsFilePath, options); + var declarationFilePath = !ts.isSourceFileJavaScript(sourceFile) && (emitOnlyDtsFiles || options.declaration) ? ts.getDeclarationEmitOutputFilePath(sourceFile, host) : undefined; + action({ jsFilePath: jsFilePath, sourceMapFilePath: sourceMapFilePath, declarationFilePath: declarationFilePath }, sourceFile, emitOnlyDtsFiles); + } + } + } + ts.forEachEmittedFile = forEachEmittedFile; + function getSourceMapFilePath(jsFilePath, options) { + return options.sourceMap ? jsFilePath + ".map" : undefined; + } + function getOutputExtension(sourceFile, options) { + if (options.jsx === 1) { + if (ts.isSourceFileJavaScript(sourceFile)) { + if (ts.fileExtensionIs(sourceFile.fileName, ".jsx")) { + return ".jsx"; + } + } + else if (sourceFile.languageVariant === 1) { + return ".jsx"; + } + } + return ".js"; + } + function getOriginalSourceFileOrBundle(sourceFileOrBundle) { + if (sourceFileOrBundle.kind === 266) { + return ts.updateBundle(sourceFileOrBundle, ts.sameMap(sourceFileOrBundle.sourceFiles, ts.getOriginalSourceFile)); + } + return ts.getOriginalSourceFile(sourceFileOrBundle); + } function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers) { var compilerOptions = host.getCompilerOptions(); var moduleKind = ts.getEmitModuleKind(compilerOptions); @@ -55498,7 +56187,7 @@ var ts; onSetSourceFile: setSourceFile, }); ts.performance.mark("beforePrint"); - ts.forEachEmittedFile(host, emitSourceFileOrBundle, transform.transformed, emitOnlyDtsFiles); + forEachEmittedFile(host, emitSourceFileOrBundle, transform.transformed, emitOnlyDtsFiles); ts.performance.measure("printTime", "beforePrint"); transform.dispose(); return { @@ -55518,7 +56207,7 @@ var ts; emitSkipped = true; } if (declarationFilePath) { - emitSkipped = ts.writeDeclarationFile(declarationFilePath, ts.getOriginalSourceFileOrBundle(sourceFileOrBundle), host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; + emitSkipped = ts.writeDeclarationFile(declarationFilePath, getOriginalSourceFileOrBundle(sourceFileOrBundle), host, resolver, emitterDiagnostics, emitOnlyDtsFiles) || emitSkipped; } if (!emitSkipped && emittedFilesList) { if (!emitOnlyDtsFiles) { @@ -55720,8 +56409,13 @@ var ts; comments.reset(); setWriter(undefined); } + function emitIfPresent(node) { + if (node) { + emit(node); + } + } function emit(node) { - pipelineEmitWithNotification(3, node); + pipelineEmitWithNotification(4, node); } function emitIdentifierName(node) { pipelineEmitWithNotification(2, node); @@ -55759,7 +56453,8 @@ var ts; case 0: return pipelineEmitSourceFile(node); case 2: return pipelineEmitIdentifierName(node); case 1: return pipelineEmitExpression(node); - case 3: return pipelineEmitUnspecified(node); + case 3: return emitMappedTypeParameter(ts.cast(node, ts.isTypeParameterDeclaration)); + case 4: return pipelineEmitUnspecified(node); } } function pipelineEmitSourceFile(node) { @@ -55770,6 +56465,11 @@ var ts; ts.Debug.assertNode(node, ts.isIdentifier); emitIdentifier(node); } + function emitMappedTypeParameter(node) { + emit(node.name); + write(" in "); + emit(node.constraint); + } function pipelineEmitUnspecified(node) { var kind = node.kind; if (ts.isKeyword(kind)) { @@ -56056,9 +56756,9 @@ var ts; return emitJsxElement(node); case 250: return emitJsxSelfClosingElement(node); - case 297: + case 288: return emitPartiallyEmittedExpression(node); - case 298: + case 289: return emitCommaList(node); } } @@ -56113,9 +56813,9 @@ var ts; function emitParameter(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - writeIfPresent(node.dotDotDotToken, "..."); + emitIfPresent(node.dotDotDotToken); emit(node.name); - writeIfPresent(node.questionToken, "?"); + emitIfPresent(node.questionToken); emitWithPrefix(": ", node.type); emitExpressionWithPrefix(" = ", node.initializer); } @@ -56127,7 +56827,7 @@ var ts; emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); emit(node.name); - writeIfPresent(node.questionToken, "?"); + emitIfPresent(node.questionToken); emitWithPrefix(": ", node.type); write(";"); } @@ -56135,7 +56835,7 @@ var ts; emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); emit(node.name); - writeIfPresent(node.questionToken, "?"); + emitIfPresent(node.questionToken); emitWithPrefix(": ", node.type); emitExpressionWithPrefix(" = ", node.initializer); write(";"); @@ -56144,7 +56844,7 @@ var ts; emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); emit(node.name); - writeIfPresent(node.questionToken, "?"); + emitIfPresent(node.questionToken); emitTypeParameters(node, node.typeParameters); emitParameters(node, node.parameters); emitWithPrefix(": ", node.type); @@ -56153,9 +56853,9 @@ var ts; function emitMethodDeclaration(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - writeIfPresent(node.asteriskToken, "*"); + emitIfPresent(node.asteriskToken); emit(node.name); - writeIfPresent(node.questionToken, "?"); + emitIfPresent(node.questionToken); emitSignatureAndBody(node, emitSignatureHead); } function emitConstructor(node) { @@ -56225,9 +56925,8 @@ var ts; } function emitTypeLiteral(node) { write("{"); - if (node.members.length > 0) { - emitList(node, node.members, ts.getEmitFlags(node) & 1 ? 448 : 65); - } + var flags = ts.getEmitFlags(node) & 1 ? 448 : 65; + emitList(node, node.members, flags | 262144); write("}"); } function emitArrayType(node) { @@ -56274,13 +56973,14 @@ var ts; writeLine(); increaseIndent(); } - writeIfPresent(node.readonlyToken, "readonly "); + if (node.readonlyToken) { + emit(node.readonlyToken); + write(" "); + } write("["); - emit(node.typeParameter.name); - write(" in "); - emit(node.typeParameter.constraint); + pipelineEmitWithNotification(3, node.typeParameter); write("]"); - writeIfPresent(node.questionToken, "?"); + emitIfPresent(node.questionToken); write(": "); emit(node.type); write(";"); @@ -56320,36 +57020,25 @@ var ts; } function emitBindingElement(node) { emitWithSuffix(node.propertyName, ": "); - writeIfPresent(node.dotDotDotToken, "..."); + emitIfPresent(node.dotDotDotToken); emit(node.name); emitExpressionWithPrefix(" = ", node.initializer); } function emitArrayLiteralExpression(node) { var elements = node.elements; - if (elements.length === 0) { - write("[]"); - } - else { - var preferNewLine = node.multiLine ? 32768 : 0; - emitExpressionList(node, elements, 4466 | preferNewLine); - } + var preferNewLine = node.multiLine ? 32768 : 0; + emitExpressionList(node, elements, 4466 | preferNewLine); } function emitObjectLiteralExpression(node) { - var properties = node.properties; - if (properties.length === 0) { - write("{}"); + var indentedFlag = ts.getEmitFlags(node) & 65536; + if (indentedFlag) { + increaseIndent(); } - else { - var indentedFlag = ts.getEmitFlags(node) & 65536; - if (indentedFlag) { - increaseIndent(); - } - var preferNewLine = node.multiLine ? 32768 : 0; - var allowTrailingComma = currentSourceFile.languageVersion >= 1 ? 32 : 0; - emitList(node, properties, 978 | allowTrailingComma | preferNewLine); - if (indentedFlag) { - decreaseIndent(); - } + var preferNewLine = node.multiLine ? 32768 : 0; + var allowTrailingComma = currentSourceFile.languageVersion >= 1 ? 32 : 0; + emitList(node, node.properties, 263122 | allowTrailingComma | preferNewLine); + if (indentedFlag) { + decreaseIndent(); } } function emitPropertyAccessExpression(node) { @@ -56358,7 +57047,9 @@ var ts; if (!(ts.getEmitFlags(node) & 131072)) { var dotRangeStart = node.expression.end; var dotRangeEnd = ts.skipTrivia(currentSourceFile.text, node.expression.end) + 1; - var dotToken = { kind: 23, pos: dotRangeStart, end: dotRangeEnd }; + var dotToken = ts.createToken(23); + dotToken.pos = dotRangeStart; + dotToken.end = dotRangeEnd; indentBeforeDot = needsIndentation(node, node.expression, dotToken); indentAfterDot = needsIndentation(node, dotToken, node.name); } @@ -56429,7 +57120,8 @@ var ts; emitTypeParameters(node, node.typeParameters); emitParametersForArrow(node, node.parameters); emitWithPrefix(": ", node.type); - write(" =>"); + write(" "); + emit(node.equalsGreaterThanToken); } function emitDeleteExpression(node) { write("delete "); @@ -56470,7 +57162,9 @@ var ts; var indentAfterOperator = needsIndentation(node, node.operatorToken, node.right); emitExpression(node.left); increaseIndentIf(indentBeforeOperator, isCommaOperator ? " " : undefined); + emitLeadingCommentsOfPosition(node.operatorToken.pos); writeTokenNode(node.operatorToken); + emitTrailingCommentsOfPosition(node.operatorToken.end, true); increaseIndentIf(indentAfterOperator, " "); emitExpression(node.right); decreaseIndentIf(indentBeforeOperator, indentAfterOperator); @@ -56482,12 +57176,12 @@ var ts; var indentAfterColon = needsIndentation(node, node.colonToken, node.whenFalse); emitExpression(node.condition); increaseIndentIf(indentBeforeQuestion, " "); - write("?"); + emit(node.questionToken); increaseIndentIf(indentAfterQuestion, " "); emitExpression(node.whenTrue); decreaseIndentIf(indentBeforeQuestion, indentAfterQuestion); increaseIndentIf(indentBeforeColon, " "); - write(":"); + emit(node.colonToken); increaseIndentIf(indentAfterColon, " "); emitExpression(node.whenFalse); decreaseIndentIf(indentBeforeColon, indentAfterColon); @@ -56497,7 +57191,8 @@ var ts; emitList(node, node.templateSpans, 131072); } function emitYieldExpression(node) { - write(node.asteriskToken ? "yield*" : "yield"); + write("yield"); + emit(node.asteriskToken); emitExpressionWithPrefix(" ", node.expression); } function emitSpreadExpression(node) { @@ -56532,27 +57227,16 @@ var ts; emit(node.literal); } function emitBlock(node) { - if (isSingleLineEmptyBlock(node)) { - writeToken(17, node.pos, node); - write(" "); - writeToken(18, node.statements.end, node); - } - else { - writeToken(17, node.pos, node); - emitBlockStatements(node); - increaseIndent(); - emitLeadingCommentsOfPosition(node.statements.end); - decreaseIndent(); - writeToken(18, node.statements.end, node); - } + writeToken(17, node.pos, node); + emitBlockStatements(node, !node.multiLine && isEmptyBlock(node)); + increaseIndent(); + emitLeadingCommentsOfPosition(node.statements.end); + decreaseIndent(); + writeToken(18, node.statements.end, node); } - function emitBlockStatements(node) { - if (ts.getEmitFlags(node) & 1) { - emitList(node, node.statements, 384); - } - else { - emitList(node, node.statements, 65); - } + function emitBlockStatements(node, forceSingleLine) { + var format = forceSingleLine || ts.getEmitFlags(node) & 1 ? 384 : 65; + emitList(node, node.statements, format); } function emitVariableStatement(node) { emitModifiers(node, node.modifiers); @@ -56657,8 +57341,19 @@ var ts; emitWithPrefix(" ", node.label); write(";"); } + function emitTokenWithComment(token, pos, contextNode) { + var node = contextNode && ts.getParseTreeNode(contextNode); + if (node && node.kind === contextNode.kind) { + pos = ts.skipTrivia(currentSourceFile.text, pos); + } + pos = writeToken(token, pos, contextNode); + if (node && node.kind === contextNode.kind) { + emitTrailingCommentsOfPosition(pos, true); + } + return pos; + } function emitReturnStatement(node) { - writeToken(96, node.pos, node); + emitTokenWithComment(96, node.pos, node); emitExpressionWithPrefix(" ", node.expression); write(";"); } @@ -56719,7 +57414,9 @@ var ts; function emitFunctionDeclarationOrExpression(node) { emitDecorators(node, node.decorators); emitModifiers(node, node.modifiers); - write(node.asteriskToken ? "function* " : "function "); + write("function"); + emitIfPresent(node.asteriskToken); + write(" "); emitIdentifierName(node.name); emitSignatureAndBody(node, emitSignatureHead); } @@ -56737,7 +57434,7 @@ var ts; if (ts.getEmitFlags(node) & 524288) { emitSignatureHead(node); if (onEmitNode) { - onEmitNode(3, body, emitBlockCallback); + onEmitNode(4, body, emitBlockCallback); } else { emitBlockFunctionBody(body); @@ -56747,7 +57444,7 @@ var ts; pushNameGenerationScope(); emitSignatureHead(node); if (onEmitNode) { - onEmitNode(3, body, emitBlockCallback); + onEmitNode(4, body, emitBlockCallback); } else { emitBlockFunctionBody(body); @@ -56897,16 +57594,11 @@ var ts; emit(body); } function emitModuleBlock(node) { - if (isEmptyBlock(node)) { - write("{ }"); - } - else { - pushNameGenerationScope(); - write("{"); - emitBlockStatements(node); - write("}"); - popNameGenerationScope(); - } + pushNameGenerationScope(); + write("{"); + emitBlockStatements(node, isEmptyBlock(node)); + write("}"); + popNameGenerationScope(); } function emitCaseBlock(node) { writeToken(17, node.pos); @@ -57049,9 +57741,7 @@ var ts; function emitJsxExpression(node) { if (node.expression) { write("{"); - if (node.dotDotDotToken) { - write("..."); - } + emitIfPresent(node.dotDotDotToken); emitExpression(node.expression); write("}"); } @@ -57082,13 +57772,12 @@ var ts; if (statements.length > 0) { emitTrailingCommentsOfPosition(statements.pos); } + var format = 81985; if (emitAsSingleStatement) { write(" "); - emit(statements[0]); - } - else { - emitList(parentNode, statements, 81985); + format &= ~(1 | 64); } + emitList(parentNode, statements, format); } function emitHeritageClause(node) { write(" "); @@ -57099,10 +57788,12 @@ var ts; function emitCatchClause(node) { var openParenPos = writeToken(74, node.pos); write(" "); - writeToken(19, openParenPos); - emit(node.variableDeclaration); - writeToken(20, node.variableDeclaration ? node.variableDeclaration.end : openParenPos); - write(" "); + if (node.variableDeclaration) { + writeToken(19, openParenPos); + emit(node.variableDeclaration); + writeToken(20, node.variableDeclaration.end); + write(" "); + } emit(node.block); } function emitPropertyAssignment(node) { @@ -57171,7 +57862,7 @@ var ts; } emit(statement); if (seenPrologueDirectives) { - seenPrologueDirectives.set(statement.expression.text, statement.expression.text); + seenPrologueDirectives.set(statement.expression.text, true); } } } @@ -57279,7 +57970,7 @@ var ts; } function emitParametersForArrow(parentNode, parameters) { if (canEmitSimpleArrowHead(parentNode, parameters)) { - emit(parameters[0]); + emitList(parentNode, parameters, 1360 & ~1024); } else { emitParameters(parentNode, parameters); @@ -57303,6 +57994,12 @@ var ts; } var isEmpty = isUndefined || children.length === 0 || start >= children.length || count === 0; if (isEmpty && format & 16384) { + if (onBeforeEmitNodeArray) { + onBeforeEmitNodeArray(children); + } + if (onAfterEmitNodeArray) { + onAfterEmitNodeArray(children); + } return; } if (format & 7680) { @@ -57315,7 +58012,7 @@ var ts; if (format & 1) { writeLine(); } - else if (format & 128) { + else if (format & 128 && !(format & 262144)) { write(" "); } } @@ -57411,11 +58108,6 @@ var ts; write(text); } } - function writeIfPresent(node, text) { - if (node) { - write(text); - } - } function writeToken(token, pos, contextNode) { return onEmitSourceMapOfToken ? onEmitSourceMapOfToken(contextNode, token, pos, writeTokenText) @@ -57425,7 +58117,7 @@ var ts; if (onBeforeEmitToken) { onBeforeEmitToken(node); } - writeTokenText(node.kind); + write(ts.tokenToString(node.kind)); if (onAfterEmitToken) { onAfterEmitToken(node); } @@ -57574,10 +58266,6 @@ var ts; && !ts.nodeIsSynthesized(node2) && !ts.rangeEndIsOnSameLineAsRangeStart(node1, node2, currentSourceFile); } - function isSingleLineEmptyBlock(block) { - return !block.multiLine - && isEmptyBlock(block); - } function isEmptyBlock(block) { return block.statements.length === 0 && ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile); @@ -57593,7 +58281,7 @@ var ts; return generateName(node); } else if (ts.isIdentifier(node) && (ts.nodeIsSynthesized(node) || !node.parent)) { - return ts.unescapeIdentifier(node.text); + return ts.unescapeLeadingUnderscores(node.escapedText); } else if (node.kind === 9 && node.textSourceNode) { return getTextOfNode(node.textSourceNode, includeTrivia); @@ -57631,12 +58319,12 @@ var ts; } else { var autoGenerateId = name.autoGenerateId; - return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = ts.unescapeIdentifier(makeName(name))); + return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } function generateNameCached(node) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = ts.unescapeIdentifier(generateNameForNode(node))); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node)); } function isUniqueName(name) { return !(hasGlobalName && hasGlobalName(name)) @@ -57646,8 +58334,8 @@ var ts; function isUniqueLocalName(name, container) { for (var node = container; ts.isNodeDescendantOf(node, container); node = node.nextContainer) { if (node.locals) { - var local = node.locals.get(name); - if (local && local.flags & (107455 | 1048576 | 8388608)) { + var local = node.locals.get(ts.escapeLeadingUnderscores(name)); + if (local && local.flags & (107455 | 1048576 | 2097152)) { return false; } } @@ -57683,7 +58371,7 @@ var ts; while (true) { var generatedName = baseName + i; if (isUniqueName(generatedName)) { - generatedNames.set(generatedName, generatedName); + generatedNames.set(generatedName, true); return generatedName; } i++; @@ -57695,8 +58383,8 @@ var ts; } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); - var baseName = expr.kind === 9 ? - ts.escapeIdentifier(ts.makeIdentifierFromModuleName(expr.text)) : "module"; + var baseName = ts.isStringLiteral(expr) ? + ts.makeIdentifierFromModuleName(expr.text) : "module"; return makeUniqueName(baseName); } function generateNameForExportDefault() { @@ -57742,7 +58430,7 @@ var ts; case 2: return makeTempVariableName(268435456); case 3: - return makeUniqueName(ts.unescapeIdentifier(name.text)); + return makeUniqueName(ts.unescapeLeadingUnderscores(name.escapedText)); } ts.Debug.fail("Unsupported GeneratedIdentifierKind."); } @@ -57821,6 +58509,8 @@ var ts; ListFormat[ListFormat["PreferNewLine"] = 32768] = "PreferNewLine"; ListFormat[ListFormat["NoTrailingNewLine"] = 65536] = "NoTrailingNewLine"; ListFormat[ListFormat["NoInterveningComments"] = 131072] = "NoInterveningComments"; + ListFormat[ListFormat["NoSpaceIfEmpty"] = 262144] = "NoSpaceIfEmpty"; + ListFormat[ListFormat["SingleElement"] = 524288] = "SingleElement"; ListFormat[ListFormat["Modifiers"] = 131328] = "Modifiers"; ListFormat[ListFormat["HeritageClauses"] = 256] = "HeritageClauses"; ListFormat[ListFormat["SingleLineTypeLiteralMembers"] = 448] = "SingleLineTypeLiteralMembers"; @@ -57830,7 +58520,7 @@ var ts; ListFormat[ListFormat["IntersectionTypeConstituents"] = 264] = "IntersectionTypeConstituents"; ListFormat[ListFormat["ObjectBindingPatternElements"] = 432] = "ObjectBindingPatternElements"; ListFormat[ListFormat["ArrayBindingPatternElements"] = 304] = "ArrayBindingPatternElements"; - ListFormat[ListFormat["ObjectLiteralExpressionProperties"] = 978] = "ObjectLiteralExpressionProperties"; + ListFormat[ListFormat["ObjectLiteralExpressionProperties"] = 263122] = "ObjectLiteralExpressionProperties"; ListFormat[ListFormat["ArrayLiteralExpressionElements"] = 4466] = "ArrayLiteralExpressionElements"; ListFormat[ListFormat["CommaListElements"] = 272] = "CommaListElements"; ListFormat[ListFormat["CallExpressionArguments"] = 1296] = "CallExpressionArguments"; @@ -57861,7 +58551,6 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { - var emptyArray = []; var ignoreDiagnosticCommentRegEx = /(^\s*$)|(^\s*\/\/\/?\s*(@ts-ignore)?)/; function findConfigFile(searchPath, fileExists, configName) { if (configName === void 0) { configName = "tsconfig.json"; } @@ -58074,9 +58763,9 @@ var ts; for (var _i = 0, diagnostics_2 = diagnostics; _i < diagnostics_2.length; _i++) { var diagnostic = diagnostics_2[_i]; if (diagnostic.file) { - var start = diagnostic.start, length_5 = diagnostic.length, file = diagnostic.file; + var start = diagnostic.start, length_6 = diagnostic.length, file = diagnostic.file; var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character; - var _b = ts.getLineAndCharacterOfPosition(file, start + length_5), lastLine = _b.line, lastLineChar = _b.character; + var _b = ts.getLineAndCharacterOfPosition(file, start + length_6), lastLine = _b.line, lastLineChar = _b.character; var lastLineInFile = ts.getLineAndCharacterOfPosition(file, file.text.length).line; var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName; var hasMoreThanFiveLines = (lastLine - firstLine) >= 4; @@ -58119,6 +58808,7 @@ var ts; var categoryColor = getCategoryFormat(diagnostic.category); var category = ts.DiagnosticCategory[diagnostic.category].toLowerCase(); output += formatAndReset(category, categoryColor) + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine); + output += ts.sys.newLine; } return output; } @@ -58187,11 +58877,12 @@ var ts; var programDiagnostics = ts.createDiagnosticCollection(); var currentDirectory = host.getCurrentDirectory(); var supportedExtensions = ts.getSupportedExtensions(options); - var hasEmitBlockingDiagnostics = ts.createFileMap(getCanonicalFileName); + var hasEmitBlockingDiagnostics = ts.createMap(); + var _compilerOptionsObjectLiteralSyntax; var moduleResolutionCache; var resolveModuleNamesWorker; if (host.resolveModuleNames) { - resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(moduleNames, containingFile).map(function (resolved) { + resolveModuleNamesWorker = function (moduleNames, containingFile) { return host.resolveModuleNames(checkAllDefined(moduleNames), containingFile).map(function (resolved) { if (!resolved || resolved.extension !== undefined) { return resolved; } @@ -58203,18 +58894,21 @@ var ts; else { moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }); var loader_1 = function (moduleName, containingFile) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache).resolvedModule; }; - resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(moduleNames, containingFile, loader_1); }; + resolveModuleNamesWorker = function (moduleNames, containingFile) { return loadWithLocalCache(checkAllDefined(moduleNames), containingFile, loader_1); }; } var resolveTypeReferenceDirectiveNamesWorker; if (host.resolveTypeReferenceDirectives) { - resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(typeDirectiveNames, containingFile); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeDirectiveNames, containingFile) { return host.resolveTypeReferenceDirectives(checkAllDefined(typeDirectiveNames), containingFile); }; } else { var loader_2 = function (typesRef, containingFile) { return ts.resolveTypeReferenceDirective(typesRef, containingFile, options, host).resolvedTypeReferenceDirective; }; - resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(typeReferenceDirectiveNames, containingFile, loader_2); }; + resolveTypeReferenceDirectiveNamesWorker = function (typeReferenceDirectiveNames, containingFile) { return loadWithLocalCache(checkAllDefined(typeReferenceDirectiveNames), containingFile, loader_2); }; } - var filesByName = ts.createFileMap(); - var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createFileMap(function (fileName) { return fileName.toLowerCase(); }) : undefined; + var packageIdToSourceFile = ts.createMap(); + var sourceFileToPackageName = ts.createMap(); + var redirectTargetsSet = ts.createMap(); + var filesByName = ts.createMap(); + var filesByNameIgnoreCase = host.useCaseSensitiveFileNames() ? ts.createMap() : undefined; var structuralIsReused = tryReuseStructureFromOldProgram(); if (structuralIsReused !== 2) { ts.forEach(rootNames, function (name) { return processRootFile(name, false); }); @@ -58239,6 +58933,7 @@ var ts; } } } + var missingFilePaths = ts.arrayFrom(filesByName.keys(), function (p) { return p; }).filter(function (p) { return !filesByName.get(p); }); moduleResolutionCache = undefined; oldProgram = undefined; program = { @@ -58246,6 +58941,7 @@ var ts; getSourceFile: getSourceFile, getSourceFileByPath: getSourceFileByPath, getSourceFiles: function () { return files; }, + getMissingFilePaths: function () { return missingFilePaths; }, getCompilerOptions: function () { return options; }, getSyntacticDiagnostics: getSyntacticDiagnostics, getOptionsDiagnostics: getOptionsDiagnostics, @@ -58267,11 +58963,16 @@ var ts; isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary, dropDiagnosticsProducingTypeChecker: dropDiagnosticsProducingTypeChecker, getSourceFileFromReference: getSourceFileFromReference, + sourceFileToPackageName: sourceFileToPackageName, + redirectTargetsSet: redirectTargetsSet, }; verifyCompilerOptions(); ts.performance.mark("afterProgram"); ts.performance.measure("Program", "beforeProgram", "afterProgram"); return program; + function toPath(fileName) { + return ts.toPath(fileName, currentDirectory, getCanonicalFileName); + } function getCommonSourceDirectory() { if (commonSourceDirectory === undefined) { var emittedFiles = ts.filter(files, function (file) { return ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary); }); @@ -58290,7 +58991,7 @@ var ts; function getClassifiableNames() { if (!classifiableNames) { getTypeChecker(); - classifiableNames = ts.createMap(); + classifiableNames = ts.createUnderscoreEscapedMap(); for (var _i = 0, files_2 = files; _i < files_2.length; _i++) { var sourceFile = files_2[_i]; ts.copyEntries(sourceFile.classifiableNames, classifiableNames); @@ -58346,7 +59047,7 @@ var ts; } var resolutions = unknownModuleNames && unknownModuleNames.length ? resolveModuleNamesWorker(unknownModuleNames, containingFile) - : emptyArray; + : ts.emptyArray; if (!result) { ts.Debug.assert(resolutions.length === moduleNames.length); return resolutions; @@ -58407,17 +59108,51 @@ var ts; var filePaths = []; var modifiedSourceFiles = []; oldProgram.structureIsReused = 2; - for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { - var oldSourceFile = _a[_i]; + var oldSourceFiles = oldProgram.getSourceFiles(); + var SeenPackageName; + (function (SeenPackageName) { + SeenPackageName[SeenPackageName["Exists"] = 0] = "Exists"; + SeenPackageName[SeenPackageName["Modified"] = 1] = "Modified"; + })(SeenPackageName || (SeenPackageName = {})); + var seenPackageNames = ts.createMap(); + for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) { + var oldSourceFile = oldSourceFiles_1[_i]; var newSourceFile = host.getSourceFileByPath ? host.getSourceFileByPath(oldSourceFile.fileName, oldSourceFile.path, options.target) : host.getSourceFile(oldSourceFile.fileName, options.target); if (!newSourceFile) { return oldProgram.structureIsReused = 0; } + ts.Debug.assert(!newSourceFile.redirectInfo, "Host should not return a redirect source file from `getSourceFile`"); + var fileChanged = void 0; + if (oldSourceFile.redirectInfo) { + if (newSourceFile !== oldSourceFile.redirectInfo.unredirected) { + return oldProgram.structureIsReused = 0; + } + fileChanged = false; + newSourceFile = oldSourceFile; + } + else if (oldProgram.redirectTargetsSet.has(oldSourceFile.path)) { + if (newSourceFile !== oldSourceFile) { + return oldProgram.structureIsReused = 0; + } + fileChanged = false; + } + else { + fileChanged = newSourceFile !== oldSourceFile; + } newSourceFile.path = oldSourceFile.path; filePaths.push(newSourceFile.path); - if (oldSourceFile !== newSourceFile) { + var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path); + if (packageName !== undefined) { + var prevKind = seenPackageNames.get(packageName); + var newKind = fileChanged ? 1 : 0; + if ((prevKind !== undefined && newKind === 1) || prevKind === 1) { + return oldProgram.structureIsReused = 0; + } + seenPackageNames.set(packageName, newKind); + } + if (fileChanged) { if (oldSourceFile.hasNoDefaultLib !== newSourceFile.hasNoDefaultLib) { oldProgram.structureIsReused = 1; } @@ -58445,8 +59180,8 @@ var ts; return oldProgram.structureIsReused; } modifiedFilePaths = modifiedSourceFiles.map(function (f) { return f.newFile.path; }); - for (var _b = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _b < modifiedSourceFiles_1.length; _b++) { - var _c = modifiedSourceFiles_1[_b], oldSourceFile = _c.oldFile, newSourceFile = _c.newFile; + for (var _a = 0, modifiedSourceFiles_1 = modifiedSourceFiles; _a < modifiedSourceFiles_1.length; _a++) { + var _b = modifiedSourceFiles_1[_a], oldSourceFile = _b.oldFile, newSourceFile = _b.newFile; var newSourceFilePath = ts.getNormalizedAbsolutePath(newSourceFile.fileName, currentDirectory); if (resolveModuleNamesWorker) { var moduleNames = ts.map(ts.concatenate(newSourceFile.imports, newSourceFile.moduleAugmentations), getTextOfLiteral); @@ -58477,16 +59212,25 @@ var ts; if (oldProgram.structureIsReused !== 2) { return oldProgram.structureIsReused; } + if (oldProgram.getMissingFilePaths().some(function (missingFilePath) { return host.fileExists(missingFilePath); })) { + return oldProgram.structureIsReused = 1; + } + for (var _c = 0, _d = oldProgram.getMissingFilePaths(); _c < _d.length; _c++) { + var p = _d[_c]; + filesByName.set(p, undefined); + } for (var i = 0; i < newSourceFiles.length; i++) { filesByName.set(filePaths[i], newSourceFiles[i]); } files = newSourceFiles; fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics(); - for (var _d = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _d < modifiedSourceFiles_2.length; _d++) { - var modifiedFile = modifiedSourceFiles_2[_d]; + for (var _e = 0, modifiedSourceFiles_2 = modifiedSourceFiles; _e < modifiedSourceFiles_2.length; _e++) { + var modifiedFile = modifiedSourceFiles_2[_e]; fileProcessingDiagnostics.reattachFileDiagnostics(modifiedFile.newFile); } resolvedTypeReferenceDirectives = oldProgram.getResolvedTypeReferenceDirectives(); + sourceFileToPackageName = oldProgram.sourceFileToPackageName; + redirectTargetsSet = oldProgram.redirectTargetsSet; return oldProgram.structureIsReused = 2; } function getEmitHost(writeFileCallback) { @@ -58520,7 +59264,7 @@ var ts; return runWithCancellationToken(function () { return emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, transformers); }); } function isEmitBlocked(emitFileName) { - return hasEmitBlockingDiagnostics.contains(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName)); + return hasEmitBlockingDiagnostics.has(toPath(emitFileName)); } function emitWorker(program, sourceFile, writeFileCallback, cancellationToken, emitOnlyDtsFiles, customTransformers) { var declarationDiagnostics = []; @@ -58550,7 +59294,7 @@ var ts; return emitResult; } function getSourceFile(fileName) { - return getSourceFileByPath(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); + return getSourceFileByPath(toPath(fileName)); } function getSourceFileByPath(path) { return filesByName.get(path); @@ -58611,13 +59355,13 @@ var ts; function getSemanticDiagnosticsForFileNoCache(sourceFile, cancellationToken) { return runWithCancellationToken(function () { if (options.skipLibCheck && sourceFile.isDeclarationFile || options.skipDefaultLibCheck && sourceFile.hasNoDefaultLib) { - return emptyArray; + return ts.emptyArray; } var typeChecker = getDiagnosticsProducingTypeChecker(); ts.Debug.assert(!!sourceFile.bindDiagnostics); var includeBindAndCheckDiagnostics = !ts.isSourceFileJavaScript(sourceFile) || ts.isCheckJsEnabledForFile(sourceFile, options); - var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : emptyArray; - var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : emptyArray; + var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray; + var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray; var fileProcessingDiagnosticsInFile = fileProcessingDiagnostics.getDiagnostics(sourceFile.fileName); var programDiagnosticsInFile = programDiagnostics.getDiagnostics(sourceFile.fileName); var diagnostics = bindDiagnostics.concat(checkDiagnostics, fileProcessingDiagnosticsInFile, programDiagnosticsInFile); @@ -58667,7 +59411,6 @@ var ts; case 186: case 228: case 187: - case 228: case 226: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file)); @@ -58703,10 +59446,14 @@ var ts; case 232: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file)); return; - case 184: - var typeAssertionExpression = node; - diagnostics.push(createDiagnosticForNode(typeAssertionExpression.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); + case 203: + diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file)); + return; + case 202: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file)); return; + case 184: + ts.Debug.fail(); } var prevParent = parent; parent = node; @@ -58727,7 +59474,6 @@ var ts; case 186: case 228: case 187: - case 228: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file)); return; @@ -58815,10 +59561,10 @@ var ts; if (cachedResult) { return cachedResult; } - var result = getDiagnostics(sourceFile, cancellationToken) || emptyArray; + var result = getDiagnostics(sourceFile, cancellationToken) || ts.emptyArray; if (sourceFile) { if (!cache.perFile) { - cache.perFile = ts.createFileMap(); + cache.perFile = ts.createMap(); } cache.perFile.set(sourceFile.path, result); } @@ -58831,13 +59577,13 @@ var ts; return sourceFile.isDeclarationFile ? [] : getDeclarationDiagnosticsWorker(sourceFile, cancellationToken); } function getOptionsDiagnostics() { - return ts.sortAndDeduplicateDiagnostics(ts.concatenate(fileProcessingDiagnostics.getGlobalDiagnostics(), programDiagnostics.getGlobalDiagnostics())); + return ts.sortAndDeduplicateDiagnostics(ts.concatenate(fileProcessingDiagnostics.getGlobalDiagnostics(), ts.concatenate(programDiagnostics.getGlobalDiagnostics(), options.configFile ? programDiagnostics.getDiagnostics(options.configFile.fileName) : []))); } function getGlobalDiagnostics() { return ts.sortAndDeduplicateDiagnostics(getDiagnosticsProducingTypeChecker().getGlobalDiagnostics().slice()); } function processRootFile(fileName, isDefaultLib) { - processSourceFile(ts.normalizePath(fileName), isDefaultLib); + processSourceFile(ts.normalizePath(fileName), isDefaultLib, undefined); } function fileReferenceIsEqualTo(a, b) { return a.fileName === b.fileName; @@ -58873,9 +59619,9 @@ var ts; collectDynamicImportOrRequireCalls(node); } } - file.imports = imports || emptyArray; - file.moduleAugmentations = moduleAugmentations || emptyArray; - file.ambientModuleNames = ambientModules || emptyArray; + file.imports = imports || ts.emptyArray; + file.moduleAugmentations = moduleAugmentations || ts.emptyArray; + file.ambientModuleNames = ambientModules || ts.emptyArray; return; function collectModuleReferences(node, inAmbientModule) { switch (node.kind) { @@ -58883,7 +59629,7 @@ var ts; case 237: case 244: var moduleNameExpr = ts.getExternalModuleName(node); - if (!moduleNameExpr || moduleNameExpr.kind !== 9) { + if (!moduleNameExpr || !ts.isStringLiteral(moduleNameExpr)) { break; } if (!moduleNameExpr.text) { @@ -58896,12 +59642,13 @@ var ts; case 233: if (ts.isAmbientModule(node) && (inAmbientModule || ts.hasModifier(node, 2) || file.isDeclarationFile)) { var moduleName = node.name; - if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(moduleName.text))) { + var nameText = ts.getTextOfIdentifierOrLiteral(moduleName); + if (isExternalModuleFile || (inAmbientModule && !ts.isExternalModuleNameRelative(nameText))) { (moduleAugmentations || (moduleAugmentations = [])).push(moduleName); } else if (!inAmbientModule) { if (file.isDeclarationFile) { - (ambientModules || (ambientModules = [])).push(moduleName.text); + (ambientModules || (ambientModules = [])).push(nameText); } var body = node.body; if (body) { @@ -58927,7 +59674,7 @@ var ts; } } function getSourceFileFromReference(referencingFile, ref) { - return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), function (fileName) { return filesByName.get(ts.toPath(fileName, currentDirectory, getCanonicalFileName)); }); + return getSourceFileFromReferenceWorker(resolveTripleslashReference(ref.fileName, referencingFile.fileName), function (fileName) { return filesByName.get(toPath(fileName)); }); } function getSourceFileFromReferenceWorker(fileName, getSourceFile, fail, refFile) { if (ts.hasExtension(fileName)) { @@ -58961,8 +59708,8 @@ var ts; return sourceFileWithAddedExtension; } } - function processSourceFile(fileName, isDefaultLib, refFile, refPos, refEnd) { - getSourceFileFromReferenceWorker(fileName, function (fileName) { return findSourceFile(fileName, ts.toPath(fileName, currentDirectory, getCanonicalFileName), isDefaultLib, refFile, refPos, refEnd); }, function (diagnostic) { + function processSourceFile(fileName, isDefaultLib, packageId, refFile, refPos, refEnd) { + getSourceFileFromReferenceWorker(fileName, function (fileName) { return findSourceFile(fileName, toPath(fileName), isDefaultLib, refFile, refPos, refEnd, packageId); }, function (diagnostic) { var args = []; for (var _i = 1; _i < arguments.length; _i++) { args[_i - 1] = arguments[_i]; @@ -58979,8 +59726,25 @@ var ts; fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_name_0_differs_from_already_included_file_name_1_only_in_casing, fileName, existingFileName)); } } - function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd) { - if (filesByName.contains(path)) { + function createRedirectSourceFile(redirectTarget, unredirected, fileName, path) { + var redirect = Object.create(redirectTarget); + redirect.fileName = fileName; + redirect.path = path; + redirect.redirectInfo = { redirectTarget: redirectTarget, unredirected: unredirected }; + Object.defineProperties(redirect, { + id: { + get: function () { return this.redirectInfo.redirectTarget.id; }, + set: function (value) { this.redirectInfo.redirectTarget.id = value; }, + }, + symbol: { + get: function () { return this.redirectInfo.redirectTarget.symbol; }, + set: function (value) { this.redirectInfo.redirectTarget.symbol = value; }, + }, + }); + return redirect; + } + function findSourceFile(fileName, path, isDefaultLib, refFile, refPos, refEnd, packageId) { + if (filesByName.has(path)) { var file_1 = filesByName.get(path); if (file_1 && options.forceConsistentCasingInFileNames && ts.getNormalizedAbsolutePath(file_1.fileName, currentDirectory) !== ts.getNormalizedAbsolutePath(fileName, currentDirectory)) { reportFileNamesDifferOnlyInCasingError(fileName, file_1.fileName, refFile, refPos, refEnd); @@ -59010,17 +59774,34 @@ var ts; fileProcessingDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_read_file_0_Colon_1, fileName, hostErrorMessage)); } }); + if (packageId) { + var packageIdKey = packageId.name + "/" + packageId.subModuleName + "@" + packageId.version; + var fileFromPackageId = packageIdToSourceFile.get(packageIdKey); + if (fileFromPackageId) { + var dupFile = createRedirectSourceFile(fileFromPackageId, file, fileName, path); + redirectTargetsSet.set(fileFromPackageId.path, true); + filesByName.set(path, dupFile); + sourceFileToPackageName.set(path, packageId.name); + files.push(dupFile); + return dupFile; + } + else if (file) { + packageIdToSourceFile.set(packageIdKey, file); + sourceFileToPackageName.set(path, packageId.name); + } + } filesByName.set(path, file); if (file) { sourceFilesFoundSearchingNodeModules.set(path, currentNodeModulesDepth > 0); file.path = path; if (host.useCaseSensitiveFileNames()) { - var existingFile = filesByNameIgnoreCase.get(path); + var pathLowerCase = path.toLowerCase(); + var existingFile = filesByNameIgnoreCase.get(pathLowerCase); if (existingFile) { reportFileNamesDifferOnlyInCasingError(fileName, existingFile.fileName, refFile, refPos, refEnd); } else { - filesByNameIgnoreCase.set(path, file); + filesByNameIgnoreCase.set(pathLowerCase, file); } } skipDefaultLib = skipDefaultLib || file.hasNoDefaultLib; @@ -59041,7 +59822,7 @@ var ts; function processReferencedFiles(file, isDefaultLib) { ts.forEach(file.referencedFiles, function (ref) { var referencedFileName = resolveTripleslashReference(ref.fileName, file.fileName); - processSourceFile(referencedFileName, isDefaultLib, file, ref.pos, ref.end); + processSourceFile(referencedFileName, isDefaultLib, undefined, file, ref.pos, ref.end); }); } function processTypeReferenceDirectives(file) { @@ -59063,7 +59844,7 @@ var ts; var saveResolution = true; if (resolvedTypeReferenceDirective) { if (resolvedTypeReferenceDirective.primary) { - processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd); + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, resolvedTypeReferenceDirective.packageId, refFile, refPos, refEnd); } else { if (previousResolution) { @@ -59076,7 +59857,7 @@ var ts; saveResolution = false; } else { - processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, refFile, refPos, refEnd); + processSourceFile(resolvedTypeReferenceDirective.resolvedFileName, false, resolvedTypeReferenceDirective.packageId, refFile, refPos, refEnd); } } } @@ -59128,9 +59909,9 @@ var ts; modulesWithElidedImports.set(file.path, true); } else if (shouldAddFile) { - var path = ts.toPath(resolvedFileName, currentDirectory, getCanonicalFileName); + var path = toPath(resolvedFileName); var pos = ts.skipTrivia(file.text, file.imports[i].pos); - findSourceFile(resolvedFileName, path, false, file, pos, file.imports[i].end); + findSourceFile(resolvedFileName, path, false, file, pos, file.imports[i].end, resolution.packageId); } if (isFromNodeModulesSearch) { currentNodeModulesDepth--; @@ -59171,28 +59952,28 @@ var ts; function verifyCompilerOptions() { if (options.isolatedModules) { if (options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declaration", "isolatedModules"); } if (options.noEmitOnError) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules"); } if (options.out) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules"); } if (options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "outFile", "isolatedModules"); } } if (options.inlineSourceMap) { if (options.sourceMap) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "sourceMap", "inlineSourceMap"); } if (options.mapRoot) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "mapRoot", "inlineSourceMap"); } } if (options.paths && options.baseUrl === undefined) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option)); + createDiagnosticForOptionName(ts.Diagnostics.Option_paths_cannot_be_used_without_specifying_baseUrl_option, "paths"); } if (options.paths) { for (var key in options.paths) { @@ -59200,64 +59981,65 @@ var ts; continue; } if (!ts.hasZeroOrOneAsteriskCharacter(key)) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key)); + createDiagnosticForOptionPaths(true, key, ts.Diagnostics.Pattern_0_can_have_at_most_one_Asterisk_character, key); } if (ts.isArray(options.paths[key])) { - if (options.paths[key].length === 0) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key)); + var len = options.paths[key].length; + if (len === 0) { + createDiagnosticForOptionPaths(false, key, ts.Diagnostics.Substitutions_for_pattern_0_shouldn_t_be_an_empty_array, key); } - for (var _i = 0, _a = options.paths[key]; _i < _a.length; _i++) { - var subst = _a[_i]; + for (var i = 0; i < len; i++) { + var subst = options.paths[key][i]; var typeOfSubst = typeof subst; if (typeOfSubst === "string") { if (!ts.hasZeroOrOneAsteriskCharacter(subst)) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key)); + createDiagnosticForOptionPathKeyValue(key, i, ts.Diagnostics.Substitution_0_in_pattern_1_in_can_have_at_most_one_Asterisk_character, subst, key); } } else { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst)); + createDiagnosticForOptionPathKeyValue(key, i, ts.Diagnostics.Substitution_0_for_pattern_1_has_incorrect_type_expected_string_got_2, subst, key, typeOfSubst); } } } else { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key)); + createDiagnosticForOptionPaths(false, key, ts.Diagnostics.Substitutions_for_pattern_0_should_be_an_array, key); } } } if (!options.sourceMap && !options.inlineSourceMap) { if (options.inlineSources) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "inlineSources")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "inlineSources"); } if (options.sourceRoot) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "sourceRoot")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_can_only_be_used_when_either_option_inlineSourceMap_or_option_sourceMap_is_provided, "sourceRoot"); } } if (options.out && options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "outFile"); } if (options.mapRoot && !options.sourceMap) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "mapRoot", "sourceMap"); } if (options.declarationDir) { if (!options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "declarationDir", "declaration"); } if (options.out || options.outFile) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "declarationDir", options.out ? "out" : "outFile"); } } if (options.lib && options.noLib) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "lib", "noLib"); } if (options.noImplicitUseStrict && (options.alwaysStrict === undefined ? options.strict : options.alwaysStrict)) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noImplicitUseStrict", "alwaysStrict"); } var languageVersion = options.target || 0; var outFile = options.outFile || options.out; var firstNonAmbientExternalModuleSourceFile = ts.forEach(files, function (f) { return ts.isExternalModule(f) && !f.isDeclarationFile ? f : undefined; }); if (options.isolatedModules) { if (options.module === ts.ModuleKind.None && languageVersion < 2) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher)); + createDiagnosticForOptionName(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target"); } var firstNonExternalModuleSourceFile = ts.forEach(files, function (f) { return !ts.isExternalModule(f) && !f.isDeclarationFile ? f : undefined; }); if (firstNonExternalModuleSourceFile) { @@ -59271,7 +60053,7 @@ var ts; } if (outFile) { if (options.module && !(options.module === ts.ModuleKind.AMD || options.module === ts.ModuleKind.System)) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile")); + createDiagnosticForOptionName(ts.Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, options.out ? "out" : "outFile", "module"); } else if (options.module === undefined && firstNonAmbientExternalModuleSourceFile) { var span_9 = ts.getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, firstNonAmbientExternalModuleSourceFile.externalModuleIndicator); @@ -59283,33 +60065,33 @@ var ts; options.mapRoot) { var dir = getCommonSourceDirectory(); if (options.outDir && dir === "" && ts.forEach(files, function (file) { return ts.getRootLength(file.fileName) > 1; })) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files)); + createDiagnosticForOptionName(ts.Diagnostics.Cannot_find_the_common_subdirectory_path_for_the_input_files, "outDir"); } } if (!options.noEmit && options.allowJs && options.declaration) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration"); } if (options.checkJs && !options.allowJs) { programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "checkJs", "allowJs")); } if (options.emitDecoratorMetadata && !options.experimentalDecorators) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "emitDecoratorMetadata", "experimentalDecorators"); } if (options.jsxFactory) { if (options.reactNamespace) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory")); + createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "reactNamespace", "jsxFactory"); } if (!ts.parseIsolatedEntityName(options.jsxFactory, languageVersion)) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory)); + createOptionValueDiagnostic("jsxFactory", ts.Diagnostics.Invalid_value_for_jsxFactory_0_is_not_a_valid_identifier_or_qualified_name, options.jsxFactory); } } else if (options.reactNamespace && !ts.isIdentifierText(options.reactNamespace, languageVersion)) { - programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace)); + createOptionValueDiagnostic("reactNamespace", ts.Diagnostics.Invalid_value_for_reactNamespace_0_is_not_a_valid_identifier, options.reactNamespace); } if (!options.noEmit && !options.suppressOutputPathCheck) { var emitHost = getEmitHost(); - var emitFilesSeen_1 = ts.createFileMap(!host.useCaseSensitiveFileNames() ? function (key) { return key.toLocaleLowerCase(); } : undefined); + var emitFilesSeen_1 = ts.createMap(); ts.forEachEmittedFile(emitHost, function (emitFileNames) { verifyEmitFilePath(emitFileNames.jsFilePath, emitFilesSeen_1); verifyEmitFilePath(emitFileNames.declarationFilePath, emitFilesSeen_1); @@ -59317,8 +60099,8 @@ var ts; } function verifyEmitFilePath(emitFileName, emitFilesSeen) { if (emitFileName) { - var emitFilePath = ts.toPath(emitFileName, currentDirectory, getCanonicalFileName); - if (filesByName.contains(emitFilePath)) { + var emitFilePath = toPath(emitFileName); + if (filesByName.has(emitFilePath)) { var chain_1; if (!options.configFilePath) { chain_1 = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig); @@ -59326,17 +60108,96 @@ var ts; chain_1 = ts.chainDiagnosticMessages(chain_1, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName); blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_1)); } - if (emitFilesSeen.contains(emitFilePath)) { + var emitFileKey = !host.useCaseSensitiveFileNames() ? emitFilePath.toLocaleLowerCase() : emitFilePath; + if (emitFilesSeen.has(emitFileKey)) { blockEmittingOfFile(emitFileName, ts.createCompilerDiagnostic(ts.Diagnostics.Cannot_write_file_0_because_it_would_be_overwritten_by_multiple_input_files, emitFileName)); } else { - emitFilesSeen.set(emitFilePath, true); + emitFilesSeen.set(emitFileKey, true); } } } } + function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, arg0, arg1, arg2) { + var needCompilerDiagnostic = true; + var pathsSyntax = getOptionPathsSyntax(); + for (var _i = 0, pathsSyntax_1 = pathsSyntax; _i < pathsSyntax_1.length; _i++) { + var pathProp = pathsSyntax_1[_i]; + if (ts.isObjectLiteralExpression(pathProp.initializer)) { + for (var _a = 0, _b = ts.getPropertyAssignment(pathProp.initializer, key); _a < _b.length; _a++) { + var keyProps = _b[_a]; + if (ts.isArrayLiteralExpression(keyProps.initializer) && + keyProps.initializer.elements.length > valueIndex) { + programDiagnostics.add(ts.createDiagnosticForNodeInSourceFile(options.configFile, keyProps.initializer.elements[valueIndex], message, arg0, arg1, arg2)); + needCompilerDiagnostic = false; + } + } + } + } + if (needCompilerDiagnostic) { + programDiagnostics.add(ts.createCompilerDiagnostic(message, arg0, arg1, arg2)); + } + } + function createDiagnosticForOptionPaths(onKey, key, message, arg0) { + var needCompilerDiagnostic = true; + var pathsSyntax = getOptionPathsSyntax(); + for (var _i = 0, pathsSyntax_2 = pathsSyntax; _i < pathsSyntax_2.length; _i++) { + var pathProp = pathsSyntax_2[_i]; + if (ts.isObjectLiteralExpression(pathProp.initializer) && + createOptionDiagnosticInObjectLiteralSyntax(pathProp.initializer, onKey, key, undefined, message, arg0)) { + needCompilerDiagnostic = false; + } + } + if (needCompilerDiagnostic) { + programDiagnostics.add(ts.createCompilerDiagnostic(message, arg0)); + } + } + function getOptionPathsSyntax() { + var compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); + if (compilerOptionsObjectLiteralSyntax) { + return ts.getPropertyAssignment(compilerOptionsObjectLiteralSyntax, "paths"); + } + return ts.emptyArray; + } + function createDiagnosticForOptionName(message, option1, option2) { + createDiagnosticForOption(true, option1, option2, message, option1, option2); + } + function createOptionValueDiagnostic(option1, message, arg0) { + createDiagnosticForOption(false, option1, undefined, message, arg0); + } + function createDiagnosticForOption(onKey, option1, option2, message, arg0, arg1) { + var compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax(); + var needCompilerDiagnostic = !compilerOptionsObjectLiteralSyntax || + !createOptionDiagnosticInObjectLiteralSyntax(compilerOptionsObjectLiteralSyntax, onKey, option1, option2, message, arg0, arg1); + if (needCompilerDiagnostic) { + programDiagnostics.add(ts.createCompilerDiagnostic(message, arg0, arg1)); + } + } + function getCompilerOptionsObjectLiteralSyntax() { + if (_compilerOptionsObjectLiteralSyntax === undefined) { + _compilerOptionsObjectLiteralSyntax = null; + if (options.configFile && options.configFile.jsonObject) { + for (var _i = 0, _a = ts.getPropertyAssignment(options.configFile.jsonObject, "compilerOptions"); _i < _a.length; _i++) { + var prop = _a[_i]; + if (ts.isObjectLiteralExpression(prop.initializer)) { + _compilerOptionsObjectLiteralSyntax = prop.initializer; + break; + } + } + } + } + return _compilerOptionsObjectLiteralSyntax; + } + function createOptionDiagnosticInObjectLiteralSyntax(objectLiteral, onKey, key1, key2, message, arg0, arg1) { + var props = ts.getPropertyAssignment(objectLiteral, key1, key2); + for (var _i = 0, props_2 = props; _i < props_2.length; _i++) { + var prop = props_2[_i]; + programDiagnostics.add(ts.createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, arg0, arg1)); + } + return !!props.length; + } function blockEmittingOfFile(emitFileName, diag) { - hasEmitBlockingDiagnostics.set(ts.toPath(emitFileName, currentDirectory, getCanonicalFileName), true); + hasEmitBlockingDiagnostics.set(toPath(emitFileName), true); programDiagnostics.add(diag); } } @@ -59344,14 +60205,14 @@ var ts; function getResolutionDiagnostic(options, _a) { var extension = _a.extension; switch (extension) { - case ts.Extension.Ts: - case ts.Extension.Dts: + case ".ts": + case ".d.ts": return undefined; - case ts.Extension.Tsx: + case ".tsx": return needJsx(); - case ts.Extension.Jsx: + case ".jsx": return needJsx() || needAllowJs(); - case ts.Extension.Js: + case ".js": return needAllowJs(); } function needJsx() { @@ -59362,6 +60223,10 @@ var ts; } } ts.getResolutionDiagnostic = getResolutionDiagnostic; + function checkAllDefined(names) { + ts.Debug.assert(names.every(function (name) { return name !== undefined; }), "A name is undefined.", function () { return JSON.stringify(names); }); + return names; + } })(ts || (ts = {})); var ts; (function (ts) { @@ -59397,10 +60262,10 @@ var ts; ts.TextChange = TextChange; var HighlightSpanKind; (function (HighlightSpanKind) { - HighlightSpanKind.none = "none"; - HighlightSpanKind.definition = "definition"; - HighlightSpanKind.reference = "reference"; - HighlightSpanKind.writtenReference = "writtenReference"; + HighlightSpanKind["none"] = "none"; + HighlightSpanKind["definition"] = "definition"; + HighlightSpanKind["reference"] = "reference"; + HighlightSpanKind["writtenReference"] = "writtenReference"; })(HighlightSpanKind = ts.HighlightSpanKind || (ts.HighlightSpanKind = {})); var IndentStyle; (function (IndentStyle) { @@ -59463,80 +60328,77 @@ var ts; })(TokenClass = ts.TokenClass || (ts.TokenClass = {})); var ScriptElementKind; (function (ScriptElementKind) { - ScriptElementKind.unknown = ""; - ScriptElementKind.warning = "warning"; - ScriptElementKind.keyword = "keyword"; - ScriptElementKind.scriptElement = "script"; - ScriptElementKind.moduleElement = "module"; - ScriptElementKind.classElement = "class"; - ScriptElementKind.localClassElement = "local class"; - ScriptElementKind.interfaceElement = "interface"; - ScriptElementKind.typeElement = "type"; - ScriptElementKind.enumElement = "enum"; - ScriptElementKind.enumMemberElement = "enum member"; - ScriptElementKind.variableElement = "var"; - ScriptElementKind.localVariableElement = "local var"; - ScriptElementKind.functionElement = "function"; - ScriptElementKind.localFunctionElement = "local function"; - ScriptElementKind.memberFunctionElement = "method"; - ScriptElementKind.memberGetAccessorElement = "getter"; - ScriptElementKind.memberSetAccessorElement = "setter"; - ScriptElementKind.memberVariableElement = "property"; - ScriptElementKind.constructorImplementationElement = "constructor"; - ScriptElementKind.callSignatureElement = "call"; - ScriptElementKind.indexSignatureElement = "index"; - ScriptElementKind.constructSignatureElement = "construct"; - ScriptElementKind.parameterElement = "parameter"; - ScriptElementKind.typeParameterElement = "type parameter"; - ScriptElementKind.primitiveType = "primitive type"; - ScriptElementKind.label = "label"; - ScriptElementKind.alias = "alias"; - ScriptElementKind.constElement = "const"; - ScriptElementKind.letElement = "let"; - ScriptElementKind.directory = "directory"; - ScriptElementKind.externalModuleName = "external module name"; - ScriptElementKind.jsxAttribute = "JSX attribute"; + ScriptElementKind["unknown"] = ""; + ScriptElementKind["warning"] = "warning"; + ScriptElementKind["keyword"] = "keyword"; + ScriptElementKind["scriptElement"] = "script"; + ScriptElementKind["moduleElement"] = "module"; + ScriptElementKind["classElement"] = "class"; + ScriptElementKind["localClassElement"] = "local class"; + ScriptElementKind["interfaceElement"] = "interface"; + ScriptElementKind["typeElement"] = "type"; + ScriptElementKind["enumElement"] = "enum"; + ScriptElementKind["enumMemberElement"] = "enum member"; + ScriptElementKind["variableElement"] = "var"; + ScriptElementKind["localVariableElement"] = "local var"; + ScriptElementKind["functionElement"] = "function"; + ScriptElementKind["localFunctionElement"] = "local function"; + ScriptElementKind["memberFunctionElement"] = "method"; + ScriptElementKind["memberGetAccessorElement"] = "getter"; + ScriptElementKind["memberSetAccessorElement"] = "setter"; + ScriptElementKind["memberVariableElement"] = "property"; + ScriptElementKind["constructorImplementationElement"] = "constructor"; + ScriptElementKind["callSignatureElement"] = "call"; + ScriptElementKind["indexSignatureElement"] = "index"; + ScriptElementKind["constructSignatureElement"] = "construct"; + ScriptElementKind["parameterElement"] = "parameter"; + ScriptElementKind["typeParameterElement"] = "type parameter"; + ScriptElementKind["primitiveType"] = "primitive type"; + ScriptElementKind["label"] = "label"; + ScriptElementKind["alias"] = "alias"; + ScriptElementKind["constElement"] = "const"; + ScriptElementKind["letElement"] = "let"; + ScriptElementKind["directory"] = "directory"; + ScriptElementKind["externalModuleName"] = "external module name"; + ScriptElementKind["jsxAttribute"] = "JSX attribute"; })(ScriptElementKind = ts.ScriptElementKind || (ts.ScriptElementKind = {})); var ScriptElementKindModifier; (function (ScriptElementKindModifier) { - ScriptElementKindModifier.none = ""; - ScriptElementKindModifier.publicMemberModifier = "public"; - ScriptElementKindModifier.privateMemberModifier = "private"; - ScriptElementKindModifier.protectedMemberModifier = "protected"; - ScriptElementKindModifier.exportedModifier = "export"; - ScriptElementKindModifier.ambientModifier = "declare"; - ScriptElementKindModifier.staticModifier = "static"; - ScriptElementKindModifier.abstractModifier = "abstract"; + ScriptElementKindModifier["none"] = ""; + ScriptElementKindModifier["publicMemberModifier"] = "public"; + ScriptElementKindModifier["privateMemberModifier"] = "private"; + ScriptElementKindModifier["protectedMemberModifier"] = "protected"; + ScriptElementKindModifier["exportedModifier"] = "export"; + ScriptElementKindModifier["ambientModifier"] = "declare"; + ScriptElementKindModifier["staticModifier"] = "static"; + ScriptElementKindModifier["abstractModifier"] = "abstract"; })(ScriptElementKindModifier = ts.ScriptElementKindModifier || (ts.ScriptElementKindModifier = {})); - var ClassificationTypeNames = (function () { - function ClassificationTypeNames() { - } - ClassificationTypeNames.comment = "comment"; - ClassificationTypeNames.identifier = "identifier"; - ClassificationTypeNames.keyword = "keyword"; - ClassificationTypeNames.numericLiteral = "number"; - ClassificationTypeNames.operator = "operator"; - ClassificationTypeNames.stringLiteral = "string"; - ClassificationTypeNames.whiteSpace = "whitespace"; - ClassificationTypeNames.text = "text"; - ClassificationTypeNames.punctuation = "punctuation"; - ClassificationTypeNames.className = "class name"; - ClassificationTypeNames.enumName = "enum name"; - ClassificationTypeNames.interfaceName = "interface name"; - ClassificationTypeNames.moduleName = "module name"; - ClassificationTypeNames.typeParameterName = "type parameter name"; - ClassificationTypeNames.typeAliasName = "type alias name"; - ClassificationTypeNames.parameterName = "parameter name"; - ClassificationTypeNames.docCommentTagName = "doc comment tag name"; - ClassificationTypeNames.jsxOpenTagName = "jsx open tag name"; - ClassificationTypeNames.jsxCloseTagName = "jsx close tag name"; - ClassificationTypeNames.jsxSelfClosingTagName = "jsx self closing tag name"; - ClassificationTypeNames.jsxAttribute = "jsx attribute"; - ClassificationTypeNames.jsxText = "jsx text"; - ClassificationTypeNames.jsxAttributeStringLiteralValue = "jsx attribute string literal value"; - return ClassificationTypeNames; - }()); - ts.ClassificationTypeNames = ClassificationTypeNames; + var ClassificationTypeNames; + (function (ClassificationTypeNames) { + ClassificationTypeNames["comment"] = "comment"; + ClassificationTypeNames["identifier"] = "identifier"; + ClassificationTypeNames["keyword"] = "keyword"; + ClassificationTypeNames["numericLiteral"] = "number"; + ClassificationTypeNames["operator"] = "operator"; + ClassificationTypeNames["stringLiteral"] = "string"; + ClassificationTypeNames["whiteSpace"] = "whitespace"; + ClassificationTypeNames["text"] = "text"; + ClassificationTypeNames["punctuation"] = "punctuation"; + ClassificationTypeNames["className"] = "class name"; + ClassificationTypeNames["enumName"] = "enum name"; + ClassificationTypeNames["interfaceName"] = "interface name"; + ClassificationTypeNames["moduleName"] = "module name"; + ClassificationTypeNames["typeParameterName"] = "type parameter name"; + ClassificationTypeNames["typeAliasName"] = "type alias name"; + ClassificationTypeNames["parameterName"] = "parameter name"; + ClassificationTypeNames["docCommentTagName"] = "doc comment tag name"; + ClassificationTypeNames["jsxOpenTagName"] = "jsx open tag name"; + ClassificationTypeNames["jsxCloseTagName"] = "jsx close tag name"; + ClassificationTypeNames["jsxSelfClosingTagName"] = "jsx self closing tag name"; + ClassificationTypeNames["jsxAttribute"] = "jsx attribute"; + ClassificationTypeNames["jsxText"] = "jsx text"; + ClassificationTypeNames["jsxAttributeStringLiteralValue"] = "jsx attribute string literal value"; + })(ClassificationTypeNames = ts.ClassificationTypeNames || (ts.ClassificationTypeNames = {})); var ClassificationType; (function (ClassificationType) { ClassificationType[ClassificationType["comment"] = 1] = "comment"; @@ -59568,7 +60430,6 @@ var ts; var ts; (function (ts) { ts.scanner = ts.createScanner(5, true); - ts.emptyArray = []; var SemanticMeaning; (function (SemanticMeaning) { SemanticMeaning[SemanticMeaning["None"] = 0] = "None"; @@ -59602,7 +60463,7 @@ var ts; case 231: case 163: return 2; - case 291: + case 283: return node.name === undefined ? 1 | 2 : 2; case 264: case 229: @@ -59717,7 +60578,6 @@ var ts; } switch (node.parent.kind) { case 159: - case 277: return true; case 201: return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent); @@ -59742,7 +60602,7 @@ var ts; ts.climbPastPropertyAccess = climbPastPropertyAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 222 && referenceNode.label.text === labelName) { + if (referenceNode.kind === 222 && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -59810,6 +60670,9 @@ var ts; } ts.isExpressionOfExternalModuleImportEqualsDeclaration = isExpressionOfExternalModuleImportEqualsDeclaration; function getContainerNode(node) { + if (node.kind === 283) { + node = node.parent.parent; + } while (true) { node = node.parent; if (!node) { @@ -59835,15 +60698,15 @@ var ts; function getNodeKind(node) { switch (node.kind) { case 265: - return ts.isExternalModule(node) ? ts.ScriptElementKind.moduleElement : ts.ScriptElementKind.scriptElement; + return ts.isExternalModule(node) ? "module" : "script"; case 233: - return ts.ScriptElementKind.moduleElement; + return "module"; case 229: case 199: - return ts.ScriptElementKind.classElement; - case 230: return ts.ScriptElementKind.interfaceElement; - case 231: return ts.ScriptElementKind.typeElement; - case 232: return ts.ScriptElementKind.enumElement; + return "class"; + case 230: return "interface"; + case 231: return "type"; + case 232: return "enum"; case 226: return getKindOfVariableDeclaration(node); case 176: @@ -59851,39 +60714,39 @@ var ts; case 187: case 228: case 186: - return ts.ScriptElementKind.functionElement; - case 153: return ts.ScriptElementKind.memberGetAccessorElement; - case 154: return ts.ScriptElementKind.memberSetAccessorElement; + return "function"; + case 153: return "getter"; + case 154: return "setter"; case 151: case 150: - return ts.ScriptElementKind.memberFunctionElement; + return "method"; case 149: case 148: - return ts.ScriptElementKind.memberVariableElement; - case 157: return ts.ScriptElementKind.indexSignatureElement; - case 156: return ts.ScriptElementKind.constructSignatureElement; - case 155: return ts.ScriptElementKind.callSignatureElement; - case 152: return ts.ScriptElementKind.constructorImplementationElement; - case 145: return ts.ScriptElementKind.typeParameterElement; - case 264: return ts.ScriptElementKind.enumMemberElement; - case 146: return ts.hasModifier(node, 92) ? ts.ScriptElementKind.memberVariableElement : ts.ScriptElementKind.parameterElement; + return "property"; + case 157: return "index"; + case 156: return "construct"; + case 155: return "call"; + case 152: return "constructor"; + case 145: return "type parameter"; + case 264: return "enum member"; + case 146: return ts.hasModifier(node, 92) ? "property" : "parameter"; case 237: case 242: case 239: case 246: case 240: - return ts.ScriptElementKind.alias; - case 291: - return ts.ScriptElementKind.typeElement; + return "alias"; + case 283: + return "type"; default: - return ts.ScriptElementKind.unknown; + return ""; } function getKindOfVariableDeclaration(v) { return ts.isConst(v) - ? ts.ScriptElementKind.constElement + ? "const" : ts.isLet(v) - ? ts.ScriptElementKind.letElement - : ts.ScriptElementKind.variableElement; + ? "let" + : "var"; } } ts.getNodeKind = getNodeKind; @@ -60079,7 +60942,7 @@ var ts; ts.findChildOfKind = findChildOfKind; function findContainingList(node) { var syntaxList = ts.forEach(node.parent.getChildren(), function (c) { - if (c.kind === 295 && c.pos <= node.pos && c.end >= node.end) { + if (ts.isSyntaxList(c) && c.pos <= node.pos && c.end >= node.end) { return c; } }); @@ -60116,7 +60979,7 @@ var ts; } var start = allowPositionInLeadingTrivia ? child.getFullStart() : child.getStart(sourceFile, includeJsDocComment); if (start > position) { - continue; + break; } var end = child.getEnd(); if (position < end || (position === end && (child.kind === 1 || includeEndPosition))) { @@ -60207,7 +61070,7 @@ var ts; ts.findPrecedingToken = findPrecedingToken; function isInString(sourceFile, position) { var previousToken = findPrecedingToken(position, sourceFile); - if (previousToken && previousToken.kind === 9) { + if (previousToken && ts.isStringTextContainingNode(previousToken)) { var start = previousToken.getStart(); var end = previousToken.getEnd(); if (start < position && position < end) { @@ -60288,20 +61151,20 @@ var ts; var flags = ts.getCombinedModifierFlags(node); var result = []; if (flags & 8) - result.push(ts.ScriptElementKindModifier.privateMemberModifier); + result.push("private"); if (flags & 16) - result.push(ts.ScriptElementKindModifier.protectedMemberModifier); + result.push("protected"); if (flags & 4) - result.push(ts.ScriptElementKindModifier.publicMemberModifier); + result.push("public"); if (flags & 32) - result.push(ts.ScriptElementKindModifier.staticModifier); + result.push("static"); if (flags & 128) - result.push(ts.ScriptElementKindModifier.abstractModifier); + result.push("abstract"); if (flags & 1) - result.push(ts.ScriptElementKindModifier.exportedModifier); + result.push("export"); if (ts.isInAmbientContext(node)) - result.push(ts.ScriptElementKindModifier.ambientModifier); - return result.length > 0 ? result.join(",") : ts.ScriptElementKindModifier.none; + result.push("declare"); + return result.length > 0 ? result.join(",") : ""; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { @@ -60353,6 +61216,12 @@ var ts; return false; } ts.isAccessibilityModifier = isAccessibilityModifier; + function cloneCompilerOptions(options) { + var result = ts.clone(options); + ts.setConfigFileInOptions(result, options && options.configFile); + return result; + } + ts.cloneCompilerOptions = cloneCompilerOptions; function compareDataObjects(dst, src) { if (!dst || !src || Object.keys(dst).length !== Object.keys(src).length) { return false; @@ -60547,7 +61416,7 @@ var ts; else if (flags & 524288) { return ts.SymbolDisplayPartKind.aliasName; } - else if (flags & 8388608) { + else if (flags & 2097152) { return ts.SymbolDisplayPartKind.aliasName; } return ts.SymbolDisplayPartKind.text; @@ -60555,10 +61424,7 @@ var ts; } ts.symbolPart = symbolPart; function displayPart(text, kind) { - return { - text: text, - kind: ts.SymbolDisplayPartKind[kind] - }; + return { text: text, kind: ts.SymbolDisplayPartKind[kind] }; } ts.displayPart = displayPart; function spacePart() { @@ -60598,10 +61464,13 @@ var ts; } ts.lineBreakPart = lineBreakPart; function mapToDisplayParts(writeDisplayParts) { - writeDisplayParts(displayPartWriter); - var result = displayPartWriter.displayParts(); - displayPartWriter.clear(); - return result; + try { + writeDisplayParts(displayPartWriter); + return displayPartWriter.displayParts(); + } + finally { + displayPartWriter.clear(); + } } ts.mapToDisplayParts = mapToDisplayParts; function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) { @@ -60617,6 +61486,7 @@ var ts; } ts.symbolToDisplayParts = symbolToDisplayParts; function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) { + flags |= 65536; return mapToDisplayParts(function (writer) { typechecker.getSymbolDisplayBuilder().buildSignatureDisplay(signature, writer, enclosingDeclaration, flags); }); @@ -60624,7 +61494,7 @@ var ts; ts.signatureToDisplayParts = signatureToDisplayParts; function getDeclaredName(typeChecker, symbol, location) { if (isImportOrExportSpecifierName(location) || ts.isStringOrNumericLiteral(location) && location.parent.kind === 144) { - return location.text; + return ts.getTextOfIdentifierOrLiteral(location); } var localExportDefaultSymbol = ts.getLocalSymbolForExportDefault(symbol); return typeChecker.symbolToString(localExportDefaultSymbol || symbol); @@ -60656,38 +61526,9 @@ var ts; } ts.scriptKindIs = scriptKindIs; function getScriptKind(fileName, host) { - var scriptKind; - if (host && host.getScriptKind) { - scriptKind = host.getScriptKind(fileName); - } - if (!scriptKind) { - scriptKind = ts.getScriptKindFromFileName(fileName); - } - return ts.ensureScriptKind(fileName, scriptKind); + return ts.ensureScriptKind(fileName, host && host.getScriptKind && host.getScriptKind(fileName)); } ts.getScriptKind = getScriptKind; - function sanitizeConfigFile(configFileName, content) { - var options = { - fileName: "config.js", - compilerOptions: { - target: 2, - removeComments: true - }, - reportDiagnostics: true - }; - var _a = ts.transpileModule("(" + content + ")", options), outputText = _a.outputText, diagnostics = _a.diagnostics; - var trimmedOutput = outputText.trim(); - for (var _i = 0, diagnostics_3 = diagnostics; _i < diagnostics_3.length; _i++) { - var diagnostic = diagnostics_3[_i]; - diagnostic.start = diagnostic.start - 1; - } - var _b = ts.parseConfigFileTextToJson(configFileName, trimmedOutput.substring(1, trimmedOutput.length - 2), false), config = _b.config, error = _b.error; - return { - configJsonObject: config || {}, - diagnostics: error ? ts.concatenate(diagnostics, [error]) : diagnostics - }; - } - ts.sanitizeConfigFile = sanitizeConfigFile; function getFirstNonSpaceCharacterPosition(text, position) { while (ts.isWhiteSpaceLike(text.charCodeAt(position))) { position += 1; @@ -61225,7 +62066,7 @@ var ts; var lastEnd = 0; for (var i = 0; i < dense.length; i += 3) { var start = dense[i]; - var length_6 = dense[i + 1]; + var length_7 = dense[i + 1]; var type = dense[i + 2]; if (lastEnd >= 0) { var whitespaceLength_1 = start - lastEnd; @@ -61233,8 +62074,8 @@ var ts; entries.push({ length: whitespaceLength_1, classification: ts.TokenClass.Whitespace }); } } - entries.push({ length: length_6, classification: convertClassification(type) }); - lastEnd = start + length_6; + entries.push({ length: length_7, classification: convertClassification(type) }); + lastEnd = start + length_7; } var whitespaceLength = text.length - lastEnd; if (whitespaceLength > 0) { @@ -61351,11 +62192,11 @@ var ts; templateStack.pop(); } else { - ts.Debug.assert(token === 15, "Should have been a template middle. Was " + token); + ts.Debug.assertEqual(token, 15, "Should have been a template middle."); } } else { - ts.Debug.assert(lastTemplateStackToken === 17, "Should have been an open brace. Was: " + token); + ts.Debug.assertEqual(lastTemplateStackToken, 17, "Should have been an open brace"); templateStack.pop(); } } @@ -61588,7 +62429,7 @@ var ts; checkForClassificationCancellation(cancellationToken, kind); if (kind === 71 && !ts.nodeIsMissing(node)) { var identifier = node; - if (classifiableNames.get(identifier.text)) { + if (classifiableNames.has(identifier.escapedText)) { var symbol = typeChecker.getSymbolAtLocation(node); if (symbol) { var type = classifySymbol(symbol, ts.getMeaningFromLocation(node)); @@ -61605,29 +62446,29 @@ var ts; ts.getEncodedSemanticClassifications = getEncodedSemanticClassifications; function getClassificationTypeName(type) { switch (type) { - case 1: return ts.ClassificationTypeNames.comment; - case 2: return ts.ClassificationTypeNames.identifier; - case 3: return ts.ClassificationTypeNames.keyword; - case 4: return ts.ClassificationTypeNames.numericLiteral; - case 5: return ts.ClassificationTypeNames.operator; - case 6: return ts.ClassificationTypeNames.stringLiteral; - case 8: return ts.ClassificationTypeNames.whiteSpace; - case 9: return ts.ClassificationTypeNames.text; - case 10: return ts.ClassificationTypeNames.punctuation; - case 11: return ts.ClassificationTypeNames.className; - case 12: return ts.ClassificationTypeNames.enumName; - case 13: return ts.ClassificationTypeNames.interfaceName; - case 14: return ts.ClassificationTypeNames.moduleName; - case 15: return ts.ClassificationTypeNames.typeParameterName; - case 16: return ts.ClassificationTypeNames.typeAliasName; - case 17: return ts.ClassificationTypeNames.parameterName; - case 18: return ts.ClassificationTypeNames.docCommentTagName; - case 19: return ts.ClassificationTypeNames.jsxOpenTagName; - case 20: return ts.ClassificationTypeNames.jsxCloseTagName; - case 21: return ts.ClassificationTypeNames.jsxSelfClosingTagName; - case 22: return ts.ClassificationTypeNames.jsxAttribute; - case 23: return ts.ClassificationTypeNames.jsxText; - case 24: return ts.ClassificationTypeNames.jsxAttributeStringLiteralValue; + case 1: return "comment"; + case 2: return "identifier"; + case 3: return "keyword"; + case 4: return "number"; + case 5: return "operator"; + case 6: return "string"; + case 8: return "whitespace"; + case 9: return "text"; + case 10: return "punctuation"; + case 11: return "class name"; + case 12: return "enum name"; + case 13: return "interface name"; + case 14: return "module name"; + case 15: return "type parameter name"; + case 16: return "type alias name"; + case 17: return "parameter name"; + case 18: return "doc comment tag name"; + case 19: return "jsx open tag name"; + case 20: return "jsx close tag name"; + case 21: return "jsx self closing tag name"; + case 22: return "jsx attribute"; + case 23: return "jsx text"; + case 24: return "jsx attribute string literal value"; } } function convertClassifications(classifications) { @@ -61718,16 +62559,16 @@ var ts; pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18); pos = tag.tagName.end; switch (tag.kind) { - case 287: + case 279: processJSDocParameterTag(tag); break; - case 290: + case 282: processJSDocTemplateTag(tag); break; - case 289: + case 281: processElement(tag.typeExpression); break; - case 288: + case 280: processElement(tag.typeExpression); break; } @@ -61739,20 +62580,20 @@ var ts; } return; function processJSDocParameterTag(tag) { - if (tag.preParameterName) { - pushCommentRange(pos, tag.preParameterName.pos - pos); - pushClassification(tag.preParameterName.pos, tag.preParameterName.end - tag.preParameterName.pos, 17); - pos = tag.preParameterName.end; + if (tag.isNameFirst) { + pushCommentRange(pos, tag.name.pos - pos); + pushClassification(tag.name.pos, tag.name.end - tag.name.pos, 17); + pos = tag.name.end; } if (tag.typeExpression) { pushCommentRange(pos, tag.typeExpression.pos - pos); processElement(tag.typeExpression); pos = tag.typeExpression.end; } - if (tag.postParameterName) { - pushCommentRange(pos, tag.postParameterName.pos - pos); - pushClassification(tag.postParameterName.pos, tag.postParameterName.end - tag.postParameterName.pos, 17); - pos = tag.postParameterName.end; + if (!tag.isNameFirst) { + pushCommentRange(pos, tag.name.pos - pos); + pushClassification(tag.name.pos, tag.name.end - tag.name.pos, 17); + pos = tag.name.end; } } } @@ -61963,14 +62804,9 @@ var ts; PathCompletions.getStringLiteralCompletionEntriesFromModuleNames = getStringLiteralCompletionEntriesFromModuleNames; function getBaseDirectoriesFromRootDirs(rootDirs, basePath, scriptPath, ignoreCase) { rootDirs = ts.map(rootDirs, function (rootDirectory) { return ts.normalizePath(ts.isRootedDiskPath(rootDirectory) ? rootDirectory : ts.combinePaths(basePath, rootDirectory)); }); - var relativeDirectory; - for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) { - var rootDirectory = rootDirs_1[_i]; - if (ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase)) { - relativeDirectory = scriptPath.substr(rootDirectory.length); - break; - } - } + var relativeDirectory = ts.forEach(rootDirs, function (rootDirectory) { + return ts.containsPath(rootDirectory, scriptPath, basePath, ignoreCase) ? scriptPath.substr(rootDirectory.length) : undefined; + }); return ts.deduplicate(ts.map(rootDirs, function (rootDirectory) { return ts.combinePaths(rootDirectory, relativeDirectory); })); } function getCompletionEntriesForDirectoryFragmentWithRootDirs(rootDirs, fragment, scriptPath, extensions, includeExtensions, span, compilerOptions, host, exclude) { @@ -62014,7 +62850,7 @@ var ts; } } ts.forEachKey(foundFiles, function (foundFile) { - result.push(createCompletionEntryForModule(foundFile, ts.ScriptElementKind.scriptElement, span)); + result.push(createCompletionEntryForModule(foundFile, "script", span)); }); } var directories = tryGetDirectories(host, baseDirectory); @@ -62022,7 +62858,7 @@ var ts; for (var _a = 0, directories_2 = directories; _a < directories_2.length; _a++) { var directory = directories_2[_a]; var directoryName = ts.getBaseFileName(ts.normalizePath(directory)); - result.push(createCompletionEntryForModule(directoryName, ts.ScriptElementKind.directory, span)); + result.push(createCompletionEntryForModule(directoryName, "directory", span)); } } } @@ -62045,7 +62881,7 @@ var ts; var pattern = _a[_i]; for (var _b = 0, _c = getModulesForPathsPattern(fragment, baseUrl, pattern, fileExtensions, host); _b < _c.length; _b++) { var match = _c[_b]; - result.push(createCompletionEntryForModule(match, ts.ScriptElementKind.externalModuleName, span)); + result.push(createCompletionEntryForModule(match, "external module name", span)); } } } @@ -62053,7 +62889,7 @@ var ts; else if (ts.startsWith(path, fragment)) { var entry = paths[path] && paths[path].length === 1 && paths[path][0]; if (entry) { - result.push(createCompletionEntryForModule(path, ts.ScriptElementKind.externalModuleName, span)); + result.push(createCompletionEntryForModule(path, "external module name", span)); } } } @@ -62066,7 +62902,7 @@ var ts; getCompletionEntriesFromTypings(host, compilerOptions, scriptPath, span, result); for (var _d = 0, _e = enumeratePotentialNonRelativeModules(fragment, scriptPath, compilerOptions, typeChecker, host); _d < _e.length; _d++) { var moduleName = _e[_d]; - result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); + result.push(createCompletionEntryForModule(moduleName, "external module name", span)); } return result; } @@ -62093,8 +62929,8 @@ var ts; continue; } var start = completePrefix.length; - var length_7 = normalizedMatch.length - start - normalizedSuffix.length; - result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_7))); + var length_8 = normalizedMatch.length - start - normalizedSuffix.length; + result.push(ts.removeFileExtension(normalizedMatch.substr(start, length_8))); } return result; } @@ -62177,7 +63013,7 @@ var ts; if (options.types) { for (var _i = 0, _a = options.types; _i < _a.length; _i++) { var moduleName = _a[_i]; - result.push(createCompletionEntryForModule(moduleName, ts.ScriptElementKind.externalModuleName, span)); + result.push(createCompletionEntryForModule(moduleName, "external module name", span)); } } else if (host.getDirectories) { @@ -62209,7 +63045,7 @@ var ts; for (var _i = 0, directories_3 = directories; _i < directories_3.length; _i++) { var typeDirectory = directories_3[_i]; typeDirectory = ts.normalizePath(typeDirectory); - result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), ts.ScriptElementKind.externalModuleName, span)); + result.push(createCompletionEntryForModule(ts.getBaseFileName(typeDirectory), "external module name", span)); } } } @@ -62280,7 +63116,7 @@ var ts; } } function createCompletionEntryForModule(name, kind, replacementSpan) { - return { name: name, kind: kind, kindModifiers: ts.ScriptElementKindModifier.none, sortText: name, replacementSpan: replacementSpan }; + return { name: name, kind: kind, kindModifiers: "", sortText: name, replacementSpan: replacementSpan }; } function getDirectoryFragmentTextSpan(text, textStart) { var index = text.lastIndexOf(ts.directorySeparator); @@ -62337,6 +63173,12 @@ var ts; (function (ts) { var Completions; (function (Completions) { + var KeywordCompletionFilters; + (function (KeywordCompletionFilters) { + KeywordCompletionFilters[KeywordCompletionFilters["None"] = 0] = "None"; + KeywordCompletionFilters[KeywordCompletionFilters["ClassElementKeywords"] = 1] = "ClassElementKeywords"; + KeywordCompletionFilters[KeywordCompletionFilters["ConstructorParameterKeywords"] = 2] = "ConstructorParameterKeywords"; + })(KeywordCompletionFilters || (KeywordCompletionFilters = {})); function getCompletionsAtPosition(host, typeChecker, log, compilerOptions, sourceFile, position) { if (ts.isInReferenceComment(sourceFile, position)) { return Completions.PathCompletions.getTripleSlashReferenceCompletion(sourceFile, position, compilerOptions, host); @@ -62348,14 +63190,14 @@ var ts; if (!completionData) { return undefined; } - var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, request = completionData.request, hasFilteredClassMemberKeywords = completionData.hasFilteredClassMemberKeywords; + var symbols = completionData.symbols, isGlobalCompletion = completionData.isGlobalCompletion, isMemberCompletion = completionData.isMemberCompletion, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, request = completionData.request, keywordFilters = completionData.keywordFilters; if (sourceFile.languageVariant === 1 && location && location.parent && location.parent.kind === 252) { var tagName = location.parent.parent.openingElement.tagName; return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: false, entries: [{ name: tagName.getFullText(), - kind: ts.ScriptElementKind.classElement, + kind: "class", kindModifiers: undefined, sortText: "0", }] }; @@ -62371,50 +63213,43 @@ var ts; var entries = []; if (ts.isSourceFileJavaScript(sourceFile)) { var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, true, typeChecker, compilerOptions.target, log); - ts.addRange(entries, getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target)); + getJavaScriptCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target, entries); } else { - if (!symbols || symbols.length === 0) { - if (!hasFilteredClassMemberKeywords) { - return undefined; - } + if ((!symbols || symbols.length === 0) && keywordFilters === 0) { + return undefined; } getCompletionEntriesFromSymbols(symbols, entries, location, true, typeChecker, compilerOptions.target, log); } - if (hasFilteredClassMemberKeywords) { - ts.addRange(entries, classMemberKeywordCompletions); - } - else if (!isMemberCompletion) { - ts.addRange(entries, keywordCompletions); + if (keywordFilters !== 0 || !isMemberCompletion) { + ts.addRange(entries, getKeywordCompletions(keywordFilters)); } return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries }; } Completions.getCompletionsAtPosition = getCompletionsAtPosition; - function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames, target) { - var entries = []; - var nameTable = ts.getNameTable(sourceFile); - nameTable.forEach(function (pos, name) { + function getJavaScriptCompletionEntries(sourceFile, position, uniqueNames, target, entries) { + ts.getNameTable(sourceFile).forEach(function (pos, name) { if (pos === position) { return; } - if (!uniqueNames.get(name)) { - uniqueNames.set(name, name); - var displayName = getCompletionEntryDisplayName(ts.unescapeIdentifier(name), target, true); - if (displayName) { - var entry = { - name: displayName, - kind: ts.ScriptElementKind.warning, - kindModifiers: "", - sortText: "1" - }; - entries.push(entry); - } + var realName = ts.unescapeLeadingUnderscores(name); + if (uniqueNames.has(realName)) { + return; + } + uniqueNames.set(realName, true); + var displayName = getCompletionEntryDisplayName(realName, target, true); + if (displayName) { + entries.push({ + name: displayName, + kind: "warning", + kindModifiers: "", + sortText: "1" + }); } }); - return entries; } function createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target) { - var displayName = getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location); + var displayName = getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks); if (!displayName) { return undefined; } @@ -62433,10 +63268,10 @@ var ts; var symbol = symbols_5[_i]; var entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target); if (entry) { - var id = ts.escapeIdentifier(entry.name); - if (!uniqueNames.get(id)) { + var id = entry.name; + if (!uniqueNames.has(id)) { entries.push(entry); - uniqueNames.set(id, id); + uniqueNames.set(id, true); } } } @@ -62488,9 +63323,9 @@ var ts; var candidates = []; var entries = []; var uniques = ts.createMap(); - typeChecker.getResolvedSignature(argumentInfo.invocation, candidates); - for (var _i = 0, candidates_3 = candidates; _i < candidates_3.length; _i++) { - var candidate = candidates_3[_i]; + typeChecker.getResolvedSignature(argumentInfo.invocation, candidates, argumentInfo.argumentCount); + for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) { + var candidate = candidates_1[_i]; addStringLiteralCompletionsFromType(typeChecker.getParameterType(candidate, argumentInfo.argumentIndex), entries, typeChecker, uniques); } if (entries.length) { @@ -62539,8 +63374,8 @@ var ts; uniques.set(name, true); result.push({ name: name, - kindModifiers: ts.ScriptElementKindModifier.none, - kind: ts.ScriptElementKind.variableElement, + kindModifiers: "", + kind: "var", sortText: "0" }); } @@ -62549,10 +63384,10 @@ var ts; function getCompletionEntryDetails(typeChecker, log, compilerOptions, sourceFile, position, entryName) { var completionData = getCompletionData(typeChecker, log, sourceFile, position); if (completionData) { - var symbols = completionData.symbols, location_1 = completionData.location; - var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_1) === entryName ? s : undefined; }); + var symbols = completionData.symbols, location = completionData.location; + var symbol = ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, compilerOptions.target, false) === entryName ? s : undefined; }); if (symbol) { - var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location_1, location_1, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags; + var _a = ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, location, location, 7), displayParts = _a.displayParts, documentation = _a.documentation, symbolKind = _a.symbolKind, tags = _a.tags; return { name: entryName, kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol), @@ -62563,12 +63398,12 @@ var ts; }; } } - var keywordCompletion = ts.forEach(keywordCompletions, function (c) { return c.name === entryName; }); + var keywordCompletion = ts.forEach(getKeywordCompletions(0), function (c) { return c.name === entryName; }); if (keywordCompletion) { return { name: entryName, - kind: ts.ScriptElementKind.keyword, - kindModifiers: ts.ScriptElementKindModifier.none, + kind: "keyword", + kindModifiers: "", displayParts: [ts.displayPart(entryName, ts.SymbolDisplayPartKind.keyword)], documentation: undefined, tags: undefined @@ -62579,11 +63414,7 @@ var ts; Completions.getCompletionEntryDetails = getCompletionEntryDetails; function getCompletionEntrySymbol(typeChecker, log, compilerOptions, sourceFile, position, entryName) { var completionData = getCompletionData(typeChecker, log, sourceFile, position); - if (completionData) { - var symbols = completionData.symbols, location_2 = completionData.location; - return ts.forEach(symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(typeChecker, s, compilerOptions.target, false, location_2) === entryName ? s : undefined; }); - } - return undefined; + return completionData && ts.forEach(completionData.symbols, function (s) { return getCompletionEntryDisplayNameForSymbol(s, compilerOptions.target, false) === entryName ? s : undefined; }); } Completions.getCompletionEntrySymbol = getCompletionEntrySymbol; function getCompletionData(typeChecker, log, sourceFile, position) { @@ -62613,11 +63444,11 @@ var ts; if (tag.tagName.pos <= position && position <= tag.tagName.end) { request = { kind: "JsDocTagName" }; } - if (isTagWithTypeExpression(tag) && tag.typeExpression) { + if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 267) { currentToken = ts.getTokenAtPosition(sourceFile, position, true); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 292 || + (currentToken.parent.kind !== 284 || currentToken.parent.name !== currentToken))) { insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression); } @@ -62627,7 +63458,7 @@ var ts; } } if (request) { - return { symbols: undefined, isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, request: request, hasFilteredClassMemberKeywords: false }; + return { symbols: undefined, isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, location: undefined, isRightOfDot: false, request: request, keywordFilters: 0 }; } if (!insideJsDocTagTypeExpression) { log("Returning an empty list because completion was inside a regular comment or plain text part of a JsDoc comment."); @@ -62639,9 +63470,9 @@ var ts; log("getCompletionData: Get previous token 1: " + (ts.timestamp() - start)); var contextToken = previousToken; if (contextToken && position <= contextToken.end && ts.isWord(contextToken.kind)) { - var start_2 = ts.timestamp(); + var start_4 = ts.timestamp(); contextToken = ts.findPrecedingToken(contextToken.getFullStart(), sourceFile, undefined, insideJsDocTagTypeExpression); - log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_2)); + log("getCompletionData: Get previous token 2: " + (ts.timestamp() - start_4)); } var node = currentToken; var isRightOfDot = false; @@ -62698,7 +63529,7 @@ var ts; var isGlobalCompletion = false; var isMemberCompletion; var isNewIdentifierLocation; - var hasFilteredClassMemberKeywords = false; + var keywordFilters = 0; var symbols = []; if (isRightOfDot) { getTypeScriptMemberSymbols(); @@ -62706,7 +63537,7 @@ var ts; else if (isRightOfOpenTag) { var tagSymbols = typeChecker.getJsxIntrinsicTagNames(); if (tryGetGlobalSymbols()) { - symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 | 8388608)); })); + symbols = tagSymbols.concat(symbols.filter(function (s) { return !!(s.flags & (107455 | 2097152)); })); } else { symbols = tagSymbols; @@ -62729,15 +63560,15 @@ var ts; } } log("getCompletionData: Semantic work: " + (ts.timestamp() - semanticStart)); - return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), request: request, hasFilteredClassMemberKeywords: hasFilteredClassMemberKeywords }; + return { symbols: symbols, isGlobalCompletion: isGlobalCompletion, isMemberCompletion: isMemberCompletion, isNewIdentifierLocation: isNewIdentifierLocation, location: location, isRightOfDot: (isRightOfDot || isRightOfOpenTag), request: request, keywordFilters: keywordFilters }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 285: - case 287: - case 292: - case 288: - case 289: - case 291: + case 277: + case 279: + case 284: + case 280: + case 281: + case 283: return true; } } @@ -62745,46 +63576,48 @@ var ts; isGlobalCompletion = false; isMemberCompletion = true; isNewIdentifierLocation = false; - var isTypeLocation = ts.isPartOfTypeNode(node.parent) || insideJsDocTagTypeExpression; + var isTypeLocation = insideJsDocTagTypeExpression || ts.isPartOfTypeNode(node.parent); var isRhsOfImportDeclaration = ts.isInRightSideOfInternalImportEqualsDeclaration(node); - if (node.kind === 71 || node.kind === 143 || node.kind === 179) { + if (ts.isEntityName(node)) { var symbol = typeChecker.getSymbolAtLocation(node); - if (symbol && symbol.flags & 8388608) { - symbol = typeChecker.getAliasedSymbol(symbol); - } - if (symbol && symbol.flags & 1952) { - var exportedSymbols = typeChecker.getExportsOfModule(symbol); - var isValidValueAccess_1 = function (symbol) { return typeChecker.isValidPropertyAccess((node.parent), symbol.name); }; - var isValidTypeAccess_1 = function (symbol) { return symbolCanbeReferencedAtTypeLocation(symbol); }; - var isValidAccess_1 = isRhsOfImportDeclaration ? - function (symbol) { return isValidTypeAccess_1(symbol) || isValidValueAccess_1(symbol); } : - isTypeLocation ? isValidTypeAccess_1 : isValidValueAccess_1; - ts.forEach(exportedSymbols, function (symbol) { - if (isValidAccess_1(symbol)) { - symbols.push(symbol); + if (symbol) { + symbol = ts.skipAlias(symbol, typeChecker); + if (symbol.flags & (1536 | 384)) { + var exportedSymbols = typeChecker.getExportsOfModule(symbol); + var isValidValueAccess_1 = function (symbol) { return typeChecker.isValidPropertyAccess((node.parent), symbol.name); }; + var isValidTypeAccess_1 = function (symbol) { return symbolCanBeReferencedAtTypeLocation(symbol); }; + var isValidAccess = isRhsOfImportDeclaration ? + function (symbol) { return isValidTypeAccess_1(symbol) || isValidValueAccess_1(symbol); } : + isTypeLocation ? isValidTypeAccess_1 : isValidValueAccess_1; + for (var _i = 0, exportedSymbols_1 = exportedSymbols; _i < exportedSymbols_1.length; _i++) { + var symbol_2 = exportedSymbols_1[_i]; + if (isValidAccess(symbol_2)) { + symbols.push(symbol_2); + } } - }); + if (!isTypeLocation && symbol.declarations.some(function (d) { return d.kind !== 265 && d.kind !== 233 && d.kind !== 232; })) { + addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node)); + } + return; + } } } if (!isTypeLocation) { - var type = typeChecker.getTypeAtLocation(node); - addTypeProperties(type); + addTypeProperties(typeChecker.getTypeAtLocation(node)); } } function addTypeProperties(type) { - if (type) { - for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { - var symbol = _a[_i]; - if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) { - symbols.push(symbol); - } + for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { + var symbol = _a[_i]; + if (typeChecker.isValidPropertyAccess((node.parent), symbol.name)) { + symbols.push(symbol); } - if (isJavaScriptFile && type.flags & 65536) { - var unionType = type; - for (var _b = 0, _c = unionType.types; _b < _c.length; _b++) { - var elementType = _c[_b]; - addTypeProperties(elementType); - } + } + if (isJavaScriptFile && type.flags & 65536) { + var unionType = type; + for (var _b = 0, _c = unionType.types; _b < _c.length; _b++) { + var elementType = _c[_b]; + addTypeProperties(elementType); } } } @@ -62799,6 +63632,12 @@ var ts; if (namedImportsOrExports = tryGetNamedImportsOrExportsForCompletion(contextToken)) { return tryGetImportOrExportClauseCompletionSymbols(namedImportsOrExports); } + if (tryGetConstructorLikeCompletionContainer(contextToken)) { + isMemberCompletion = false; + isNewIdentifierLocation = true; + keywordFilters = 2; + return true; + } if (classLikeContainer = tryGetClassLikeCompletionContainer(contextToken)) { getGetClassLikeCompletionSymbols(classLikeContainer); return true; @@ -62831,7 +63670,7 @@ var ts; scopeNode.kind === 256 || ts.isStatement(scopeNode); } - var symbolMeanings = 793064 | 107455 | 1920 | 8388608; + var symbolMeanings = 793064 | 107455 | 1920 | 2097152; symbols = filterGlobalCompletion(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings)); return true; } @@ -62841,7 +63680,7 @@ var ts; if (ts.isExportAssignment(location.parent)) { return true; } - if (symbol && symbol.flags & 8388608) { + if (symbol && symbol.flags & 2097152) { symbol = typeChecker.getAliasedSymbol(symbol); } if (ts.isInRightSideOfInternalImportEqualsDeclaration(location)) { @@ -62850,10 +63689,10 @@ var ts; if (insideJsDocTagTypeExpression || (!isContextTokenValueLocation(contextToken) && (ts.isPartOfTypeNode(location) || isContextTokenTypeLocation(contextToken)))) { - return symbolCanbeReferencedAtTypeLocation(symbol); + return symbolCanBeReferencedAtTypeLocation(symbol); } } - return !!(symbol.flags & 107455); + return !!(ts.getCombinedLocalAndExportSymbolFlags(symbol) & 107455); }); } function isContextTokenValueLocation(contextToken) { @@ -62878,16 +63717,15 @@ var ts; } } } - function symbolCanbeReferencedAtTypeLocation(symbol) { - if (symbol && symbol.flags & 8388608) { - symbol = typeChecker.getAliasedSymbol(symbol); - } + function symbolCanBeReferencedAtTypeLocation(symbol) { + symbol = symbol.exportSymbol || symbol; + symbol = ts.skipAlias(symbol, typeChecker); if (symbol.flags & 793064) { return true; } - if (symbol.flags & (512 | 1024)) { + if (symbol.flags & 1536) { var exportedSymbols = typeChecker.getExportsOfModule(symbol); - return ts.forEach(exportedSymbols, symbolCanbeReferencedAtTypeLocation); + return ts.forEach(exportedSymbols, symbolCanBeReferencedAtTypeLocation); } } function getScopeNode(initialToken, position, sourceFile) { @@ -62973,9 +63811,9 @@ var ts; if (contextToken.kind === 9 || contextToken.kind === 12 || ts.isTemplateLiteralKind(contextToken.kind)) { - var start_3 = contextToken.getStart(); + var start_5 = contextToken.getStart(); var end = contextToken.getEnd(); - if (start_3 < position && position < end) { + if (start_5 < position && position < end) { return true; } if (position === end) { @@ -63016,7 +63854,7 @@ var ts; var typeForObject = typeChecker.getTypeAtLocation(objectLikeContainer); if (!typeForObject) return false; - typeMembers = typeChecker.getPropertiesOfType(typeForObject); + typeMembers = typeChecker.getPropertiesOfType(typeForObject).filter(function (symbol) { return !(ts.getDeclarationModifierFlagsFromSymbol(symbol) & 24); }); existingMembers = objectLikeContainer.elements; } } @@ -63048,7 +63886,7 @@ var ts; function getGetClassLikeCompletionSymbols(classLikeDeclaration) { isMemberCompletion = true; isNewIdentifierLocation = true; - hasFilteredClassMemberKeywords = true; + keywordFilters = 1; var baseTypeNode = ts.getClassExtendsHeritageClauseElement(classLikeDeclaration); var implementsTypeNodes = ts.getClassImplementsHeritageClauseElements(classLikeDeclaration); if (baseTypeNode || implementsTypeNodes) { @@ -63073,11 +63911,11 @@ var ts; } } var implementedInterfaceTypePropertySymbols = (classElementModifierFlags & 32) ? - undefined : - ts.flatMap(implementsTypeNodes, function (typeNode) { return typeChecker.getPropertiesOfType(typeChecker.getTypeAtLocation(typeNode)); }); + ts.emptyArray : + ts.flatMap(implementsTypeNodes || ts.emptyArray, function (typeNode) { return typeChecker.getPropertiesOfType(typeChecker.getTypeAtLocation(typeNode)); }); symbols = filterClassMembersList(baseClassTypeToGetPropertiesFrom ? typeChecker.getPropertiesOfType(baseClassTypeToGetPropertiesFrom) : - undefined, implementedInterfaceTypePropertySymbols, classLikeDeclaration.members, classElementModifierFlags); + ts.emptyArray, implementedInterfaceTypePropertySymbols, classLikeDeclaration.members, classElementModifierFlags); } } } @@ -63112,6 +63950,14 @@ var ts; function isFromClassElementDeclaration(node) { return ts.isClassElement(node.parent) && ts.isClassLike(node.parent.parent); } + function isParameterOfConstructorDeclaration(node) { + return ts.isParameter(node) && ts.isConstructorDeclaration(node.parent); + } + function isConstructorParameterCompletion(node) { + return node.parent && + isParameterOfConstructorDeclaration(node.parent) && + (isConstructorParameterCompletionKeyword(node.kind) || ts.isDeclarationName(node)); + } function tryGetClassLikeCompletionContainer(contextToken) { if (contextToken) { switch (contextToken.kind) { @@ -63121,6 +63967,10 @@ var ts; } break; case 26: + if (ts.isClassLike(contextToken.parent)) { + return contextToken.parent; + } + break; case 25: case 18: if (ts.isClassLike(location)) { @@ -63135,11 +63985,25 @@ var ts; } } } - if (location && location.kind === 295 && ts.isClassLike(location.parent)) { + if (location && location.kind === 286 && ts.isClassLike(location.parent)) { return location.parent; } return undefined; } + function tryGetConstructorLikeCompletionContainer(contextToken) { + if (contextToken) { + switch (contextToken.kind) { + case 19: + case 26: + return ts.isConstructorDeclaration(contextToken.parent) && contextToken.parent; + default: + if (isConstructorParameterCompletion(contextToken)) { + return contextToken.parent.parent; + } + } + } + return undefined; + } function tryGetContainingJsxElement(contextToken) { if (contextToken) { var parent = contextToken.parent; @@ -63186,11 +64050,12 @@ var ts; containingNodeKind === 208 || containingNodeKind === 232 || isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 229 || - containingNodeKind === 199 || containingNodeKind === 230 || containingNodeKind === 175 || - containingNodeKind === 231; + containingNodeKind === 231 || + (ts.isClassLike(contextToken.parent) && + contextToken.parent.typeParameters && + contextToken.parent.typeParameters.end >= contextToken.pos); case 23: return containingNodeKind === 175; case 56: @@ -63224,7 +64089,7 @@ var ts; case 114: case 112: case 113: - return containingNodeKind === 146; + return containingNodeKind === 146 && !ts.isConstructorDeclaration(contextToken.parent.parent); case 118: return containingNodeKind === 242 || containingNodeKind === 246 || @@ -63250,6 +64115,13 @@ var ts; isFromClassElementDeclaration(contextToken)) { return false; } + if (isConstructorParameterCompletion(contextToken)) { + if (!ts.isIdentifier(contextToken) || + isConstructorParameterCompletionKeywordText(contextToken.getText()) || + isCurrentlyEditingNode(contextToken)) { + return false; + } + } switch (contextToken.getText()) { case "abstract": case "async": @@ -63268,7 +64140,7 @@ var ts; case "yield": return true; } - return false; + return ts.isDeclarationName(contextToken) && !ts.isJsxAttribute(contextToken.parent); } function isFunctionLikeButNotConstructor(kind) { return ts.isFunctionLikeKind(kind) && kind !== 152; @@ -63281,25 +64153,25 @@ var ts; return false; } function filterNamedImportOrExportCompletionItems(exportsOfModule, namedImportsOrExports) { - var existingImportsOrExports = ts.createMap(); + var existingImportsOrExports = ts.createUnderscoreEscapedMap(); for (var _i = 0, namedImportsOrExports_1 = namedImportsOrExports; _i < namedImportsOrExports_1.length; _i++) { var element = namedImportsOrExports_1[_i]; if (isCurrentlyEditingNode(element)) { continue; } var name = element.propertyName || element.name; - existingImportsOrExports.set(name.text, true); + existingImportsOrExports.set(name.escapedText, true); } if (existingImportsOrExports.size === 0) { - return ts.filter(exportsOfModule, function (e) { return e.name !== "default"; }); + return ts.filter(exportsOfModule, function (e) { return e.escapedName !== "default"; }); } - return ts.filter(exportsOfModule, function (e) { return e.name !== "default" && !existingImportsOrExports.get(e.name); }); + return ts.filter(exportsOfModule, function (e) { return e.escapedName !== "default" && !existingImportsOrExports.get(e.escapedName); }); } function filterObjectMembersList(contextualMemberSymbols, existingMembers) { if (!existingMembers || existingMembers.length === 0) { return contextualMemberSymbols; } - var existingMemberNames = ts.createMap(); + var existingMemberNames = ts.createUnderscoreEscapedMap(); for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; if (m.kind !== 261 && @@ -63316,18 +64188,19 @@ var ts; var existingName = void 0; if (m.kind === 176 && m.propertyName) { if (m.propertyName.kind === 71) { - existingName = m.propertyName.text; + existingName = m.propertyName.escapedText; } } else { - existingName = ts.getNameOfDeclaration(m).text; + var name = ts.getNameOfDeclaration(m); + existingName = ts.getEscapedTextOfIdentifierOrLiteral(name); } existingMemberNames.set(existingName, true); } - return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames.get(m.name); }); + return ts.filter(contextualMemberSymbols, function (m) { return !existingMemberNames.get(m.escapedName); }); } function filterClassMembersList(baseSymbols, implementingTypeSymbols, existingMembers, currentClassElementModifierFlags) { - var existingMemberNames = ts.createMap(); + var existingMemberNames = ts.createUnderscoreEscapedMap(); for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; if (m.kind !== 149 && @@ -63353,63 +64226,91 @@ var ts; existingMemberNames.set(existingName, true); } } - return ts.concatenate(ts.filter(baseSymbols, function (baseProperty) { return isValidProperty(baseProperty, 8); }), ts.filter(implementingTypeSymbols, function (implementingProperty) { return isValidProperty(implementingProperty, 24); })); + var result = []; + addPropertySymbols(baseSymbols, 8); + addPropertySymbols(implementingTypeSymbols, 24); + return result; + function addPropertySymbols(properties, inValidModifierFlags) { + for (var _i = 0, properties_12 = properties; _i < properties_12.length; _i++) { + var property = properties_12[_i]; + if (isValidProperty(property, inValidModifierFlags)) { + result.push(property); + } + } + } function isValidProperty(propertySymbol, inValidModifierFlags) { - return !existingMemberNames.get(propertySymbol.name) && + return !existingMemberNames.get(propertySymbol.escapedName) && propertySymbol.getDeclarations() && !(ts.getDeclarationModifierFlagsFromSymbol(propertySymbol) & inValidModifierFlags); } } function filterJsxAttributes(symbols, attributes) { - var seenNames = ts.createMap(); + var seenNames = ts.createUnderscoreEscapedMap(); for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) { var attr = attributes_1[_i]; if (isCurrentlyEditingNode(attr)) { continue; } if (attr.kind === 253) { - seenNames.set(attr.name.text, true); + seenNames.set(attr.name.escapedText, true); } } - return ts.filter(symbols, function (a) { return !seenNames.get(a.name); }); + return ts.filter(symbols, function (a) { return !seenNames.get(a.escapedName); }); } function isCurrentlyEditingNode(node) { return node.getStart() <= position && position <= node.getEnd(); } } - function getCompletionEntryDisplayNameForSymbol(typeChecker, symbol, target, performCharacterChecks, location) { - var displayName = ts.getDeclaredName(typeChecker, symbol, location); - if (displayName) { - var firstCharCode = displayName.charCodeAt(0); - if ((symbol.flags & 1920) && (firstCharCode === 39 || firstCharCode === 34)) { + function getCompletionEntryDisplayNameForSymbol(symbol, target, performCharacterChecks) { + var name = symbol.name; + if (!name) + return undefined; + if (symbol.flags & 1920) { + var firstCharCode = name.charCodeAt(0); + if (firstCharCode === 39 || firstCharCode === 34) { return undefined; } } - return getCompletionEntryDisplayName(displayName, target, performCharacterChecks); + return getCompletionEntryDisplayName(name, target, performCharacterChecks); } function getCompletionEntryDisplayName(name, target, performCharacterChecks) { - if (!name) { + if (performCharacterChecks && !ts.isIdentifierText(name, target)) { return undefined; } - name = ts.stripQuotes(name); - if (!name) { - return undefined; + return name; + } + var _keywordCompletions = []; + function getKeywordCompletions(keywordFilter) { + var completions = _keywordCompletions[keywordFilter]; + if (completions) { + return completions; } - if (performCharacterChecks) { - if (!ts.isIdentifierText(name, target)) { - return undefined; + return _keywordCompletions[keywordFilter] = generateKeywordCompletions(keywordFilter); + function generateKeywordCompletions(keywordFilter) { + switch (keywordFilter) { + case 0: + return getAllKeywordCompletions(); + case 1: + return getFilteredKeywordCompletions(isClassMemberCompletionKeywordText); + case 2: + return getFilteredKeywordCompletions(isConstructorParameterCompletionKeywordText); } } - return name; - } - var keywordCompletions = []; - for (var i = 72; i <= 142; i++) { - keywordCompletions.push({ - name: ts.tokenToString(i), - kind: ts.ScriptElementKind.keyword, - kindModifiers: ts.ScriptElementKindModifier.none, - sortText: "0" - }); + function getAllKeywordCompletions() { + var allKeywordsCompletions = []; + for (var i = 72; i <= 142; i++) { + allKeywordsCompletions.push({ + name: ts.tokenToString(i), + kind: "keyword", + kindModifiers: "", + sortText: "0" + }); + } + return allKeywordsCompletions; + } + function getFilteredKeywordCompletions(filterFn) { + return ts.filter(getKeywordCompletions(0), function (entry) { return filterFn(entry.name); }); + } } function isClassMemberCompletionKeyword(kind) { switch (kind) { @@ -63429,9 +64330,18 @@ var ts; function isClassMemberCompletionKeywordText(text) { return isClassMemberCompletionKeyword(ts.stringToToken(text)); } - var classMemberKeywordCompletions = ts.filter(keywordCompletions, function (entry) { - return isClassMemberCompletionKeywordText(entry.name); - }); + function isConstructorParameterCompletionKeyword(kind) { + switch (kind) { + case 114: + case 112: + case 113: + case 131: + return true; + } + } + function isConstructorParameterCompletionKeywordText(text) { + return isConstructorParameterCompletionKeyword(ts.stringToToken(text)); + } function isEqualityExpression(node) { return ts.isBinaryExpression(node) && isEqualityOperatorKind(node.operatorToken.kind); } @@ -63477,8 +64387,9 @@ var ts; (function (DocumentHighlights) { function getDocumentHighlights(program, cancellationToken, sourceFile, position, sourceFilesToSearch) { var node = ts.getTouchingWord(sourceFile, position, true); - if (!node) + if (node === sourceFile) return undefined; + ts.Debug.assert(node.parent !== undefined); if (ts.isJsxOpeningElement(node.parent) && node.parent.tagName === node || ts.isJsxClosingElement(node.parent)) { var _a = node.parent.parent, openingElement = _a.openingElement, closingElement = _a.closingElement; var highlightSpans = [openingElement, closingElement].map(function (_a) { @@ -63494,7 +64405,7 @@ var ts; return { fileName: sourceFile.fileName, textSpan: ts.createTextSpanFromNode(node, sourceFile), - kind: ts.HighlightSpanKind.none + kind: "none" }; } function getSemanticDocumentHighlights(node, program, cancellationToken, sourceFilesToSearch) { @@ -63728,7 +64639,7 @@ var ts; case 234: case 265: if (modifierFlag & 128) { - nodes = declaration.members.concat(declaration); + nodes = declaration.members.concat([declaration]); } else { nodes = container.statements; @@ -63749,7 +64660,7 @@ var ts; } } else if (modifierFlag & 128) { - nodes = nodes.concat(container); + nodes = nodes.concat([container]); } break; default: @@ -63941,7 +64852,7 @@ var ts; result.push({ fileName: sourceFile.fileName, textSpan: ts.createTextSpanFromBounds(elseKeyword.getStart(), ifKeyword.end), - kind: ts.HighlightSpanKind.reference + kind: "reference" }); i++; continue; @@ -63953,7 +64864,7 @@ var ts; } function isLabeledBy(node, labelName) { for (var owner = node.parent; owner.kind === 222; owner = owner.parent) { - if (owner.label.text === labelName) { + if (owner.label.escapedText === labelName) { return true; } } @@ -63973,7 +64884,7 @@ var ts; function getBucketForCompilationSettings(key, createIfMissing) { var bucket = buckets.get(key); if (!bucket && createIfMissing) { - buckets.set(key, bucket = ts.createFileMap()); + buckets.set(key, bucket = ts.createMap()); } return bucket; } @@ -63981,9 +64892,9 @@ var ts; var bucketInfoArray = ts.arrayFrom(buckets.keys()).filter(function (name) { return name && name.charAt(0) === "_"; }).map(function (name) { var entries = buckets.get(name); var sourceFiles = []; - entries.forEachValue(function (key, entry) { + entries.forEach(function (entry, name) { sourceFiles.push({ - name: key, + name: name, refCount: entry.languageServiceRefCount, references: entry.owners.slice(0) }); @@ -64016,11 +64927,10 @@ var ts; var bucket = getBucketForCompilationSettings(key, true); var entry = bucket.get(path); if (!entry) { - ts.Debug.assert(acquiring, "How could we be trying to update a document that the registry doesn't have?"); var sourceFile = ts.createLanguageServiceSourceFile(fileName, scriptSnapshot, compilationSettings.target, version, false, scriptKind); entry = { sourceFile: sourceFile, - languageServiceRefCount: 0, + languageServiceRefCount: 1, owners: [] }; bucket.set(path, entry); @@ -64029,9 +64939,9 @@ var ts; if (entry.sourceFile.version !== version) { entry.sourceFile = ts.updateLanguageServiceSourceFile(entry.sourceFile, scriptSnapshot, version, scriptSnapshot.getChangeRange(entry.sourceFile.scriptSnapshot)); } - } - if (acquiring) { - entry.languageServiceRefCount++; + if (acquiring) { + entry.languageServiceRefCount++; + } } return entry.sourceFile; } @@ -64047,7 +64957,7 @@ var ts; entry.languageServiceRefCount--; ts.Debug.assert(entry.languageServiceRefCount >= 0); if (entry.languageServiceRefCount === 0) { - bucket.remove(path); + bucket.delete(path); } } return { @@ -64196,7 +65106,7 @@ var ts; } } function getSearchesFromDirectImports(directImports, exportSymbol, exportKind, checker, isForRename) { - var exportName = exportSymbol.name; + var exportName = exportSymbol.escapedName; var importSearches = []; var singleReferences = []; function addSearch(location, symbol) { @@ -64241,7 +65151,7 @@ var ts; } else { var name = importClause.name; - if (name && (!isForRename || name.text === symbolName(exportSymbol))) { + if (name && (!isForRename || name.escapedText === symbolName(exportSymbol))) { var defaultImportAlias = checker.getSymbolAtLocation(name); addSearch(name, defaultImportAlias); } @@ -64252,7 +65162,7 @@ var ts; } } function handleNamespaceImportLike(importName) { - if (exportKind === 2 && (!isForRename || importName.text === exportName)) { + if (exportKind === 2 && (!isForRename || importName.escapedText === exportName)) { addSearch(importName, checker.getSymbolAtLocation(importName)); } } @@ -64261,7 +65171,7 @@ var ts; for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var element = _a[_i]; var name = element.name, propertyName = element.propertyName; - if ((propertyName || name).text !== exportName) { + if ((propertyName || name).escapedText !== exportName) { continue; } if (propertyName) { @@ -64399,20 +65309,18 @@ var ts; return comingFromExport ? getExport() : getExport() || getImport(); function getExport() { var parent = node.parent; - if (symbol.flags & 7340032) { + if (symbol.exportSymbol) { if (parent.kind === 179) { return symbol.declarations.some(function (d) { return d === parent; }) && ts.isBinaryExpression(parent.parent) ? getSpecialPropertyExport(parent.parent, false) : undefined; } else { - var exportSymbol = symbol.exportSymbol; - ts.Debug.assert(!!exportSymbol); - return exportInfo(exportSymbol, getExportKindForDeclaration(parent)); + return exportInfo(symbol.exportSymbol, getExportKindForDeclaration(parent)); } } else { - var exportNode = getExportNode(parent); + var exportNode = getExportNode(parent, node); if (exportNode && ts.hasModifier(exportNode, 1)) { if (ts.isImportEqualsDeclaration(exportNode) && exportNode.moduleReference === node) { if (comingFromExport) { @@ -64467,10 +65375,10 @@ var ts; if (!importedSymbol) return undefined; importedSymbol = skipExportSpecifierSymbol(importedSymbol, checker); - if (importedSymbol.name === "export=") { + if (importedSymbol.escapedName === "export=") { importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker); } - if (symbolName(importedSymbol) === symbol.name) { + if (symbolName(importedSymbol) === symbol.escapedName) { return __assign({ kind: 0, symbol: importedSymbol }, isImport); } } @@ -64484,7 +65392,7 @@ var ts; } FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; function getExportEqualsLocalSymbol(importedSymbol, checker) { - if (importedSymbol.flags & 8388608) { + if (importedSymbol.flags & 2097152) { return checker.getImmediateAliasedSymbol(importedSymbol); } var decl = importedSymbol.valueDeclaration; @@ -64496,10 +65404,11 @@ var ts; } ts.Debug.fail(); } - function getExportNode(parent) { + function getExportNode(parent, node) { if (parent.kind === 226) { var p = parent; - return p.parent.kind === 260 ? undefined : p.parent.parent.kind === 208 ? p.parent.parent : undefined; + return p.name !== node ? undefined : + p.parent.kind === 260 ? undefined : p.parent.parent.kind === 208 ? p.parent.parent : undefined; } else { return parent; @@ -64528,15 +65437,15 @@ var ts; } FindAllReferences.getExportInfo = getExportInfo; function symbolName(symbol) { - if (symbol.name !== "default") { - return symbol.name; + if (symbol.escapedName !== "default") { + return symbol.escapedName; } return ts.forEach(symbol.declarations, function (decl) { if (ts.isExportAssignment(decl)) { - return ts.isIdentifier(decl.expression) ? decl.expression.text : undefined; + return ts.isIdentifier(decl.expression) ? decl.expression.escapedText : undefined; } var name = ts.getNameOfDeclaration(decl); - return name && name.kind === 71 && name.text; + return name && name.kind === 71 && name.escapedText; }); } function skipExportSpecifierSymbol(symbol, checker) { @@ -64650,22 +65559,22 @@ var ts; } case "label": { var node_3 = def.node; - return { node: node_3, name: node_3.text, kind: ts.ScriptElementKind.label, displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] }; + return { node: node_3, name: node_3.text, kind: "label", displayParts: [ts.displayPart(node_3.text, ts.SymbolDisplayPartKind.text)] }; } case "keyword": { var node_4 = def.node; var name_4 = ts.tokenToString(node_4.kind); - return { node: node_4, name: name_4, kind: ts.ScriptElementKind.keyword, displayParts: [{ text: name_4, kind: ts.ScriptElementKind.keyword }] }; + return { node: node_4, name: name_4, kind: "keyword", displayParts: [{ text: name_4, kind: "keyword" }] }; } case "this": { var node_5 = def.node; var symbol = checker.getSymbolAtLocation(node_5); var displayParts_2 = symbol && ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(checker, symbol, node_5.getSourceFile(), ts.getContainerNode(node_5), node_5).displayParts; - return { node: node_5, name: "this", kind: ts.ScriptElementKind.variableElement, displayParts: displayParts_2 }; + return { node: node_5, name: "this", kind: "var", displayParts: displayParts_2 }; } case "string": { var node_6 = def.node; - return { node: node_6, name: node_6.text, kind: ts.ScriptElementKind.variableElement, displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] }; + return { node: node_6, name: node_6.text, kind: "var", displayParts: [ts.displayPart(ts.getTextOfNode(node_6), ts.SymbolDisplayPartKind.stringLiteral)] }; } } })(); @@ -64708,7 +65617,7 @@ var ts; } else { var textSpan = entry.textSpan, fileName = entry.fileName; - return { textSpan: textSpan, fileName: fileName, kind: ts.ScriptElementKind.unknown, displayParts: [] }; + return { textSpan: textSpan, fileName: fileName, kind: "", displayParts: [] }; } } function implementationKindDisplayParts(node, checker) { @@ -64718,13 +65627,13 @@ var ts; } else if (node.kind === 178) { return { - kind: ts.ScriptElementKind.interfaceElement, + kind: "interface", displayParts: [ts.punctuationPart(19), ts.textPart("object literal"), ts.punctuationPart(20)] }; } else if (node.kind === 199) { return { - kind: ts.ScriptElementKind.localClassElement, + kind: "local class", displayParts: [ts.punctuationPart(19), ts.textPart("anonymous local class"), ts.punctuationPart(20)] }; } @@ -64735,14 +65644,14 @@ var ts; function toHighlightSpan(entry) { if (entry.type === "span") { var fileName_1 = entry.fileName, textSpan = entry.textSpan; - return { fileName: fileName_1, span: { textSpan: textSpan, kind: ts.HighlightSpanKind.reference } }; + return { fileName: fileName_1, span: { textSpan: textSpan, kind: "reference" } }; } var node = entry.node, isInString = entry.isInString; var fileName = entry.node.getSourceFile().fileName; var writeAccess = isWriteAccess(node); var span = { textSpan: getTextSpan(node), - kind: writeAccess ? ts.HighlightSpanKind.writtenReference : ts.HighlightSpanKind.reference, + kind: writeAccess ? "writtenReference" : "reference", isInString: isInString }; return { fileName: fileName, span: span }; @@ -64924,7 +65833,7 @@ var ts; State.prototype.createSearch = function (location, symbol, comingFrom, searchOptions) { if (searchOptions === void 0) { searchOptions = {}; } var _a = searchOptions.text, text = _a === void 0 ? ts.stripQuotes(ts.getDeclaredName(this.checker, symbol, location)) : _a, _b = searchOptions.allSearchSymbols, allSearchSymbols = _b === void 0 ? undefined : _b; - var escapedText = ts.escapeIdentifier(text); + var escapedText = ts.escapeLeadingUnderscores(text); var parents = this.options.implementations && getParentSymbolsOfPropertyAccess(location, symbol, this.checker); return { location: location, symbol: symbol, comingFrom: comingFrom, text: text, escapedText: escapedText, parents: parents, @@ -65002,19 +65911,25 @@ var ts; return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(location.parent.parent) && checker.getPropertySymbolOfDestructuringAssignment(location); } - function isObjectBindingPatternElementWithoutPropertyName(symbol) { + function getObjectBindingElementWithoutPropertyName(symbol) { var bindingElement = ts.getDeclarationOfKind(symbol, 176); - return bindingElement && + if (bindingElement && bindingElement.parent.kind === 174 && - !bindingElement.propertyName; + !bindingElement.propertyName) { + return bindingElement; + } } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { - var bindingElement = ts.getDeclarationOfKind(symbol, 176); - var typeOfPattern = checker.getTypeAtLocation(bindingElement.parent); - return typeOfPattern && checker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + var bindingElement = getObjectBindingElementWithoutPropertyName(symbol); + if (!bindingElement) + return undefined; + var typeOfPattern = checker.getTypeAtLocation(bindingElement.parent); + var propSymbol = typeOfPattern && checker.getPropertyOfType(typeOfPattern, bindingElement.name.text); + if (propSymbol && propSymbol.flags & 98304) { + ts.Debug.assert(!!(propSymbol.flags & 33554432)); + return propSymbol.target; } - return undefined; + return propSymbol; } function getSymbolScope(symbol) { var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; @@ -65031,15 +65946,16 @@ var ts; } return undefined; } - if (isObjectBindingPatternElementWithoutPropertyName(symbol)) { + if (getObjectBindingElementWithoutPropertyName(symbol)) { return undefined; } - if (parent && !((parent.flags & 1536) && ts.isExternalModuleSymbol(parent) && !parent.globalExports)) { + var exposedByParent = parent && !(symbol.flags & 262144); + if (exposedByParent && !((parent.flags & 1536) && ts.isExternalModuleSymbol(parent) && !parent.globalExports)) { return undefined; } var scope; - for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { - var declaration = declarations_10[_i]; + for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { + var declaration = declarations_9[_i]; var container = ts.getContainerNode(declaration); if (scope && scope !== container) { return undefined; @@ -65049,7 +65965,7 @@ var ts; } scope = container; } - return parent ? scope.getSourceFile() : scope; + return exposedByParent ? scope.getSourceFile() : scope; } function getPossibleSymbolReferencePositions(sourceFile, symbolName, container) { if (container === void 0) { container = sourceFile; } @@ -65090,7 +66006,7 @@ var ts; function isValidReferencePosition(node, searchSymbolName) { switch (node && node.kind) { case 71: - return ts.unescapeIdentifier(node.text).length === searchSymbolName.length; + return node.text.length === searchSymbolName.length; case 9: return (ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) && node.text.length === searchSymbolName.length; @@ -65235,7 +66151,7 @@ var ts; function getReferenceForShorthandProperty(_a, search, state) { var flags = _a.flags, valueDeclaration = _a.valueDeclaration; var shorthandValueSymbol = state.checker.getShorthandAssignmentValueSymbol(valueDeclaration); - if (!(flags & 134217728) && search.includes(shorthandValueSymbol)) { + if (!(flags & 33554432) && search.includes(shorthandValueSymbol)) { addReference(ts.getNameOfDeclaration(valueDeclaration), shorthandValueSymbol, search.location, state); } } @@ -65330,15 +66246,16 @@ var ts; addReference(parent.initializer); } else if (ts.isFunctionLike(parent) && parent.type === containingTypeReference && parent.body) { - if (parent.body.kind === 207) { - ts.forEachReturnStatement(parent.body, function (returnStatement) { + var body = parent.body; + if (body.kind === 207) { + ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression && isImplementationExpression(returnStatement.expression)) { addReference(returnStatement.expression); } }); } - else if (isImplementationExpression(parent.body)) { - addReference(parent.body); + else if (isImplementationExpression(body)) { + addReference(body); } } else if (ts.isAssertionExpression(parent) && isImplementationExpression(parent.expression)) { @@ -65614,7 +66531,7 @@ var ts; result.push(rootSymbol); } if (!implementations && rootSymbol.parent && rootSymbol.parent.flags & (32 | 64)) { - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap(), checker); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, result, ts.createSymbolTable(), checker); } } return result; @@ -65623,7 +66540,7 @@ var ts; if (!symbol) { return; } - if (previousIterationSymbolsCache.has(symbol.name)) { + if (previousIterationSymbolsCache.has(symbol.escapedName)) { return; } if (symbol.flags & (32 | 64)) { @@ -65646,7 +66563,7 @@ var ts; if (propertySymbol) { result.push.apply(result, checker.getRootSymbols(propertySymbol)); } - previousIterationSymbolsCache.set(symbol.name, symbol); + previousIterationSymbolsCache.set(symbol.escapedName, symbol); getPropertySymbolsFromBaseTypes(type.symbol, propertyName, result, previousIterationSymbolsCache, checker); } } @@ -65682,7 +66599,7 @@ var ts; return undefined; } var result = []; - getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.getName(), result, ts.createMap(), state.checker); + getPropertySymbolsFromBaseTypes(rootSymbol.parent, rootSymbol.name, result, ts.createSymbolTable(), state.checker); return ts.find(result, search.includes); } return undefined; @@ -65696,7 +66613,7 @@ var ts; } return undefined; } - return node.name.text; + return ts.getTextOfIdentifierOrLiteral(node.name); } function getPropertySymbolsFromContextualType(node, checker) { var objectLiteral = node.parent; @@ -65725,8 +66642,8 @@ var ts; var lastIterationMeaning = void 0; do { lastIterationMeaning = meaning; - for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { - var declaration = declarations_11[_i]; + for (var _i = 0, declarations_10 = declarations; _i < declarations_10.length; _i++) { + var declaration = declarations_10[_i]; var declarationMeaning = ts.getMeaningFromDeclaration(declaration); if (declarationMeaning & meaning) { meaning |= declarationMeaning; @@ -65842,8 +66759,8 @@ var ts; } if (ts.isJumpStatementTarget(node)) { var labelName = node.text; - var label = ts.getTargetLabel(node.parent, node.text); - return label ? [createDefinitionInfoFromName(label, ts.ScriptElementKind.label, labelName, undefined)] : undefined; + var label = ts.getTargetLabel(node.parent, labelName); + return label ? [createDefinitionInfoFromName(label, "label", labelName, undefined)] : undefined; } var typeChecker = program.getTypeChecker(); var calledDeclaration = tryGetSignatureDeclaration(typeChecker, node); @@ -65854,7 +66771,7 @@ var ts; if (!symbol) { return undefined; } - if (symbol.flags & 8388608 && shouldSkipAlias(node, symbol.declarations[0])) { + if (symbol.flags & 2097152 && shouldSkipAlias(node, symbol.declarations[0])) { var aliased = typeChecker.getAliasedSymbol(symbol); if (aliased.declarations) { symbol = aliased; @@ -65871,6 +66788,16 @@ var ts; var shorthandContainerName_1 = typeChecker.symbolToString(symbol.parent, node); return ts.map(shorthandDeclarations, function (declaration) { return createDefinitionInfo(declaration, shorthandSymbolKind_1, shorthandSymbolName_1, shorthandContainerName_1); }); } + if (ts.isPropertyName(node) && ts.isBindingElement(node.parent) && ts.isObjectBindingPattern(node.parent.parent) && + (node === (node.parent.propertyName || node.parent.name))) { + var type = typeChecker.getTypeAtLocation(node.parent.parent); + if (type) { + var propSymbols = ts.getPropertySymbolsFromType(type, node); + if (propSymbols) { + return ts.flatMap(propSymbols, function (propSymbol) { return getDefinitionFromSymbol(typeChecker, propSymbol, node); }); + } + } + } var element = ts.getContainingObjectLiteralElement(node); if (element && typeChecker.getContextualType(element.parent)) { return ts.flatMap(ts.getPropertySymbolsFromContextualType(typeChecker, element), function (propertySymbol) { @@ -66026,7 +66953,7 @@ var ts; return { fileName: targetFileName, textSpan: ts.createTextSpanFromBounds(0, 0), - kind: ts.ScriptElementKind.scriptElement, + kind: "script", name: name, containerName: undefined, containerKind: undefined @@ -66103,19 +67030,14 @@ var ts; function getJsDocCommentsFromDeclarations(declarations) { var documentationComment = []; forEachUnique(declarations, function (declaration) { - var comments = ts.getCommentsFromJSDoc(declaration); - if (!comments) { - return; - } - for (var _i = 0, comments_3 = comments; _i < comments_3.length; _i++) { - var comment = comments_3[_i]; - if (comment) { + ts.forEach(ts.getAllJSDocs(declaration), function (doc) { + if (doc.comment) { if (documentationComment.length) { documentationComment.push(ts.lineBreakPart()); } - documentationComment.push(ts.textPart(comment)); + documentationComment.push(ts.textPart(doc.comment)); } - } + }); }); return documentationComment; } @@ -66123,20 +67045,10 @@ var ts; function getJsDocTagsFromDeclarations(declarations) { var tags = []; forEachUnique(declarations, function (declaration) { - var jsDocs = ts.getJSDocs(declaration); - if (!jsDocs) { - return; - } - for (var _i = 0, jsDocs_1 = jsDocs; _i < jsDocs_1.length; _i++) { - var doc = jsDocs_1[_i]; - var tagsForDoc = doc.tags; - if (tagsForDoc) { - tags.push.apply(tags, tagsForDoc.filter(function (tag) { return tag.kind === 284; }).map(function (jsDocTag) { - return { - name: jsDocTag.tagName.text, - text: jsDocTag.comment - }; - })); + for (var _i = 0, _a = ts.getJSDocTags(declaration); _i < _a.length; _i++) { + var tag = _a[_i]; + if (tag.kind === 276) { + tags.push({ name: tag.tagName.text, text: tag.comment }); } } }); @@ -66160,7 +67072,7 @@ var ts; return jsDocTagNameCompletionEntries || (jsDocTagNameCompletionEntries = ts.map(jsDocTagNames, function (tagName) { return { name: tagName, - kind: ts.ScriptElementKind.keyword, + kind: "keyword", kindModifiers: "", sortText: "0", }; @@ -66171,7 +67083,7 @@ var ts; return jsDocTagCompletionEntries || (jsDocTagCompletionEntries = ts.map(jsDocTagNames, function (tagName) { return { name: "@" + tagName, - kind: ts.ScriptElementKind.keyword, + kind: "keyword", kindModifiers: "", sortText: "0" }; @@ -66179,6 +67091,9 @@ var ts; } JsDoc.getJSDocTagCompletions = getJSDocTagCompletions; function getJSDocParameterNameCompletions(tag) { + if (!ts.isIdentifier(tag.name)) { + return ts.emptyArray; + } var nameThusFar = tag.name.text; var jsdoc = tag.parent; var fn = jsdoc.parent; @@ -66188,11 +67103,11 @@ var ts; if (!ts.isIdentifier(param.name)) return undefined; var name = param.name.text; - if (jsdoc.tags.some(function (t) { return t !== tag && ts.isJSDocParameterTag(t) && t.name.text === name; }) + if (jsdoc.tags.some(function (t) { return t !== tag && ts.isJSDocParameterTag(t) && ts.isIdentifier(t.name) && t.name.escapedText === name; }) || nameThusFar !== undefined && !ts.startsWith(name, nameThusFar)) { return undefined; } - return { name: name, kind: ts.ScriptElementKind.parameterElement, kindModifiers: "", sortText: "0" }; + return { name: name, kind: "parameter", kindModifiers: "", sortText: "0" }; }); } JsDoc.getJSDocParameterNameCompletions = getJSDocParameterNameCompletions; @@ -66235,7 +67150,7 @@ var ts; for (var i = 0; i < parameters.length; i++) { var currentName = parameters[i].name; var paramName = currentName.kind === 71 ? - currentName.text : + currentName.escapedText : "param" + i; if (isJavaScriptFile) { docParams += indentationStr + " * @param {any} " + paramName + newLine; @@ -66291,8 +67206,6 @@ var ts; (function (ts) { var JsTyping; (function (JsTyping) { - var safeList; - var EmptySafeList = ts.createMap(); JsTyping.nodeCoreModuleList = [ "buffer", "querystring", "events", "http", "cluster", "zlib", "os", "https", "punycode", "repl", "readline", @@ -66301,59 +67214,54 @@ var ts; "crypto", "stream", "util", "assert", "tty", "domain", "constants", "process", "v8", "timers", "console" ]; - var nodeCoreModules = ts.arrayToMap(JsTyping.nodeCoreModuleList, function (x) { return x; }); - function discoverTypings(host, fileNames, projectRootPath, safeListPath, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { - var inferredTypings = ts.createMap(); + var nodeCoreModules = ts.arrayToSet(JsTyping.nodeCoreModuleList); + function loadSafeList(host, safeListPath) { + var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); + return ts.createMapFromTemplate(result.config); + } + JsTyping.loadSafeList = loadSafeList; + function discoverTypings(host, log, fileNames, projectRootPath, safeList, packageNameToTypingLocation, typeAcquisition, unresolvedImports) { if (!typeAcquisition || !typeAcquisition.enable) { return { cachedTypingPaths: [], newTypingNames: [], filesToWatch: [] }; } - fileNames = ts.filter(ts.map(fileNames, ts.normalizePath), function (f) { - var kind = ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)); - return kind === 1 || kind === 2; + var inferredTypings = ts.createMap(); + fileNames = ts.mapDefined(fileNames, function (fileName) { + var path = ts.normalizePath(fileName); + if (ts.hasJavaScriptFileExtension(path)) { + return path; + } }); - if (!safeList) { - var result = ts.readConfigFile(safeListPath, function (path) { return host.readFile(path); }); - safeList = result.config ? ts.createMapFromTemplate(result.config) : EmptySafeList; - } var filesToWatch = []; - var searchDirs = []; - var exclude = []; - mergeTypings(typeAcquisition.include); - exclude = typeAcquisition.exclude || []; - var possibleSearchDirs = ts.map(fileNames, ts.getDirectoryPath); - if (projectRootPath) { - possibleSearchDirs.push(projectRootPath); - } - searchDirs = ts.deduplicate(possibleSearchDirs); - for (var _i = 0, searchDirs_1 = searchDirs; _i < searchDirs_1.length; _i++) { - var searchDir = searchDirs_1[_i]; + if (typeAcquisition.include) + addInferredTypings(typeAcquisition.include, "Explicitly included types"); + var exclude = typeAcquisition.exclude || []; + var possibleSearchDirs = ts.arrayToSet(fileNames, ts.getDirectoryPath); + possibleSearchDirs.set(projectRootPath, true); + possibleSearchDirs.forEach(function (_true, searchDir) { var packageJsonPath = ts.combinePaths(searchDir, "package.json"); getTypingNamesFromJson(packageJsonPath, filesToWatch); var bowerJsonPath = ts.combinePaths(searchDir, "bower.json"); getTypingNamesFromJson(bowerJsonPath, filesToWatch); var bowerComponentsPath = ts.combinePaths(searchDir, "bower_components"); - getTypingNamesFromPackagesFolder(bowerComponentsPath); + getTypingNamesFromPackagesFolder(bowerComponentsPath, filesToWatch); var nodeModulesPath = ts.combinePaths(searchDir, "node_modules"); - getTypingNamesFromPackagesFolder(nodeModulesPath); - } + getTypingNamesFromPackagesFolder(nodeModulesPath, filesToWatch); + }); getTypingNamesFromSourceFileNames(fileNames); if (unresolvedImports) { - for (var _a = 0, unresolvedImports_1 = unresolvedImports; _a < unresolvedImports_1.length; _a++) { - var moduleId = unresolvedImports_1[_a]; - var typingName = nodeCoreModules.has(moduleId) ? "node" : moduleId; - if (!inferredTypings.has(typingName)) { - inferredTypings.set(typingName, undefined); - } - } + var module = ts.deduplicate(unresolvedImports.map(function (moduleId) { return nodeCoreModules.has(moduleId) ? "node" : moduleId; })); + addInferredTypings(module, "Inferred typings from unresolved imports"); } packageNameToTypingLocation.forEach(function (typingLocation, name) { if (inferredTypings.has(name) && inferredTypings.get(name) === undefined) { inferredTypings.set(name, typingLocation); } }); - for (var _b = 0, exclude_1 = exclude; _b < exclude_1.length; _b++) { - var excludeTypingName = exclude_1[_b]; - inferredTypings.delete(excludeTypingName); + for (var _i = 0, exclude_1 = exclude; _i < exclude_1.length; _i++) { + var excludeTypingName = exclude_1[_i]; + var didDelete = inferredTypings.delete(excludeTypingName); + if (didDelete && log) + log("Typing for " + excludeTypingName + " is in exclude list, will be ignored."); } var newTypingNames = []; var cachedTypingPaths = []; @@ -66365,58 +67273,56 @@ var ts; newTypingNames.push(typing); } }); - return { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; - function mergeTypings(typingNames) { - if (!typingNames) { - return; - } - for (var _i = 0, typingNames_1 = typingNames; _i < typingNames_1.length; _i++) { - var typing = typingNames_1[_i]; - if (!inferredTypings.has(typing)) { - inferredTypings.set(typing, undefined); - } + var result = { cachedTypingPaths: cachedTypingPaths, newTypingNames: newTypingNames, filesToWatch: filesToWatch }; + if (log) + log("Result: " + JSON.stringify(result)); + return result; + function addInferredTyping(typingName) { + if (!inferredTypings.has(typingName)) { + inferredTypings.set(typingName, undefined); } } + function addInferredTypings(typingNames, message) { + if (log) + log(message + ": " + JSON.stringify(typingNames)); + ts.forEach(typingNames, addInferredTyping); + } function getTypingNamesFromJson(jsonPath, filesToWatch) { - if (host.fileExists(jsonPath)) { - filesToWatch.push(jsonPath); - } - var result = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }); - if (result.config) { - var jsonConfig = result.config; - if (jsonConfig.dependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.dependencies)); - } - if (jsonConfig.devDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.devDependencies)); - } - if (jsonConfig.optionalDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.optionalDependencies)); - } - if (jsonConfig.peerDependencies) { - mergeTypings(ts.getOwnKeys(jsonConfig.peerDependencies)); - } + if (!host.fileExists(jsonPath)) { + return; } + filesToWatch.push(jsonPath); + var jsonConfig = ts.readConfigFile(jsonPath, function (path) { return host.readFile(path); }).config; + var jsonTypingNames = ts.flatMap([jsonConfig.dependencies, jsonConfig.devDependencies, jsonConfig.optionalDependencies, jsonConfig.peerDependencies], ts.getOwnKeys); + addInferredTypings(jsonTypingNames, "Typing names in '" + jsonPath + "' dependencies"); } function getTypingNamesFromSourceFileNames(fileNames) { - var jsFileNames = ts.filter(fileNames, ts.hasJavaScriptFileExtension); - var inferredTypingNames = ts.map(jsFileNames, function (f) { return ts.removeFileExtension(ts.getBaseFileName(f.toLowerCase())); }); - var cleanedTypingNames = ts.map(inferredTypingNames, function (f) { return f.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); }); - if (safeList !== EmptySafeList) { - mergeTypings(ts.mapDefined(cleanedTypingNames, function (f) { return safeList.get(f); })); + var fromFileNames = ts.mapDefined(fileNames, function (j) { + if (!ts.hasJavaScriptFileExtension(j)) + return undefined; + var inferredTypingName = ts.removeFileExtension(ts.getBaseFileName(j.toLowerCase())); + var cleanedTypingName = inferredTypingName.replace(/((?:\.|-)min(?=\.|$))|((?:-|\.)\d+)/g, ""); + return safeList.get(cleanedTypingName); + }); + if (fromFileNames.length) { + addInferredTypings(fromFileNames, "Inferred typings from file names"); } - var hasJsxFile = ts.forEach(fileNames, function (f) { return ts.ensureScriptKind(f, ts.getScriptKindFromFileName(f)) === 2; }); + var hasJsxFile = ts.some(fileNames, function (f) { return ts.fileExtensionIs(f, ".jsx"); }); if (hasJsxFile) { - mergeTypings(["react"]); + if (log) + log("Inferred 'react' typings due to presence of '.jsx' extension"); + addInferredTyping("react"); } } - function getTypingNamesFromPackagesFolder(packagesFolderPath) { + function getTypingNamesFromPackagesFolder(packagesFolderPath, filesToWatch) { filesToWatch.push(packagesFolderPath); if (!host.directoryExists(packagesFolderPath)) { return; } - var typingNames = []; var fileNames = host.readDirectory(packagesFolderPath, [".json"], undefined, undefined, 2); + if (log) + log("Searching for typing names in " + packagesFolderPath + "; all files: " + JSON.stringify(fileNames)); + var packageNames = []; for (var _i = 0, fileNames_2 = fileNames; _i < fileNames_2.length; _i++) { var fileName = fileNames_2[_i]; var normalizedFileName = ts.normalizePath(fileName); @@ -66424,11 +67330,8 @@ var ts; if (baseFileName !== "package.json" && baseFileName !== "bower.json") { continue; } - var result = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); - if (!result.config) { - continue; - } - var packageJson = result.config; + var result_8 = ts.readConfigFile(normalizedFileName, function (path) { return host.readFile(path); }); + var packageJson = result_8.config; if (baseFileName === "package.json" && packageJson._requiredBy && ts.filter(packageJson._requiredBy, function (r) { return r[0] === "#" || r === "/"; }).length === 0) { continue; @@ -66436,15 +67339,18 @@ var ts; if (!packageJson.name) { continue; } - if (packageJson.typings) { - var absolutePath = ts.getNormalizedAbsolutePath(packageJson.typings, ts.getDirectoryPath(normalizedFileName)); + var ownTypes = packageJson.types || packageJson.typings; + if (ownTypes) { + var absolutePath = ts.getNormalizedAbsolutePath(ownTypes, ts.getDirectoryPath(normalizedFileName)); + if (log) + log(" Package '" + packageJson.name + "' provides its own types."); inferredTypings.set(packageJson.name, absolutePath); } else { - typingNames.push(packageJson.name); + packageNames.push(packageJson.name); } } - mergeTypings(typingNames); + addInferredTypings(packageNames, " Found package names"); } } JsTyping.discoverTypings = discoverTypings; @@ -66457,7 +67363,7 @@ var ts; function getNavigateToItems(sourceFiles, checker, cancellationToken, searchValue, maxResultCount, excludeDtsFiles) { var patternMatcher = ts.createPatternMatcher(searchValue); var rawItems = []; - var _loop_5 = function (sourceFile) { + var _loop_6 = function (sourceFile) { cancellationToken.throwIfCancellationRequested(); if (excludeDtsFiles && ts.fileExtensionIs(sourceFile.fileName, ".d.ts")) { return "continue"; @@ -66468,8 +67374,8 @@ var ts; if (!matches) { return; } - for (var _i = 0, declarations_12 = declarations; _i < declarations_12.length; _i++) { - var declaration = declarations_12[_i]; + for (var _i = 0, declarations_11 = declarations; _i < declarations_11.length; _i++) { + var declaration = declarations_11[_i]; if (patternMatcher.patternContainsDots) { var containers = getContainers(declaration); if (!containers) { @@ -66489,14 +67395,14 @@ var ts; }; for (var _i = 0, sourceFiles_8 = sourceFiles; _i < sourceFiles_8.length; _i++) { var sourceFile = sourceFiles_8[_i]; - _loop_5(sourceFile); + _loop_6(sourceFile); } rawItems = ts.filter(rawItems, function (item) { var decl = item.declaration; if (decl.kind === 239 || decl.kind === 242 || decl.kind === 237) { var importer = checker.getSymbolAtLocation(decl.name); var imported = checker.getAliasedSymbol(importer); - return importer.name !== imported.name; + return importer.escapedName !== imported.escapedName; } else { return true; @@ -66518,21 +67424,11 @@ var ts; } return true; } - function getTextOfIdentifierOrLiteral(node) { - if (node) { - if (node.kind === 71 || - node.kind === 9 || - node.kind === 8) { - return node.text; - } - } - return undefined; - } function tryAddSingleDeclarationName(declaration, containers) { if (declaration) { var name = ts.getNameOfDeclaration(declaration); if (name) { - var text = getTextOfIdentifierOrLiteral(name); + var text = ts.getTextOfIdentifierOrLiteral(name); if (text !== undefined) { containers.unshift(text); } @@ -66547,7 +67443,7 @@ var ts; return true; } function tryAddComputedPropertyName(expression, containers, includeLastPortion) { - var text = getTextOfIdentifierOrLiteral(expression); + var text = ts.getTextOfIdentifierOrLiteral(expression); if (text !== undefined) { if (includeLastPortion) { containers.unshift(text); @@ -66813,7 +67709,7 @@ var ts; default: ts.forEach(node.jsDoc, function (jsDoc) { ts.forEach(jsDoc.tags, function (tag) { - if (tag.kind === 291) { + if (tag.kind === 283) { addLeafNode(tag); } }); @@ -66905,14 +67801,14 @@ var ts; } var declName = ts.getNameOfDeclaration(node); if (declName) { - return ts.getPropertyNameForPropertyNameNode(declName); + return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); } switch (node.kind) { case 186: case 187: case 199: return getFunctionOrClassName(node); - case 291: + case 283: return getJSDocTypedefTagName(node); default: return undefined; @@ -66952,7 +67848,7 @@ var ts; return "()"; case 157: return "[]"; - case 291: + case 283: return getJSDocTypedefTagName(node); default: return "<unknown>"; @@ -66999,7 +67895,7 @@ var ts; case 233: case 265: case 231: - case 291: + case 283: return true; case 152: case 151: @@ -67084,10 +67980,10 @@ var ts; return ts.getTextOfNode(moduleDeclaration.name); } var result = []; - result.push(moduleDeclaration.name.text); + result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); while (moduleDeclaration.body && moduleDeclaration.body.kind === 233) { moduleDeclaration = moduleDeclaration.body; - result.push(moduleDeclaration.name.text); + result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } return result.join("."); } @@ -67147,7 +68043,7 @@ var ts; textSpan: ts.createTextSpanFromBounds(startElement.pos, endElement.end), hintSpan: ts.createTextSpanFromNode(hintSpanNode, sourceFile), bannerText: collapseText, - autoCollapse: autoCollapse + autoCollapse: autoCollapse, }; elements.push(span_13); } @@ -67158,7 +68054,7 @@ var ts; textSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), hintSpan: ts.createTextSpanFromBounds(commentSpan.pos, commentSpan.end), bannerText: collapseText, - autoCollapse: autoCollapse + autoCollapse: autoCollapse, }; elements.push(span_14); } @@ -67170,8 +68066,8 @@ var ts; var lastSingleLineCommentEnd = -1; var isFirstSingleLineComment = true; var singleLineCommentCount = 0; - for (var _i = 0, comments_4 = comments; _i < comments_4.length; _i++) { - var currentComment = comments_4[_i]; + for (var _i = 0, comments_3 = comments; _i < comments_3.length; _i++) { + var currentComment = comments_3[_i]; cancellationToken.throwIfCancellationRequested(); if (currentComment.kind === 2) { if (isFirstSingleLineComment) { @@ -67737,13 +68633,9 @@ var ts; }); } function getFileReference() { - var file = ts.scanner.getTokenValue(); + var fileName = ts.scanner.getTokenValue(); var pos = ts.scanner.getTokenPos(); - return { - fileName: file, - pos: pos, - end: pos + file.length - }; + return { fileName: fileName, pos: pos, end: pos + fileName.length }; } function recordAmbientExternalModule() { if (!ambientExternalModules) { @@ -68034,7 +68926,7 @@ var ts; return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library); } var displayName = ts.stripQuotes(node.text); - return getRenameInfoSuccess(displayName, displayName, ts.ScriptElementKind.variableElement, ts.ScriptElementKindModifier.none, node, sourceFile); + return getRenameInfoSuccess(displayName, displayName, "var", "", node, sourceFile); } } function getRenameInfoSuccess(displayName, fullDisplayName, kind, kindModifiers, node, sourceFile) { @@ -68080,7 +68972,6 @@ var ts; (function (ts) { var SignatureHelp; (function (SignatureHelp) { - var emptyArray = []; var ArgumentListKind; (function (ArgumentListKind) { ArgumentListKind[ArgumentListKind["TypeArguments"] = 0] = "TypeArguments"; @@ -68095,13 +68986,12 @@ var ts; return undefined; } var argumentInfo = getContainingArgumentInfo(startingToken, position, sourceFile); - cancellationToken.throwIfCancellationRequested(); - if (!argumentInfo) { + if (!argumentInfo) return undefined; - } + cancellationToken.throwIfCancellationRequested(); var call = argumentInfo.invocation; var candidates = []; - var resolvedSignature = typeChecker.getResolvedSignature(call, candidates); + var resolvedSignature = typeChecker.getResolvedSignature(call, candidates, argumentInfo.argumentCount); cancellationToken.throwIfCancellationRequested(); if (!candidates.length) { if (ts.isSourceFileJavaScript(sourceFile)) { @@ -68123,7 +69013,7 @@ var ts; : expression.kind === 179 ? expression.name : undefined; - if (!name || !name.text) { + if (!name || !name.escapedText) { return undefined; } var typeChecker = program.getTypeChecker(); @@ -68132,8 +69022,8 @@ var ts; var nameToDeclarations = sourceFile.getNamedDeclarations(); var declarations = nameToDeclarations.get(name.text); if (declarations) { - for (var _b = 0, declarations_13 = declarations; _b < declarations_13.length; _b++) { - var declaration = declarations_13[_b]; + for (var _b = 0, declarations_12 = declarations; _b < declarations_12.length; _b++) { + var declaration = declarations_12[_b]; var symbol = declaration.symbol; if (symbol) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, declaration); @@ -68150,36 +69040,27 @@ var ts; } function getImmediatelyContainingArgumentInfo(node, position, sourceFile) { if (ts.isCallOrNewExpression(node.parent)) { - var callExpression = node.parent; - if (node.kind === 27 || - node.kind === 19) { - var list = getChildListThatStartsWithOpenerToken(callExpression, node, sourceFile); - var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; + var invocation = node.parent; + var list = void 0; + var argumentIndex = void 0; + if (node.kind === 27 || node.kind === 19) { + list = getChildListThatStartsWithOpenerToken(invocation, node, sourceFile); ts.Debug.assert(list !== undefined); - return { - kind: isTypeArgList ? 0 : 1, - invocation: callExpression, - argumentsSpan: getApplicableSpanForArguments(list, sourceFile), - argumentIndex: 0, - argumentCount: getArgumentCount(list) - }; + argumentIndex = 0; } - var listItemInfo = ts.findListItemInfo(node); - if (listItemInfo) { - var list = listItemInfo.list; - var isTypeArgList = callExpression.typeArguments && callExpression.typeArguments.pos === list.pos; - var argumentIndex = getArgumentIndex(list, node); - var argumentCount = getArgumentCount(list); - ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); - return { - kind: isTypeArgList ? 0 : 1, - invocation: callExpression, - argumentsSpan: getApplicableSpanForArguments(list, sourceFile), - argumentIndex: argumentIndex, - argumentCount: argumentCount - }; + else { + list = ts.findContainingList(node); + if (!list) + return undefined; + argumentIndex = getArgumentIndex(list, node); } - return undefined; + var kind = invocation.typeArguments && invocation.typeArguments.pos === list.pos ? 0 : 1; + var argumentCount = getArgumentCount(list); + if (argumentIndex !== 0) { + ts.Debug.assertLessThan(argumentIndex, argumentCount); + } + var argumentsSpan = getApplicableSpanForArguments(list, sourceFile); + return { kind: kind, invocation: invocation, argumentsSpan: argumentsSpan, argumentIndex: argumentIndex, argumentCount: argumentCount }; } else if (node.kind === 13 && node.parent.kind === 183) { if (ts.isInsideTemplateLiteral(node, position)) { @@ -68255,7 +69136,9 @@ var ts; var argumentCount = tagExpression.template.kind === 13 ? 1 : tagExpression.template.templateSpans.length + 1; - ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); + if (argumentIndex !== 0) { + ts.Debug.assertLessThan(argumentIndex, argumentCount); + } return { kind: 2, invocation: tagExpression, @@ -68303,25 +69186,9 @@ var ts; ts.Debug.assert(indexOfOpenerToken >= 0 && children.length > indexOfOpenerToken + 1); return children[indexOfOpenerToken + 1]; } - function selectBestInvalidOverloadIndex(candidates, argumentCount) { - var maxParamsSignatureIndex = -1; - var maxParams = -1; - for (var i = 0; i < candidates.length; i++) { - var candidate = candidates[i]; - if (candidate.hasRestParameter || candidate.parameters.length >= argumentCount) { - return i; - } - if (candidate.parameters.length > maxParams) { - maxParams = candidate.parameters.length; - maxParamsSignatureIndex = i; - } - } - return maxParamsSignatureIndex; - } - function createSignatureHelpItems(candidates, bestSignature, argumentListInfo, typeChecker) { - var applicableSpan = argumentListInfo.argumentsSpan; + function createSignatureHelpItems(candidates, resolvedSignature, argumentListInfo, typeChecker) { + var argumentCount = argumentListInfo.argumentCount, applicableSpan = argumentListInfo.argumentsSpan, invocation = argumentListInfo.invocation, argumentIndex = argumentListInfo.argumentIndex; var isTypeParameterList = argumentListInfo.kind === 0; - var invocation = argumentListInfo.invocation; var callTarget = ts.getInvokedExpression(invocation); var callTargetSymbol = typeChecker.getSymbolAtLocation(callTarget); var callTargetDisplayParts = callTargetSymbol && ts.symbolToDisplayParts(typeChecker, callTargetSymbol, undefined, undefined); @@ -68336,8 +69203,8 @@ var ts; if (isTypeParameterList) { isVariadic = false; prefixDisplayParts.push(ts.punctuationPart(27)); - var typeParameters = candidateSignature.typeParameters; - signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : emptyArray; + var typeParameters = (candidateSignature.target || candidateSignature).typeParameters; + signatureHelpParameters = typeParameters && typeParameters.length > 0 ? ts.map(typeParameters, createSignatureHelpParameterForTypeParameter) : ts.emptyArray; suffixDisplayParts.push(ts.punctuationPart(29)); var parameterParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildDisplayForParametersAndDelimiters(candidateSignature.thisParameter, candidateSignature.parameters, writer, invocation); @@ -68351,8 +69218,7 @@ var ts; }); ts.addRange(prefixDisplayParts, typeParameterParts); prefixDisplayParts.push(ts.punctuationPart(19)); - var parameters = candidateSignature.parameters; - signatureHelpParameters = parameters.length > 0 ? ts.map(parameters, createSignatureHelpParameterForParameter) : emptyArray; + signatureHelpParameters = ts.map(candidateSignature.parameters, createSignatureHelpParameterForParameter); suffixDisplayParts.push(ts.punctuationPart(20)); } var returnTypeParts = ts.mapToDisplayParts(function (writer) { @@ -68369,20 +69235,12 @@ var ts; tags: candidateSignature.getJsDocTags() }; }); - var argumentIndex = argumentListInfo.argumentIndex; - var argumentCount = argumentListInfo.argumentCount; - var selectedItemIndex = candidates.indexOf(bestSignature); - if (selectedItemIndex < 0) { - selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount); + if (argumentIndex !== 0) { + ts.Debug.assertLessThan(argumentIndex, argumentCount); } - ts.Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, "argumentCount < argumentIndex, " + argumentCount + " < " + argumentIndex); - return { - items: items, - applicableSpan: applicableSpan, - selectedItemIndex: selectedItemIndex, - argumentIndex: argumentIndex, - argumentCount: argumentCount - }; + var selectedItemIndex = candidates.indexOf(resolvedSignature); + ts.Debug.assert(selectedItemIndex !== -1); + return { items: items, applicableSpan: applicableSpan, selectedItemIndex: selectedItemIndex, argumentIndex: argumentIndex, argumentCount: argumentCount }; function createSignatureHelpParameterForParameter(parameter) { var displayParts = ts.mapToDisplayParts(function (writer) { return typeChecker.getSymbolDisplayBuilder().buildParameterDisplay(parameter, writer, invocation); @@ -68400,7 +69258,7 @@ var ts; }); return { name: typeParameter.symbol.name, - documentation: emptyArray, + documentation: ts.emptyArray, displayParts: displayParts, isOptional: false }; @@ -68413,95 +69271,95 @@ var ts; var SymbolDisplay; (function (SymbolDisplay) { function getSymbolKind(typeChecker, symbol, location) { - var flags = symbol.flags; + var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32) { return ts.getDeclarationOfKind(symbol, 199) ? - ts.ScriptElementKind.localClassElement : ts.ScriptElementKind.classElement; + "local class" : "class"; } if (flags & 384) - return ts.ScriptElementKind.enumElement; + return "enum"; if (flags & 524288) - return ts.ScriptElementKind.typeElement; + return "type"; if (flags & 64) - return ts.ScriptElementKind.interfaceElement; + return "interface"; if (flags & 262144) - return ts.ScriptElementKind.typeParameterElement; + return "type parameter"; var result = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); - if (result === ts.ScriptElementKind.unknown) { + if (result === "") { if (flags & 262144) - return ts.ScriptElementKind.typeParameterElement; + return "type parameter"; if (flags & 8) - return ts.ScriptElementKind.enumMemberElement; - if (flags & 8388608) - return ts.ScriptElementKind.alias; + return "enum member"; + if (flags & 2097152) + return "alias"; if (flags & 1536) - return ts.ScriptElementKind.moduleElement; + return "module"; } return result; } SymbolDisplay.getSymbolKind = getSymbolKind; function getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) { if (typeChecker.isUndefinedSymbol(symbol)) { - return ts.ScriptElementKind.variableElement; + return "var"; } if (typeChecker.isArgumentsSymbol(symbol)) { - return ts.ScriptElementKind.localVariableElement; + return "local var"; } if (location.kind === 99 && ts.isExpression(location)) { - return ts.ScriptElementKind.parameterElement; + return "parameter"; } - var flags = symbol.flags; + var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 3) { if (ts.isFirstDeclarationOfSymbolParameter(symbol)) { - return ts.ScriptElementKind.parameterElement; + return "parameter"; } else if (symbol.valueDeclaration && ts.isConst(symbol.valueDeclaration)) { - return ts.ScriptElementKind.constElement; + return "const"; } else if (ts.forEach(symbol.declarations, ts.isLet)) { - return ts.ScriptElementKind.letElement; + return "let"; } - return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localVariableElement : ts.ScriptElementKind.variableElement; + return isLocalVariableOrFunction(symbol) ? "local var" : "var"; } if (flags & 16) - return isLocalVariableOrFunction(symbol) ? ts.ScriptElementKind.localFunctionElement : ts.ScriptElementKind.functionElement; + return isLocalVariableOrFunction(symbol) ? "local function" : "function"; if (flags & 32768) - return ts.ScriptElementKind.memberGetAccessorElement; + return "getter"; if (flags & 65536) - return ts.ScriptElementKind.memberSetAccessorElement; + return "setter"; if (flags & 8192) - return ts.ScriptElementKind.memberFunctionElement; + return "method"; if (flags & 16384) - return ts.ScriptElementKind.constructorImplementationElement; + return "constructor"; if (flags & 4) { - if (flags & 134217728 && symbol.checkFlags & 6) { + if (flags & 33554432 && symbol.checkFlags & 6) { var unionPropertyKind = ts.forEach(typeChecker.getRootSymbols(symbol), function (rootSymbol) { var rootSymbolFlags = rootSymbol.getFlags(); if (rootSymbolFlags & (98308 | 3)) { - return ts.ScriptElementKind.memberVariableElement; + return "property"; } ts.Debug.assert(!!(rootSymbolFlags & 8192)); }); if (!unionPropertyKind) { var typeOfUnionProperty = typeChecker.getTypeOfSymbolAtLocation(symbol, location); if (typeOfUnionProperty.getCallSignatures().length) { - return ts.ScriptElementKind.memberFunctionElement; + return "method"; } - return ts.ScriptElementKind.memberVariableElement; + return "property"; } return unionPropertyKind; } if (location.parent && ts.isJsxAttribute(location.parent)) { - return ts.ScriptElementKind.jsxAttribute; + return "JSX attribute"; } - return ts.ScriptElementKind.memberVariableElement; + return "property"; } - return ts.ScriptElementKind.unknown; + return ""; } function getSymbolModifiers(symbol) { return symbol && symbol.declarations && symbol.declarations.length > 0 ? ts.getNodeModifiers(symbol.declarations[0]) - : ts.ScriptElementKindModifier.none; + : ""; } SymbolDisplay.getSymbolModifiers = getSymbolModifiers; function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning) { @@ -68509,17 +69367,17 @@ var ts; var displayParts = []; var documentation; var tags; - var symbolFlags = symbol.flags; + var symbolFlags = ts.getCombinedLocalAndExportSymbolFlags(symbol); var symbolKind = getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location); var hasAddedSymbolInfo; var isThisExpression = location.kind === 99 && ts.isExpression(location); var type; - if (symbolKind !== ts.ScriptElementKind.unknown || symbolFlags & 32 || symbolFlags & 8388608) { - if (symbolKind === ts.ScriptElementKind.memberGetAccessorElement || symbolKind === ts.ScriptElementKind.memberSetAccessorElement) { - symbolKind = ts.ScriptElementKind.memberVariableElement; + if (symbolKind !== "" || symbolFlags & 32 || symbolFlags & 2097152) { + if (symbolKind === "getter" || symbolKind === "setter") { + symbolKind = "property"; } var signature = void 0; - type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); + type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol.exportSymbol || symbol, location); if (type) { if (location.parent && location.parent.kind === 179) { var right = location.parent.name; @@ -68550,11 +69408,11 @@ var ts; } if (signature) { if (useConstructSignatures && (symbolFlags & 32)) { - symbolKind = ts.ScriptElementKind.constructorImplementationElement; + symbolKind = "constructor"; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } - else if (symbolFlags & 8388608) { - symbolKind = ts.ScriptElementKind.alias; + else if (symbolFlags & 2097152) { + symbolKind = "alias"; pushTypePart(symbolKind); displayParts.push(ts.spacePart()); if (useConstructSignatures) { @@ -68567,13 +69425,13 @@ var ts; addPrefixForAnyFunctionOrVar(symbol, symbolKind); } switch (symbolKind) { - case ts.ScriptElementKind.jsxAttribute: - case ts.ScriptElementKind.memberVariableElement: - case ts.ScriptElementKind.variableElement: - case ts.ScriptElementKind.constElement: - case ts.ScriptElementKind.letElement: - case ts.ScriptElementKind.parameterElement: - case ts.ScriptElementKind.localVariableElement: + case "JSX attribute": + case "property": + case "var": + case "const": + case "let": + case "parameter": + case "local var": displayParts.push(ts.punctuationPart(56)); displayParts.push(ts.spacePart()); if (useConstructSignatures) { @@ -68591,10 +69449,10 @@ var ts; hasAddedSymbolInfo = true; } } - else if ((ts.isNameOfFunctionDeclaration(location) && !(symbol.flags & 98304)) || + else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304)) || (location.kind === 123 && location.parent.kind === 152)) { var functionDeclaration_1 = location.parent; - var locationIsSymbolDeclaration = ts.findDeclaration(symbol, function (declaration) { + var locationIsSymbolDeclaration = ts.find(symbol.declarations, function (declaration) { return declaration === (location.kind === 123 ? functionDeclaration_1.parent : functionDeclaration_1); }); if (locationIsSymbolDeclaration) { @@ -68606,7 +69464,7 @@ var ts; signature = allSignatures[0]; } if (functionDeclaration_1.kind === 152) { - symbolKind = ts.ScriptElementKind.constructorImplementationElement; + symbolKind = "constructor"; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { @@ -68621,7 +69479,7 @@ var ts; } if (symbolFlags & 32 && !hasAddedSymbolInfo && !isThisExpression) { if (ts.getDeclarationOfKind(symbol, 199)) { - pushTypePart(ts.ScriptElementKind.localClassElement); + pushTypePart("local class"); } else { displayParts.push(ts.keywordPart(75)); @@ -68706,7 +69564,7 @@ var ts; } } if (symbolFlags & 8) { - symbolKind = ts.ScriptElementKind.enumMemberElement; + symbolKind = "enum member"; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = symbol.declarations[0]; if (declaration.kind === 264) { @@ -68719,7 +69577,7 @@ var ts; } } } - if (symbolFlags & 8388608) { + if (symbolFlags & 2097152) { addNewLineIfDisplayPartsExist(); if (symbol.declarations[0].kind === 236) { displayParts.push(ts.keywordPart(84)); @@ -68757,7 +69615,7 @@ var ts; }); } if (!hasAddedSymbolInfo) { - if (symbolKind !== ts.ScriptElementKind.unknown) { + if (symbolKind !== "") { if (type) { if (isThisExpression) { addNewLineIfDisplayPartsExist(); @@ -68766,10 +69624,10 @@ var ts; else { addPrefixForAnyFunctionOrVar(symbol, symbolKind); } - if (symbolKind === ts.ScriptElementKind.memberVariableElement || - symbolKind === ts.ScriptElementKind.jsxAttribute || + if (symbolKind === "property" || + symbolKind === "JSX attribute" || symbolFlags & 3 || - symbolKind === ts.ScriptElementKind.localVariableElement || + symbolKind === "local var" || isThisExpression) { displayParts.push(ts.punctuationPart(56)); displayParts.push(ts.spacePart()); @@ -68788,7 +69646,7 @@ var ts; symbolFlags & 16384 || symbolFlags & 131072 || symbolFlags & 98304 || - symbolKind === ts.ScriptElementKind.memberFunctionElement) { + symbolKind === "method") { var allSignatures = type.getNonNullableType().getCallSignatures(); addSignatureDisplayParts(allSignatures[0], allSignatures); } @@ -68801,7 +69659,7 @@ var ts; if (!documentation) { documentation = symbol.getDocumentationComment(); tags = symbol.getJsDocTags(); - if (documentation.length === 0 && symbol.flags & 4) { + if (documentation.length === 0 && symbolFlags & 4) { if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 265; })) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; @@ -68846,11 +69704,11 @@ var ts; } function pushTypePart(symbolKind) { switch (symbolKind) { - case ts.ScriptElementKind.variableElement: - case ts.ScriptElementKind.functionElement: - case ts.ScriptElementKind.letElement: - case ts.ScriptElementKind.constElement: - case ts.ScriptElementKind.constructorImplementationElement: + case "var": + case "function": + case "let": + case "const": + case "constructor": displayParts.push(ts.textOrKeywordPart(symbolKind)); return; default: @@ -68938,11 +69796,11 @@ var ts; getSourceFile: function (fileName) { return fileName === ts.normalizePath(inputFileName) ? sourceFile : undefined; }, writeFile: function (name, text) { if (ts.fileExtensionIs(name, ".map")) { - ts.Debug.assert(sourceMapText === undefined, "Unexpected multiple source map outputs for the file '" + name + "'"); + ts.Debug.assertEqual(sourceMapText, undefined, "Unexpected multiple source map outputs, file:", name); sourceMapText = text; } else { - ts.Debug.assert(outputText === undefined, "Unexpected multiple outputs for the file: '" + name + "'"); + ts.Debug.assertEqual(outputText, undefined, "Unexpected multiple outputs, file:", name); outputText = text; } }, @@ -68977,8 +69835,8 @@ var ts; commandLineOptionsStringToEnum = commandLineOptionsStringToEnum || ts.filter(ts.optionDeclarations, function (o) { return typeof o.type === "object" && !ts.forEachEntry(o.type, function (v) { return typeof v !== "number"; }); }); - options = ts.clone(options); - var _loop_6 = function (opt) { + options = ts.cloneCompilerOptions(options); + var _loop_7 = function (opt) { if (!ts.hasProperty(options, opt.name)) { return "continue"; } @@ -68994,7 +69852,7 @@ var ts; }; for (var _i = 0, commandLineOptionsStringToEnum_1 = commandLineOptionsStringToEnum; _i < commandLineOptionsStringToEnum_1.length; _i++) { var opt = commandLineOptionsStringToEnum_1[_i]; - _loop_6(opt); + _loop_7(opt); } return options; } @@ -69198,11 +70056,7 @@ var ts; break; } } - lastTokenInfo = { - leadingTrivia: leadingTrivia, - trailingTrivia: trailingTrivia, - token: token - }; + lastTokenInfo = { leadingTrivia: leadingTrivia, trailingTrivia: trailingTrivia, token: token }; return fixTokenKind(lastTokenInfo, n); } function isOnToken() { @@ -69319,7 +70173,8 @@ var ts; FormattingRequestKind[FormattingRequestKind["FormatSelection"] = 1] = "FormatSelection"; FormattingRequestKind[FormattingRequestKind["FormatOnEnter"] = 2] = "FormatOnEnter"; FormattingRequestKind[FormattingRequestKind["FormatOnSemicolon"] = 3] = "FormatOnSemicolon"; - FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 4] = "FormatOnClosingCurlyBrace"; + FormattingRequestKind[FormattingRequestKind["FormatOnOpeningCurlyBrace"] = 4] = "FormatOnOpeningCurlyBrace"; + FormattingRequestKind[FormattingRequestKind["FormatOnClosingCurlyBrace"] = 5] = "FormatOnClosingCurlyBrace"; })(FormattingRequestKind = formatting.FormattingRequestKind || (formatting.FormattingRequestKind = {})); })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); @@ -69479,11 +70334,11 @@ var ts; this.NoSpaceBeforeOpenBracket = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.AnyExcept(120), 21), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterCloseBracket = new formatting.Rule(formatting.RuleDescriptor.create3(22, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsNotBeforeBlockInFunctionDeclarationContext), 8)); this.FunctionOpenBraceLeftTokenRange = formatting.Shared.TokenRange.AnyIncludingMultilineComments; - this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.SpaceBeforeOpenBraceInFunction = new formatting.Rule(formatting.RuleDescriptor.create2(this.FunctionOpenBraceLeftTokenRange, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), Rules.IsFunctionDeclContext, Rules.IsBeforeBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), 2), 1); this.TypeScriptOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([71, 3, 75, 84, 91]); - this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new formatting.Rule(formatting.RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), 2), 1); this.ControlOpenBraceLeftTokenRange = formatting.Shared.TokenRange.FromTokens([20, 3, 81, 102, 87, 82]); - this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), 2), 1); + this.SpaceBeforeOpenBraceInControl = new formatting.Rule(formatting.RuleDescriptor.create2(this.ControlOpenBraceLeftTokenRange, 17), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForControlBlocks"), Rules.IsControlDeclContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeBlockContext), 2), 1); this.SpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), Rules.IsBraceWrappedContext), 2)); this.SpaceBeforeCloseBrace = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 18), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsOptionEnabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), Rules.IsBraceWrappedContext), 2)); this.NoSpaceAfterOpenBrace = new formatting.Rule(formatting.RuleDescriptor.create3(17, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsOptionDisabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces"), Rules.IsNonJsxSameLineTokenContext), 8)); @@ -69564,6 +70419,7 @@ var ts; this.NoSpaceAfterSemicolonInFor = new formatting.Rule(formatting.RuleDescriptor.create3(25, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterSemicolonInForStatements"), Rules.IsNonJsxSameLineTokenContext, Rules.IsForContext), 8)); this.SpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), Rules.IsNonJsxSameLineTokenContext), 2)); this.SpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), Rules.IsNonJsxSameLineTokenContext), 2)); + this.SpaceBetweenOpenParens = new formatting.Rule(formatting.RuleDescriptor.create1(19, 19), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsOptionEnabled("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), Rules.IsNonJsxSameLineTokenContext), 2)); this.NoSpaceBetweenParens = new formatting.Rule(formatting.RuleDescriptor.create1(19, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceAfterOpenParen = new formatting.Rule(formatting.RuleDescriptor.create3(19, formatting.Shared.TokenRange.Any), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), Rules.IsNonJsxSameLineTokenContext), 8)); this.NoSpaceBeforeCloseParen = new formatting.Rule(formatting.RuleDescriptor.create2(formatting.Shared.TokenRange.Any, 20), formatting.RuleOperation.create2(new formatting.RuleOperationContext(Rules.IsOptionDisabledOrUndefined("insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis"), Rules.IsNonJsxSameLineTokenContext), 8)); @@ -69635,7 +70491,7 @@ var ts; this.SpaceAfterComma, this.NoSpaceAfterComma, this.SpaceAfterAnonymousFunctionKeyword, this.NoSpaceAfterAnonymousFunctionKeyword, this.SpaceAfterKeywordInControl, this.NoSpaceAfterKeywordInControl, - this.SpaceAfterOpenParen, this.SpaceBeforeCloseParen, this.NoSpaceBetweenParens, this.NoSpaceAfterOpenParen, this.NoSpaceBeforeCloseParen, + this.SpaceAfterOpenParen, this.SpaceBeforeCloseParen, this.SpaceBetweenOpenParens, this.NoSpaceBetweenParens, this.NoSpaceAfterOpenParen, this.NoSpaceBeforeCloseParen, this.SpaceAfterOpenBracket, this.SpaceBeforeCloseBracket, this.NoSpaceBetweenBrackets, this.NoSpaceAfterOpenBracket, this.NoSpaceBeforeCloseBracket, this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NoSpaceBetweenEmptyBraceBrackets, this.NoSpaceAfterOpenBrace, this.NoSpaceBeforeCloseBrace, this.SpaceAfterTemplateHeadAndMiddle, this.SpaceBeforeTemplateMiddleAndTail, this.NoSpaceAfterTemplateHeadAndMiddle, this.NoSpaceBeforeTemplateMiddleAndTail, @@ -69675,6 +70531,9 @@ var ts; Rules.IsOptionDisabledOrUndefined = function (optionName) { return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; }; }; + Rules.isOptionDisabledOrUndefinedOrTokensOnSameLine = function (optionName) { + return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; + }; Rules.IsOptionEnabledOrUndefined = function (optionName) { return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; }; @@ -69718,8 +70577,8 @@ var ts; Rules.IsConditionalOperatorContext = function (context) { return context.contextNode.kind === 195; }; - Rules.IsSameLineTokenOrBeforeMultilineBlockContext = function (context) { - return context.TokensAreOnSameLine() || Rules.IsBeforeMultilineBlockContext(context); + Rules.IsSameLineTokenOrBeforeBlockContext = function (context) { + return context.TokensAreOnSameLine() || Rules.IsBeforeBlockContext(context); }; Rules.IsBraceWrappedContext = function (context) { return context.contextNode.kind === 174 || Rules.IsSingleLineBlockContext(context); @@ -69801,8 +70660,7 @@ var ts; return true; case 207: { var blockParent = context.currentTokenParent.parent; - if (blockParent.kind !== 187 && - blockParent.kind !== 186) { + if (!blockParent || blockParent.kind !== 187 && blockParent.kind !== 186) { return true; } } @@ -70265,11 +71123,27 @@ var ts; } formatting.formatOnEnter = formatOnEnter; function formatOnSemicolon(position, sourceFile, rulesProvider, options) { - return formatOutermostParent(position, 25, sourceFile, options, rulesProvider, 3); + var semicolon = findImmediatelyPrecedingTokenOfKind(position, 25, sourceFile); + return formatNodeLines(findOutermostNodeWithinListLevel(semicolon), sourceFile, options, rulesProvider, 3); } formatting.formatOnSemicolon = formatOnSemicolon; + function formatOnOpeningCurly(position, sourceFile, rulesProvider, options) { + var openingCurly = findImmediatelyPrecedingTokenOfKind(position, 17, sourceFile); + if (!openingCurly) { + return []; + } + var curlyBraceRange = openingCurly.parent; + var outermostNode = findOutermostNodeWithinListLevel(curlyBraceRange); + var textRange = { + pos: ts.getLineStartPositionForPosition(outermostNode.getStart(sourceFile), sourceFile), + end: position + }; + return formatSpan(textRange, sourceFile, options, rulesProvider, 4); + } + formatting.formatOnOpeningCurly = formatOnOpeningCurly; function formatOnClosingCurly(position, sourceFile, rulesProvider, options) { - return formatOutermostParent(position, 18, sourceFile, options, rulesProvider, 4); + var precedingToken = findImmediatelyPrecedingTokenOfKind(position, 18, sourceFile); + return formatNodeLines(findOutermostNodeWithinListLevel(precedingToken), sourceFile, options, rulesProvider, 5); } formatting.formatOnClosingCurly = formatOnClosingCurly; function formatDocument(sourceFile, rulesProvider, options) { @@ -70283,33 +71157,22 @@ var ts; function formatSelection(start, end, sourceFile, rulesProvider, options) { var span = { pos: ts.getLineStartPositionForPosition(start, sourceFile), - end: end + end: end, }; return formatSpan(span, sourceFile, options, rulesProvider, 1); } formatting.formatSelection = formatSelection; - function formatOutermostParent(position, expectedLastToken, sourceFile, options, rulesProvider, requestKind) { - var parent = findOutermostParent(position, expectedLastToken, sourceFile); - if (!parent) { - return []; - } - var span = { - pos: ts.getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), - end: parent.end - }; - return formatSpan(span, sourceFile, options, rulesProvider, requestKind); + function findImmediatelyPrecedingTokenOfKind(end, expectedTokenKind, sourceFile) { + var precedingToken = ts.findPrecedingToken(end, sourceFile); + return precedingToken && precedingToken.kind === expectedTokenKind && end === precedingToken.getEnd() ? + precedingToken : + undefined; } - function findOutermostParent(position, expectedTokenKind, sourceFile) { - var precedingToken = ts.findPrecedingToken(position, sourceFile); - if (!precedingToken || - precedingToken.kind !== expectedTokenKind || - position !== precedingToken.getEnd()) { - return undefined; - } - var current = precedingToken; + function findOutermostNodeWithinListLevel(node) { + var current = node; while (current && current.parent && - current.parent.end === precedingToken.end && + current.parent.end === node.end && !isListElement(current.parent, current)) { current = current.parent; } @@ -70406,11 +71269,21 @@ var ts; } return 0; } - function formatNode(node, sourceFileLike, languageVariant, initialIndentation, delta, rulesProvider) { + function formatNodeGivenIndentation(node, sourceFileLike, languageVariant, initialIndentation, delta, rulesProvider) { var range = { pos: 0, end: sourceFileLike.text.length }; return formatSpanWorker(range, node, initialIndentation, delta, formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end), rulesProvider.getFormatOptions(), rulesProvider, 1, function (_) { return false; }, sourceFileLike); } - formatting.formatNode = formatNode; + formatting.formatNodeGivenIndentation = formatNodeGivenIndentation; + function formatNodeLines(node, sourceFile, options, rulesProvider, requestKind) { + if (!node) { + return []; + } + var span = { + pos: ts.getLineStartPositionForPosition(node.getStart(sourceFile), sourceFile), + end: node.end + }; + return formatSpan(span, sourceFile, options, rulesProvider, requestKind); + } function formatSpan(originalRange, sourceFile, options, rulesProvider, requestKind) { var enclosingNode = findEnclosingNode(originalRange, sourceFile); return formatSpanWorker(originalRange, enclosingNode, formatting.SmartIndenter.getIndentationForNode(enclosingNode, originalRange, sourceFile, options), getOwnOrInheritedDelta(enclosingNode, options, sourceFile), formatting.getFormattingScanner(sourceFile.text, sourceFile.languageVariant, getScanStartPosition(enclosingNode, originalRange, sourceFile), originalRange.end), options, rulesProvider, requestKind, prepareRangeContainsErrorFunction(sourceFile.parseDiagnostics, originalRange), sourceFile); @@ -70637,6 +71510,7 @@ var ts; return inheritedIndentation; } function processChildNodes(nodes, parent, parentStartLine, parentDynamicIndentation) { + ts.Debug.assert(ts.isNodeArray(nodes)); var listStartToken = getOpenTokenForList(parent, nodes); var listEndToken = getCloseTokenForOpenToken(listStartToken); var listDynamicIndentation = parentDynamicIndentation; @@ -71433,15 +72307,21 @@ var ts; var textChanges; (function (textChanges) { function getPos(n) { - return n["__pos"]; + var result = n["__pos"]; + ts.Debug.assert(typeof result === "number"); + return result; } function setPos(n, pos) { + ts.Debug.assert(typeof pos === "number"); n["__pos"] = pos; } function getEnd(n) { - return n["__end"]; + var result = n["__end"]; + ts.Debug.assert(typeof result === "number"); + return result; } function setEnd(n, end) { + ts.Debug.assert(typeof end === "number"); n["__end"] = end; } var Position; @@ -71464,6 +72344,12 @@ var ts; } return false; } + var ChangeKind; + (function (ChangeKind) { + ChangeKind[ChangeKind["Remove"] = 0] = "Remove"; + ChangeKind[ChangeKind["ReplaceWithSingleNode"] = 1] = "ReplaceWithSingleNode"; + ChangeKind[ChangeKind["ReplaceWithMultipleNodes"] = 2] = "ReplaceWithMultipleNodes"; + })(ChangeKind || (ChangeKind = {})); function getSeparatorCharacter(separator) { return ts.tokenToString(separator.kind); } @@ -71488,7 +72374,7 @@ var ts; } textChanges.getAdjustedStartPosition = getAdjustedStartPosition; function getAdjustedEndPosition(sourceFile, node, options) { - if (options.useNonAdjustedEndPosition) { + if (options.useNonAdjustedEndPosition || ts.isExpression(node)) { return node.getEnd(); } var end = node.getEnd(); @@ -71508,6 +72394,9 @@ var ts; } return s; } + function getNewlineKind(context) { + return context.newLineCharacter === "\n" ? 1 : 0; + } var ChangeTracker = (function () { function ChangeTracker(newLine, rulesProvider, validator) { this.newLine = newLine; @@ -71517,24 +72406,24 @@ var ts; this.newLineCharacter = ts.getNewLineCharacter({ newLine: newLine }); } ChangeTracker.fromCodeFixContext = function (context) { - return new ChangeTracker(context.newLineCharacter === "\n" ? 1 : 0, context.rulesProvider); + return new ChangeTracker(getNewlineKind(context), context.rulesProvider); + }; + ChangeTracker.prototype.deleteRange = function (sourceFile, range) { + this.changes.push({ kind: ChangeKind.Remove, sourceFile: sourceFile, range: range }); + return this; }; ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) { if (options === void 0) { options = {}; } var startPosition = getAdjustedStartPosition(sourceFile, node, options, Position.FullStart); var endPosition = getAdjustedEndPosition(sourceFile, node, options); - this.changes.push({ sourceFile: sourceFile, options: options, range: { pos: startPosition, end: endPosition } }); - return this; - }; - ChangeTracker.prototype.deleteRange = function (sourceFile, range) { - this.changes.push({ sourceFile: sourceFile, range: range }); + this.changes.push({ kind: ChangeKind.Remove, sourceFile: sourceFile, range: { pos: startPosition, end: endPosition } }); return this; }; ChangeTracker.prototype.deleteNodeRange = function (sourceFile, startNode, endNode, options) { if (options === void 0) { options = {}; } var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.FullStart); var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); - this.changes.push({ sourceFile: sourceFile, options: options, range: { pos: startPosition, end: endPosition } }); + this.changes.push({ kind: ChangeKind.Remove, sourceFile: sourceFile, range: { pos: startPosition, end: endPosition } }); return this; }; ChangeTracker.prototype.deleteNodeInList = function (sourceFile, node) { @@ -71570,33 +72459,68 @@ var ts; }; ChangeTracker.prototype.replaceRange = function (sourceFile, range, newNode, options) { if (options === void 0) { options = {}; } - this.changes.push({ sourceFile: sourceFile, range: range, options: options, node: newNode }); + this.changes.push({ kind: ChangeKind.ReplaceWithSingleNode, sourceFile: sourceFile, range: range, options: options, node: newNode }); return this; }; ChangeTracker.prototype.replaceNode = function (sourceFile, oldNode, newNode, options) { if (options === void 0) { options = {}; } var startPosition = getAdjustedStartPosition(sourceFile, oldNode, options, Position.Start); var endPosition = getAdjustedEndPosition(sourceFile, oldNode, options); - this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: endPosition } }); - return this; + return this.replaceWithSingle(sourceFile, startPosition, endPosition, newNode, options); }; ChangeTracker.prototype.replaceNodeRange = function (sourceFile, startNode, endNode, newNode, options) { if (options === void 0) { options = {}; } var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.Start); var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); - this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: endPosition } }); + return this.replaceWithSingle(sourceFile, startPosition, endPosition, newNode, options); + }; + ChangeTracker.prototype.replaceWithSingle = function (sourceFile, startPosition, endPosition, newNode, options) { + this.changes.push({ + kind: ChangeKind.ReplaceWithSingleNode, + sourceFile: sourceFile, + options: options, + node: newNode, + range: { pos: startPosition, end: endPosition } + }); + return this; + }; + ChangeTracker.prototype.replaceWithMultiple = function (sourceFile, startPosition, endPosition, newNodes, options) { + this.changes.push({ + kind: ChangeKind.ReplaceWithMultipleNodes, + sourceFile: sourceFile, + options: options, + nodes: newNodes, + range: { pos: startPosition, end: endPosition } + }); return this; }; + ChangeTracker.prototype.replaceNodeWithNodes = function (sourceFile, oldNode, newNodes, options) { + var startPosition = getAdjustedStartPosition(sourceFile, oldNode, options, Position.Start); + var endPosition = getAdjustedEndPosition(sourceFile, oldNode, options); + return this.replaceWithMultiple(sourceFile, startPosition, endPosition, newNodes, options); + }; + ChangeTracker.prototype.replaceNodesWithNodes = function (sourceFile, oldNodes, newNodes, options) { + var startPosition = getAdjustedStartPosition(sourceFile, oldNodes[0], options, Position.Start); + var endPosition = getAdjustedEndPosition(sourceFile, ts.lastOrUndefined(oldNodes), options); + return this.replaceWithMultiple(sourceFile, startPosition, endPosition, newNodes, options); + }; + ChangeTracker.prototype.replaceRangeWithNodes = function (sourceFile, range, newNodes, options) { + return this.replaceWithMultiple(sourceFile, range.pos, range.end, newNodes, options); + }; + ChangeTracker.prototype.replaceNodeRangeWithNodes = function (sourceFile, startNode, endNode, newNodes, options) { + var startPosition = getAdjustedStartPosition(sourceFile, startNode, options, Position.Start); + var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); + return this.replaceWithMultiple(sourceFile, startPosition, endPosition, newNodes, options); + }; ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) { if (options === void 0) { options = {}; } - this.changes.push({ sourceFile: sourceFile, options: options, node: newNode, range: { pos: pos, end: pos } }); + this.changes.push({ kind: ChangeKind.ReplaceWithSingleNode, sourceFile: sourceFile, options: options, node: newNode, range: { pos: pos, end: pos } }); return this; }; ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, options) { if (options === void 0) { options = {}; } var startPosition = getAdjustedStartPosition(sourceFile, before, options, Position.Start); - this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: startPosition, end: startPosition } }); - return this; + return this.replaceWithSingle(sourceFile, startPosition, startPosition, newNode, options); }; ChangeTracker.prototype.insertNodeAfter = function (sourceFile, after, newNode, options) { if (options === void 0) { options = {}; } @@ -71606,6 +72530,7 @@ var ts; after.kind === 150) { if (sourceFile.text.charCodeAt(after.end - 1) !== 59) { this.changes.push({ + kind: ChangeKind.ReplaceWithSingleNode, sourceFile: sourceFile, options: {}, range: { pos: after.end, end: after.end }, @@ -71614,8 +72539,7 @@ var ts; } } var endPosition = getAdjustedEndPosition(sourceFile, after, options); - this.changes.push({ sourceFile: sourceFile, options: options, useIndentationFromFile: true, node: newNode, range: { pos: endPosition, end: endPosition } }); - return this; + return this.replaceWithSingle(sourceFile, endPosition, endPosition, newNode, options); }; ChangeTracker.prototype.insertNodeInListAfter = function (sourceFile, after, newNode) { var containingList = ts.formatting.SmartIndenter.getContainingList(after, sourceFile); @@ -71643,10 +72567,10 @@ var ts; startPos = ts.getStartPositionOfLine(lineAndCharOfNextElement.line, sourceFile); } this.changes.push({ + kind: ChangeKind.ReplaceWithSingleNode, sourceFile: sourceFile, range: { pos: startPos, end: containingList[index + 1].getStart(sourceFile) }, node: newNode, - useIndentationFromFile: true, options: { prefix: prefix, suffix: "" + ts.tokenToString(nextToken.kind) + sourceFile.text.substring(nextToken.end, containingList[index + 1].getStart(sourceFile)) @@ -71673,6 +72597,7 @@ var ts; } if (multilineList) { this.changes.push({ + kind: ChangeKind.ReplaceWithSingleNode, sourceFile: sourceFile, range: { pos: end, end: end }, node: ts.createToken(separator), @@ -71684,6 +72609,7 @@ var ts; insertPos--; } this.changes.push({ + kind: ChangeKind.ReplaceWithSingleNode, sourceFile: sourceFile, range: { pos: insertPos, end: insertPos }, node: newNode, @@ -71692,6 +72618,7 @@ var ts; } else { this.changes.push({ + kind: ChangeKind.ReplaceWithSingleNode, sourceFile: sourceFile, range: { pos: end, end: end }, node: newNode, @@ -71703,7 +72630,7 @@ var ts; }; ChangeTracker.prototype.getChanges = function () { var _this = this; - var changesPerFile = ts.createFileMap(); + var changesPerFile = ts.createMap(); for (var _i = 0, _a = this.changes; _i < _a.length; _i++) { var c = _a[_i]; var changesInFile = changesPerFile.get(c.sourceFile.path); @@ -71713,8 +72640,7 @@ var ts; changesInFile.push(c); } var fileChangesList = []; - changesPerFile.forEachValue(function (path) { - var changesInFile = changesPerFile.get(path); + changesPerFile.forEach(function (changesInFile) { var sourceFile = changesInFile[0].sourceFile; var fileTextChanges = { fileName: sourceFile.fileName, textChanges: [] }; for (var _i = 0, _a = ChangeTracker.normalize(changesInFile); _i < _a.length; _i++) { @@ -71732,30 +72658,43 @@ var ts; return ts.createTextSpanFromBounds(change.range.pos, change.range.end); }; ChangeTracker.prototype.computeNewText = function (change, sourceFile) { - if (!change.node) { + var _this = this; + if (change.kind === ChangeKind.Remove) { return ""; } var options = change.options || {}; - var nonFormattedText = getNonformattedText(change.node, sourceFile, this.newLine); + var text; + var pos = change.range.pos; + var posStartsLine = ts.getLineStartPositionForPosition(pos, sourceFile) === pos; + if (change.kind === ChangeKind.ReplaceWithMultipleNodes) { + var parts = change.nodes.map(function (n) { return _this.getFormattedTextOfNode(n, sourceFile, pos, options); }); + text = parts.join(change.options.nodeSeparator); + } + else { + ts.Debug.assert(change.kind === ChangeKind.ReplaceWithSingleNode, "change.kind === ReplaceWithSingleNode"); + text = this.getFormattedTextOfNode(change.node, sourceFile, pos, options); + } + text = (posStartsLine || options.indentation !== undefined) ? text : text.replace(/^\s+/, ""); + return (options.prefix || "") + text + (options.suffix || ""); + }; + ChangeTracker.prototype.getFormattedTextOfNode = function (node, sourceFile, pos, options) { + var nonformattedText = getNonformattedText(node, sourceFile, this.newLine); if (this.validator) { - this.validator(nonFormattedText); + this.validator(nonformattedText); } var formatOptions = this.rulesProvider.getFormatOptions(); - var pos = change.range.pos; var posStartsLine = ts.getLineStartPositionForPosition(pos, sourceFile) === pos; - var initialIndentation = change.options.indentation !== undefined - ? change.options.indentation - : change.useIndentationFromFile - ? ts.formatting.SmartIndenter.getIndentation(change.range.pos, sourceFile, formatOptions, posStartsLine || (change.options.prefix === this.newLineCharacter)) + var initialIndentation = options.indentation !== undefined + ? options.indentation + : (options.useIndentationFromFile !== false) + ? ts.formatting.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, posStartsLine || (options.prefix === this.newLineCharacter)) : 0; - var delta = change.options.delta !== undefined - ? change.options.delta - : ts.formatting.SmartIndenter.shouldIndentChildNode(change.node) - ? formatOptions.indentSize + var delta = options.delta !== undefined + ? options.delta + : ts.formatting.SmartIndenter.shouldIndentChildNode(node) + ? (formatOptions.indentSize || 0) : 0; - var text = applyFormatting(nonFormattedText, sourceFile, initialIndentation, delta, this.rulesProvider); - text = posStartsLine || change.options.indentation !== undefined ? text : text.replace(/^\s+/, ""); - return (options.prefix || "") + text + (options.suffix || ""); + return applyFormatting(nonformattedText, sourceFile, initialIndentation, delta, this.rulesProvider); }; ChangeTracker.normalize = function (changes) { var normalized = ts.stableSort(changes, function (a, b) { return a.range.pos - b.range.pos; }); @@ -71771,10 +72710,9 @@ var ts; var options = { newLine: newLine, target: sourceFile && sourceFile.languageVersion }; var writer = new Writer(ts.getNewLineCharacter(options)); var printer = ts.createPrinter(options, writer); - printer.writeNode(3, node, sourceFile, writer); + printer.writeNode(4, node, sourceFile, writer); return { text: writer.getText(), node: assignPositionsToNode(node) }; } - textChanges.getNonformattedText = getNonformattedText; function applyFormatting(nonFormattedText, sourceFile, initialIndentation, delta, rulesProvider) { var lineMap = ts.computeLineStarts(nonFormattedText.text); var file = { @@ -71782,10 +72720,9 @@ var ts; lineMap: lineMap, getLineAndCharacterOfPosition: function (pos) { return ts.computeLineAndCharacterOfPosition(lineMap, pos); } }; - var changes = ts.formatting.formatNode(nonFormattedText.node, file, sourceFile.languageVariant, initialIndentation, delta, rulesProvider); + var changes = ts.formatting.formatNodeGivenIndentation(nonFormattedText.node, file, sourceFile.languageVariant, initialIndentation, delta, rulesProvider); return applyChanges(nonFormattedText.text, changes); } - textChanges.applyFormatting = applyFormatting; function applyChanges(text, changes) { for (var i = changes.length - 1; i >= 0; i--) { var change = changes[i]; @@ -71799,13 +72736,10 @@ var ts; } function assignPositionsToNode(node) { var visited = ts.visitEachChild(node, assignPositionsToNode, ts.nullTransformationContext, assignPositionsToNodeArray, assignPositionsToNode); - var newNode = ts.nodeIsSynthesized(visited) - ? visited - : (Proxy.prototype = visited, new Proxy()); + var newNode = ts.nodeIsSynthesized(visited) ? visited : Object.create(visited); newNode.pos = getPos(node); newNode.end = getEnd(node); return newNode; - function Proxy() { } } function assignPositionsToNodeArray(nodes, visitor, test, start, count) { var visited = ts.visitNodes(nodes, visitor, test, start, count); @@ -71956,23 +72890,9 @@ var ts; } refactor_1.registerRefactor = registerRefactor; function getApplicableRefactors(context) { - var results; - var refactorList = []; - refactors.forEach(function (refactor) { - refactorList.push(refactor); + return ts.flatMapIter(refactors.values(), function (refactor) { + return context.cancellationToken && context.cancellationToken.isCancellationRequested() ? [] : refactor.getAvailableActions(context); }); - for (var _i = 0, refactorList_1 = refactorList; _i < refactorList_1.length; _i++) { - var refactor_2 = refactorList_1[_i]; - if (context.cancellationToken && context.cancellationToken.isCancellationRequested()) { - return results; - } - var infos = refactor_2.getAvailableActions(context); - if (infos && infos.length) { - (_a = (results || (results = []))).push.apply(_a, infos); - } - } - return results; - var _a; } refactor_1.getApplicableRefactors = getApplicableRefactors; function getEditsForRefactor(context, refactorName, actionName) { @@ -71987,6 +72907,33 @@ var ts; var codefix; (function (codefix) { codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.Cannot_access_0_1_because_0_is_a_type_but_not_a_namespace_Did_you_mean_to_retrieve_the_type_of_the_property_1_in_0_with_0_1.code], + getCodeActions: function (context) { + var sourceFile = context.sourceFile; + var token = ts.getTokenAtPosition(sourceFile, context.span.start, false); + var qualifiedName = ts.getAncestor(token, 143); + ts.Debug.assert(!!qualifiedName, "Expected position to be owned by a qualified name."); + if (!ts.isIdentifier(qualifiedName.left)) { + return undefined; + } + var leftText = qualifiedName.left.getText(sourceFile); + var rightText = qualifiedName.right.getText(sourceFile); + var replacement = ts.createIndexedAccessTypeNode(ts.createTypeReferenceNode(qualifiedName.left, undefined), ts.createLiteralTypeNode(ts.createLiteral(rightText))); + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + changeTracker.replaceNode(sourceFile, qualifiedName, replacement); + return [{ + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Rewrite_as_the_indexed_access_type_0), [leftText + "[\"" + rightText + "\"]"]), + changes: changeTracker.getChanges() + }]; + } + }); + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ errorCodes: [ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code], getCodeActions: getActionForClassLikeIncorrectImplementsInterface }); @@ -72032,11 +72979,7 @@ var ts; newNodes.push(newIndexSignatureDeclaration); } function pushAction(result, newNodes, description) { - var newAction = { - description: description, - changes: codefix.newNodesToChanges(newNodes, openBrace, context) - }; - result.push(newAction); + result.push({ description: description, changes: codefix.newNodesToChanges(newNodes, openBrace, context) }); } } })(codefix = ts.codefix || (ts.codefix = {})); @@ -72196,7 +73139,8 @@ var ts; var node = ts.getTokenAtPosition(sourceFile, context.span.start, false); var checker = context.program.getTypeChecker(); var suggestion; - if (node.kind === 71 && ts.isPropertyAccessExpression(node.parent)) { + if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) { + ts.Debug.assert(node.kind === 71); var containingType = checker.getTypeAtLocation(node.parent.expression); suggestion = checker.getSuggestionForNonexistentProperty(node, containingType); } @@ -72292,9 +73236,9 @@ var ts; return undefined; } if (superCall.expression && superCall.expression.kind === 181) { - var arguments_1 = superCall.expression.arguments; - for (var i = 0; i < arguments_1.length; i++) { - if (arguments_1[i].expression === token) { + var expressionArguments = superCall.expression.arguments; + for (var i = 0; i < expressionArguments.length; i++) { + if (expressionArguments[i].expression === token) { return undefined; } } @@ -72426,14 +73370,14 @@ var ts; case 240: return [deleteNode(token.parent)]; default: - return [deleteDefault()]; + return deleteDefault(); } function deleteDefault() { if (ts.isDeclarationName(token)) { - return deleteNode(token.parent); + return [deleteNode(token.parent)]; } else if (ts.isLiteralComputedPropertyDeclarationName(token)) { - return deleteNode(token.parent.parent); + return [deleteNode(token.parent.parent)]; } else { return undefined; @@ -72479,8 +73423,7 @@ var ts; case 242: var namedImports = parent.parent; if (namedImports.elements.length === 1) { - var importSpec = ts.getAncestor(identifier, 238); - return [deleteNode(importSpec)]; + return deleteNamedImportBinding(namedImports); } else { return [deleteNodeInList(parent)]; @@ -72492,31 +73435,32 @@ var ts; return [deleteNode(importDecl)]; } else { - var start_4 = importClause.name.getStart(sourceFile); + var start_6 = importClause.name.getStart(sourceFile); var nextToken = ts.getTokenAtPosition(sourceFile, importClause.name.end, false); if (nextToken && nextToken.kind === 26) { - return [deleteRange({ pos: start_4, end: ts.skipTrivia(sourceFile.text, nextToken.end, false, true) })]; + return [deleteRange({ pos: start_6, end: ts.skipTrivia(sourceFile.text, nextToken.end, false, true) })]; } else { return [deleteNode(importClause.name)]; } } case 240: - var namespaceImport = parent; - if (namespaceImport.name === identifier && !namespaceImport.parent.name) { - var importDecl = ts.getAncestor(namespaceImport, 238); - return [deleteNode(importDecl)]; - } - else { - var previousToken = ts.getTokenAtPosition(sourceFile, namespaceImport.pos - 1, false); - if (previousToken && previousToken.kind === 26) { - var startPosition = ts.textChanges.getAdjustedStartPosition(sourceFile, previousToken, {}, ts.textChanges.Position.FullStart); - return [deleteRange({ pos: startPosition, end: namespaceImport.end })]; - } - return [deleteRange(namespaceImport)]; - } + return deleteNamedImportBinding(parent); default: - return [deleteDefault()]; + return deleteDefault(); + } + } + function deleteNamedImportBinding(namedBindings) { + if (namedBindings.parent.name) { + var previousToken = ts.getTokenAtPosition(sourceFile, namedBindings.pos - 1, false); + if (previousToken && previousToken.kind === 26) { + return [deleteRange({ pos: previousToken.getStart(), end: namedBindings.end })]; + } + return undefined; + } + else { + var importDecl = ts.getAncestor(namedBindings, 238); + return [deleteNode(importDecl)]; } } function deleteVariableDeclarationOrPrefixWithUnderscore(identifier, varDecl) { @@ -72575,6 +73519,45 @@ var ts; var codefix; (function (codefix) { codefix.registerCodeFix({ + errorCodes: [ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments.code], + getCodeActions: getActionsForJSDocTypes + }); + function getActionsForJSDocTypes(context) { + var sourceFile = context.sourceFile; + var node = ts.getTokenAtPosition(sourceFile, context.span.start, false); + var decl = ts.findAncestor(node, function (n) { return n.kind === 226; }); + if (!decl) + return; + var checker = context.program.getTypeChecker(); + var jsdocType = decl.type; + var original = ts.getTextOfNode(jsdocType); + var type = checker.getTypeFromTypeNode(jsdocType); + var actions = [createAction(jsdocType, sourceFile.fileName, original, checker.typeToString(type, undefined, 8))]; + if (jsdocType.kind === 270) { + var replacementWithUndefined = checker.typeToString(checker.getNullableType(type, 2048), undefined, 8); + actions.push(createAction(jsdocType, sourceFile.fileName, original, replacementWithUndefined)); + } + return actions; + } + function createAction(declaration, fileName, original, replacement) { + return { + description: ts.formatStringFromArgs(ts.getLocaleSpecificMessage(ts.Diagnostics.Change_0_to_1), [original, replacement]), + changes: [{ + fileName: fileName, + textChanges: [{ + span: { start: declaration.getStart(), length: declaration.getWidth() }, + newText: replacement + }] + }], + }; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var codefix; + (function (codefix) { + codefix.registerCodeFix({ errorCodes: [ ts.Diagnostics.Cannot_find_name_0.code, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1.code, @@ -72680,12 +73663,12 @@ var ts; var umdSymbol = checker.getSymbolAtLocation(token); var symbol = void 0; var symbolName = void 0; - if (umdSymbol.flags & 8388608) { + if (umdSymbol.flags & 2097152) { symbol = checker.getAliasedSymbol(umdSymbol); symbolName = name; } else if (ts.isJsxOpeningLikeElement(token.parent) && token.parent.tagName === token) { - symbol = checker.getAliasedSymbol(checker.resolveNameAtLocation(token, checker.getJsxNamespace(), 107455)); + symbol = checker.getAliasedSymbol(checker.resolveName(checker.getJsxNamespace(), token.parent.tagName, 107455)); symbolName = symbol.name; } else { @@ -72706,12 +73689,13 @@ var ts; var defaultExport = checker.tryGetMemberInModuleExports("default", moduleSymbol); if (defaultExport) { var localSymbol = ts.getLocalSymbolForExportDefault(defaultExport); - if (localSymbol && localSymbol.name === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { + if (localSymbol && localSymbol.escapedName === name && checkSymbolHasMeaning(localSymbol, currentTokenMeaning)) { var symbolId = getUniqueSymbolId(localSymbol); symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, name, true)); } } - var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExports(name, moduleSymbol); + ts.Debug.assert(name !== "default"); + var exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(name, moduleSymbol); if (exportSymbolWithIdenticalName && checkSymbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) { var symbolId = getUniqueSymbolId(exportSymbolWithIdenticalName); symbolIdActionMap.addActions(symbolId, getCodeActionForImport(moduleSymbol, name)); @@ -72749,10 +73733,7 @@ var ts; } } function getUniqueSymbolId(symbol) { - if (symbol.flags & 8388608) { - return ts.getSymbolId(checker.getAliasedSymbol(symbol)); - } - return ts.getSymbolId(symbol); + return ts.getSymbolId(ts.skipAlias(symbol, checker)); } function checkSymbolHasMeaning(symbol, meaning) { var declarations = symbol.getDeclarations(); @@ -72771,8 +73752,8 @@ var ts; var namespaceImportDeclaration; var namedImportDeclaration; var existingModuleSpecifier; - for (var _i = 0, declarations_14 = declarations; _i < declarations_14.length; _i++) { - var declaration = declarations_14[_i]; + for (var _i = 0, declarations_13 = declarations; _i < declarations_13.length; _i++) { + var declaration = declarations_13[_i]; if (declaration.kind === 238) { var namedBindings = declaration.importClause && declaration.importClause.namedBindings; if (namedBindings && namedBindings.kind === 240) { @@ -72846,14 +73827,53 @@ var ts; : isNamespaceImport ? ts.createImportClause(undefined, ts.createNamespaceImport(ts.createIdentifier(symbolName))) : ts.createImportClause(undefined, ts.createNamedImports([ts.createImportSpecifier(undefined, ts.createIdentifier(symbolName))])); - var importDecl = ts.createImportDeclaration(undefined, undefined, importClause, ts.createLiteral(moduleSpecifierWithoutQuotes)); + var moduleSpecifierLiteral = ts.createLiteral(moduleSpecifierWithoutQuotes); + moduleSpecifierLiteral.singleQuote = getSingleQuoteStyleFromExistingImports(); + var importDecl = ts.createImportDeclaration(undefined, undefined, importClause, moduleSpecifierLiteral); if (!lastImportDeclaration) { - changeTracker.insertNodeAt(sourceFile, sourceFile.getStart(), importDecl, { suffix: "" + context.newLineCharacter + context.newLineCharacter }); + changeTracker.insertNodeAt(sourceFile, getSourceFileImportLocation(sourceFile), importDecl, { suffix: "" + context.newLineCharacter + context.newLineCharacter }); } else { changeTracker.insertNodeAfter(sourceFile, lastImportDeclaration, importDecl, { suffix: context.newLineCharacter }); } return createCodeAction(ts.Diagnostics.Import_0_from_1, [symbolName, "\"" + moduleSpecifierWithoutQuotes + "\""], changeTracker.getChanges(), "NewImport", moduleSpecifierWithoutQuotes); + function getSourceFileImportLocation(node) { + var text = node.text; + var ranges = ts.getLeadingCommentRanges(text, 0); + if (!ranges) + return 0; + var position = 0; + if (ranges.length && ranges[0].kind === 3 && ts.isPinnedComment(text, ranges[0])) { + position = ranges[0].end + 1; + ranges = ranges.slice(1); + } + for (var _i = 0, ranges_1 = ranges; _i < ranges_1.length; _i++) { + var range = ranges_1[_i]; + if (range.kind === 2 && ts.isRecognizedTripleSlashComment(node.text, range.pos, range.end)) { + position = range.end + 1; + continue; + } + break; + } + return position; + } + function getSingleQuoteStyleFromExistingImports() { + var firstModuleSpecifier = ts.forEach(sourceFile.statements, function (node) { + if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) { + if (node.moduleSpecifier && ts.isStringLiteral(node.moduleSpecifier)) { + return node.moduleSpecifier; + } + } + else if (ts.isImportEqualsDeclaration(node)) { + if (ts.isExternalModuleReference(node.moduleReference) && ts.isStringLiteral(node.moduleReference.expression)) { + return node.moduleReference.expression; + } + } + }); + if (firstModuleSpecifier) { + return sourceFile.text.charCodeAt(firstModuleSpecifier.getStart()) === 39; + } + } function getModuleSpecifierForNewImport() { var fileName = sourceFile.fileName; var moduleFileName = moduleSymbol.valueDeclaration.getSourceFile().fileName; @@ -72935,43 +73955,97 @@ var ts; if (ts.getEmitModuleResolutionKind(options) !== ts.ModuleResolutionKind.NodeJs) { return undefined; } - var indexOfNodeModules = moduleFileName.indexOf("node_modules"); - if (indexOfNodeModules < 0) { + var parts = getNodeModulePathParts(moduleFileName); + if (!parts) { return undefined; } - var relativeFileName; - if (sourceDirectory.indexOf(moduleFileName.substring(0, indexOfNodeModules - 1)) === 0) { - relativeFileName = moduleFileName.substring(indexOfNodeModules + 13); - } - else { - relativeFileName = getRelativePath(moduleFileName, sourceDirectory); - } - relativeFileName = ts.removeFileExtension(relativeFileName); - if (ts.endsWith(relativeFileName, "/index")) { - relativeFileName = ts.getDirectoryPath(relativeFileName); - } - else { - try { - var moduleDirectory = ts.getDirectoryPath(moduleFileName); - var packageJsonContent = JSON.parse(context.host.readFile(ts.combinePaths(moduleDirectory, "package.json"))); + var moduleSpecifier = getDirectoryOrExtensionlessFileName(moduleFileName); + moduleSpecifier = getNodeResolvablePath(moduleSpecifier); + return ts.getPackageNameFromAtTypesDirectory(moduleSpecifier); + function getDirectoryOrExtensionlessFileName(path) { + var packageRootPath = path.substring(0, parts.packageRootIndex); + var packageJsonPath = ts.combinePaths(packageRootPath, "package.json"); + if (context.host.fileExists(packageJsonPath)) { + var packageJsonContent = JSON.parse(context.host.readFile(packageJsonPath)); if (packageJsonContent) { - var mainFile = packageJsonContent.main || packageJsonContent.typings; - if (mainFile) { - var mainExportFile = ts.toPath(mainFile, moduleDirectory, getCanonicalFileName); - if (ts.removeFileExtension(mainExportFile) === ts.removeFileExtension(moduleFileName)) { - relativeFileName = ts.getDirectoryPath(relativeFileName); + var mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main; + if (mainFileRelative) { + var mainExportFile = ts.toPath(mainFileRelative, packageRootPath, getCanonicalFileName); + if (mainExportFile === getCanonicalFileName(path)) { + return packageRootPath; } } } } - catch (e) { } + var fullModulePathWithoutExtension = ts.removeFileExtension(path); + if (getCanonicalFileName(fullModulePathWithoutExtension.substring(parts.fileNameIndex)) === "/index") { + return fullModulePathWithoutExtension.substring(0, parts.fileNameIndex); + } + return fullModulePathWithoutExtension; + } + function getNodeResolvablePath(path) { + var basePath = path.substring(0, parts.topLevelNodeModulesIndex); + if (sourceDirectory.indexOf(basePath) === 0) { + return path.substring(parts.topLevelPackageNameIndex + 1); + } + else { + return getRelativePath(path, sourceDirectory); + } + } + } + } + function getNodeModulePathParts(fullPath) { + var topLevelNodeModulesIndex = 0; + var topLevelPackageNameIndex = 0; + var packageRootIndex = 0; + var fileNameIndex = 0; + var States; + (function (States) { + States[States["BeforeNodeModules"] = 0] = "BeforeNodeModules"; + States[States["NodeModules"] = 1] = "NodeModules"; + States[States["Scope"] = 2] = "Scope"; + States[States["PackageContent"] = 3] = "PackageContent"; + })(States || (States = {})); + var partStart = 0; + var partEnd = 0; + var state = 0; + while (partEnd >= 0) { + partStart = partEnd; + partEnd = fullPath.indexOf("/", partStart + 1); + switch (state) { + case 0: + if (fullPath.indexOf("/node_modules/", partStart) === partStart) { + topLevelNodeModulesIndex = partStart; + topLevelPackageNameIndex = partEnd; + state = 1; + } + break; + case 1: + case 2: + if (state === 1 && fullPath.charAt(partStart + 1) === "@") { + state = 2; + } + else { + packageRootIndex = partEnd; + state = 3; + } + break; + case 3: + if (fullPath.indexOf("/node_modules/", partStart) === partStart) { + state = 1; + } + else { + state = 3; + } + break; } - return ts.getPackageNameFromAtTypesDirectory(relativeFileName); } + fileNameIndex = partStart; + return state > 1 ? { topLevelNodeModulesIndex: topLevelNodeModulesIndex, topLevelPackageNameIndex: topLevelPackageNameIndex, packageRootIndex: packageRootIndex, fileNameIndex: fileNameIndex } : undefined; } function getPathRelativeToRootDirs(path, rootDirs) { - for (var _i = 0, rootDirs_2 = rootDirs; _i < rootDirs_2.length; _i++) { - var rootDir = rootDirs_2[_i]; + for (var _i = 0, rootDirs_1 = rootDirs; _i < rootDirs_1.length; _i++) { + var rootDir = rootDirs_1[_i]; var relativeName = getRelativePathIfInDirectory(path, rootDir); if (relativeName !== undefined) { return relativeName; @@ -72992,7 +74066,7 @@ var ts; } function getRelativePath(path, directoryPath) { var relativePath = ts.getRelativePathToDirectoryOrUrl(directoryPath, path, directoryPath, getCanonicalFileName, false); - return ts.moduleHasNonRelativeName(relativePath) ? "./" + relativePath : relativePath; + return !ts.pathIsRelative(relativePath) ? "./" + relativePath : relativePath; } } } @@ -73099,7 +74173,7 @@ var ts; codefix.newNodesToChanges = newNodesToChanges; function createMissingMemberNodes(classDeclaration, possiblyMissingSymbols, checker) { var classMembers = classDeclaration.symbol.members; - var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !classMembers.has(symbol.getName()); }); + var missingMembers = possiblyMissingSymbols.filter(function (symbol) { return !classMembers.has(symbol.escapedName); }); var newNodes = []; for (var _i = 0, missingMembers_1 = missingMembers; _i < missingMembers_1.length; _i++) { var symbol = missingMembers_1[_i]; @@ -73126,7 +74200,7 @@ var ts; var visibilityModifier = createVisibilityModifier(ts.getModifierFlags(declaration)); var modifiers = visibilityModifier ? ts.createNodeArray([visibilityModifier]) : undefined; var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); - var optional = !!(symbol.flags & 67108864); + var optional = !!(symbol.flags & 16777216); switch (declaration.kind) { case 153: case 154: @@ -73220,7 +74294,7 @@ var ts; } } var maxNonRestArgs = maxArgsSignature.parameters.length - (maxArgsSignature.hasRestParameter ? 1 : 0); - var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.getName(); }); + var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.name; }); var parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, minArgumentCount, true); if (someSigHasRestParameter) { var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(119)); @@ -73251,180 +74325,1078 @@ var ts; (function (ts) { var refactor; (function (refactor) { - var actionName = "convert"; - var convertFunctionToES6Class = { - name: "Convert to ES2015 class", - description: ts.Diagnostics.Convert_function_to_an_ES2015_class.message, - getEditsForAction: getEditsForAction, - getAvailableActions: getAvailableActions - }; - refactor.registerRefactor(convertFunctionToES6Class); - function getAvailableActions(context) { - var start = context.startPosition; - var node = ts.getTokenAtPosition(context.file, start, false); - var checker = context.program.getTypeChecker(); - var symbol = checker.getSymbolAtLocation(node); - if (symbol && ts.isDeclarationOfFunctionOrClassExpression(symbol)) { - symbol = symbol.valueDeclaration.initializer.symbol; + var convertFunctionToES6Class; + (function (convertFunctionToES6Class_1) { + var actionName = "convert"; + var convertFunctionToES6Class = { + name: "Convert to ES2015 class", + description: ts.Diagnostics.Convert_function_to_an_ES2015_class.message, + getEditsForAction: getEditsForAction, + getAvailableActions: getAvailableActions + }; + refactor.registerRefactor(convertFunctionToES6Class); + function getAvailableActions(context) { + if (!ts.isInJavaScriptFile(context.file)) { + return undefined; + } + var start = context.startPosition; + var node = ts.getTokenAtPosition(context.file, start, false); + var checker = context.program.getTypeChecker(); + var symbol = checker.getSymbolAtLocation(node); + if (symbol && ts.isDeclarationOfFunctionOrClassExpression(symbol)) { + symbol = symbol.valueDeclaration.initializer.symbol; + } + if (symbol && (symbol.flags & 16) && symbol.members && (symbol.members.size > 0)) { + return [ + { + name: convertFunctionToES6Class.name, + description: convertFunctionToES6Class.description, + actions: [ + { + description: convertFunctionToES6Class.description, + name: actionName + } + ] + } + ]; + } } - if (symbol && (symbol.flags & 16) && symbol.members && (symbol.members.size > 0)) { - return [ - { - name: convertFunctionToES6Class.name, - description: convertFunctionToES6Class.description, - actions: [ - { - description: convertFunctionToES6Class.description, - name: actionName + function getEditsForAction(context, action) { + if (actionName !== action) { + return undefined; + } + var start = context.startPosition; + var sourceFile = context.file; + var checker = context.program.getTypeChecker(); + var token = ts.getTokenAtPosition(sourceFile, start, false); + var ctorSymbol = checker.getSymbolAtLocation(token); + var newLine = context.rulesProvider.getFormatOptions().newLineCharacter; + var deletedNodes = []; + var deletes = []; + if (!(ctorSymbol.flags & (16 | 3))) { + return undefined; + } + var ctorDeclaration = ctorSymbol.valueDeclaration; + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + var precedingNode; + var newClassDeclaration; + switch (ctorDeclaration.kind) { + case 228: + precedingNode = ctorDeclaration; + deleteNode(ctorDeclaration); + newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration); + break; + case 226: + precedingNode = ctorDeclaration.parent.parent; + if (ctorDeclaration.parent.declarations.length === 1) { + deleteNode(precedingNode); + } + else { + deleteNode(ctorDeclaration, true); + } + newClassDeclaration = createClassFromVariableDeclaration(ctorDeclaration); + break; + } + if (!newClassDeclaration) { + return undefined; + } + changeTracker.insertNodeAfter(sourceFile, precedingNode, newClassDeclaration, { suffix: newLine }); + for (var _i = 0, deletes_1 = deletes; _i < deletes_1.length; _i++) { + var deleteCallback = deletes_1[_i]; + deleteCallback(); + } + return { + edits: changeTracker.getChanges(), + renameFilename: undefined, + renameLocation: undefined, + }; + function deleteNode(node, inList) { + if (inList === void 0) { inList = false; } + if (deletedNodes.some(function (n) { return ts.isNodeDescendantOf(node, n); })) { + return; + } + deletedNodes.push(node); + if (inList) { + deletes.push(function () { return changeTracker.deleteNodeInList(sourceFile, node); }); + } + else { + deletes.push(function () { return changeTracker.deleteNode(sourceFile, node); }); + } + } + function createClassElementsFromSymbol(symbol) { + var memberElements = []; + if (symbol.members) { + symbol.members.forEach(function (member) { + var memberElement = createClassElement(member, undefined); + if (memberElement) { + memberElements.push(memberElement); } - ] + }); } - ]; + if (symbol.exports) { + symbol.exports.forEach(function (member) { + var memberElement = createClassElement(member, [ts.createToken(115)]); + if (memberElement) { + memberElements.push(memberElement); + } + }); + } + return memberElements; + function shouldConvertDeclaration(_target, source) { + return ts.isFunctionLike(source); + } + function createClassElement(symbol, modifiers) { + if (!(symbol.flags & 4)) { + return; + } + var memberDeclaration = symbol.valueDeclaration; + var assignmentBinaryExpression = memberDeclaration.parent; + if (!shouldConvertDeclaration(memberDeclaration, assignmentBinaryExpression.right)) { + return; + } + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 210 + ? assignmentBinaryExpression.parent : assignmentBinaryExpression; + deleteNode(nodeToDelete); + if (!assignmentBinaryExpression.right) { + return ts.createProperty([], modifiers, symbol.name, undefined, undefined, undefined); + } + switch (assignmentBinaryExpression.right.kind) { + case 186: { + var functionExpression = assignmentBinaryExpression.right; + var method = ts.createMethod(undefined, modifiers, undefined, memberDeclaration.name, undefined, undefined, functionExpression.parameters, undefined, functionExpression.body); + copyComments(assignmentBinaryExpression, method); + return method; + } + case 187: { + var arrowFunction = assignmentBinaryExpression.right; + var arrowFunctionBody = arrowFunction.body; + var bodyBlock = void 0; + if (arrowFunctionBody.kind === 207) { + bodyBlock = arrowFunctionBody; + } + else { + var expression = arrowFunctionBody; + bodyBlock = ts.createBlock([ts.createReturn(expression)]); + } + var method = ts.createMethod(undefined, modifiers, undefined, memberDeclaration.name, undefined, undefined, arrowFunction.parameters, undefined, bodyBlock); + copyComments(assignmentBinaryExpression, method); + return method; + } + default: { + if (ts.isSourceFileJavaScript(sourceFile)) { + return; + } + var prop = ts.createProperty(undefined, modifiers, memberDeclaration.name, undefined, undefined, assignmentBinaryExpression.right); + copyComments(assignmentBinaryExpression.parent, prop); + return prop; + } + } + } + } + function copyComments(sourceNode, targetNode) { + ts.forEachLeadingCommentRange(sourceFile.text, sourceNode.pos, function (pos, end, kind, htnl) { + if (kind === 3) { + pos += 2; + end -= 2; + } + else { + pos += 2; + } + ts.addSyntheticLeadingComment(targetNode, kind, sourceFile.text.slice(pos, end), htnl); + }); + } + function createClassFromVariableDeclaration(node) { + var initializer = node.initializer; + if (!initializer || initializer.kind !== 186) { + return undefined; + } + if (node.name.kind !== 71) { + return undefined; + } + var memberElements = createClassElementsFromSymbol(initializer.symbol); + if (initializer.body) { + memberElements.unshift(ts.createConstructor(undefined, undefined, initializer.parameters, initializer.body)); + } + var cls = ts.createClassDeclaration(undefined, undefined, node.name, undefined, undefined, memberElements); + return cls; + } + function createClassFromFunctionDeclaration(node) { + var memberElements = createClassElementsFromSymbol(ctorSymbol); + if (node.body) { + memberElements.unshift(ts.createConstructor(undefined, undefined, node.parameters, node.body)); + } + var cls = ts.createClassDeclaration(undefined, undefined, node.name, undefined, undefined, memberElements); + return cls; + } } - } - function getEditsForAction(context, action) { - if (actionName !== action) { - return undefined; + })(convertFunctionToES6Class = refactor.convertFunctionToES6Class || (refactor.convertFunctionToES6Class = {})); + })(refactor = ts.refactor || (ts.refactor = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var refactor; + (function (refactor) { + var extractMethod; + (function (extractMethod_1) { + var extractMethod = { + name: "Extract Method", + description: ts.Diagnostics.Extract_function.message, + getAvailableActions: getAvailableActions, + getEditsForAction: getEditsForAction, + }; + refactor.registerRefactor(extractMethod); + function getAvailableActions(context) { + var rangeToExtract = getRangeToExtract(context.file, { start: context.startPosition, length: context.endPosition - context.startPosition }); + var targetRange = rangeToExtract.targetRange; + if (targetRange === undefined) { + return undefined; + } + var extractions = getPossibleExtractions(targetRange, context); + if (extractions === undefined) { + return undefined; + } + var actions = []; + var usedNames = ts.createMap(); + var i = 0; + for (var _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) { + var _a = extractions_1[_i], scopeDescription = _a.scopeDescription, errors = _a.errors; + if (errors.length) { + continue; + } + var description = ts.formatStringFromArgs(ts.Diagnostics.Extract_function_into_0.message, [scopeDescription]); + if (!usedNames.has(description)) { + usedNames.set(description, true); + actions.push({ + description: description, + name: "scope_" + i + }); + } + i++; + } + if (actions.length === 0) { + return undefined; + } + return [{ + name: extractMethod.name, + description: extractMethod.description, + inlineable: true, + actions: actions + }]; } - var start = context.startPosition; - var sourceFile = context.file; - var checker = context.program.getTypeChecker(); - var token = ts.getTokenAtPosition(sourceFile, start, false); - var ctorSymbol = checker.getSymbolAtLocation(token); - var newLine = context.rulesProvider.getFormatOptions().newLineCharacter; - var deletedNodes = []; - var deletes = []; - if (!(ctorSymbol.flags & (16 | 3))) { + function getEditsForAction(context, actionName) { + var length = context.endPosition === undefined ? 0 : context.endPosition - context.startPosition; + var rangeToExtract = getRangeToExtract(context.file, { start: context.startPosition, length: length }); + var targetRange = rangeToExtract.targetRange; + var parsedIndexMatch = /^scope_(\d+)$/.exec(actionName); + ts.Debug.assert(!!parsedIndexMatch, "Scope name should have matched the regexp"); + var index = +parsedIndexMatch[1]; + ts.Debug.assert(isFinite(index), "Expected to parse a finite number from the scope index"); + return getExtractionAtIndex(targetRange, context, index); + } + var Messages; + (function (Messages) { + function createMessage(message) { + return { message: message, code: 0, category: ts.DiagnosticCategory.Message, key: message }; + } + Messages.CannotExtractFunction = createMessage("Cannot extract function."); + Messages.StatementOrExpressionExpected = createMessage("Statement or expression expected."); + Messages.CannotExtractRangeContainingConditionalBreakOrContinueStatements = createMessage("Cannot extract range containing conditional break or continue statements."); + Messages.CannotExtractRangeContainingConditionalReturnStatement = createMessage("Cannot extract range containing conditional return statement."); + Messages.CannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange = createMessage("Cannot extract range containing labeled break or continue with target outside of the range."); + Messages.CannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators = createMessage("Cannot extract range containing writes to references located outside of the target range in generators."); + Messages.TypeWillNotBeVisibleInTheNewScope = createMessage("Type will not visible in the new scope."); + Messages.FunctionWillNotBeVisibleInTheNewScope = createMessage("Function will not visible in the new scope."); + Messages.InsufficientSelection = createMessage("Select more than a single identifier."); + Messages.CannotExtractExportedEntity = createMessage("Cannot extract exported declaration"); + Messages.CannotCombineWritesAndReturns = createMessage("Cannot combine writes and returns"); + Messages.CannotExtractReadonlyPropertyInitializerOutsideConstructor = createMessage("Cannot move initialization of read-only class property outside of the constructor"); + Messages.CannotExtractAmbientBlock = createMessage("Cannot extract code from ambient contexts"); + })(Messages || (Messages = {})); + var RangeFacts; + (function (RangeFacts) { + RangeFacts[RangeFacts["None"] = 0] = "None"; + RangeFacts[RangeFacts["HasReturn"] = 1] = "HasReturn"; + RangeFacts[RangeFacts["IsGenerator"] = 2] = "IsGenerator"; + RangeFacts[RangeFacts["IsAsyncFunction"] = 4] = "IsAsyncFunction"; + RangeFacts[RangeFacts["UsesThis"] = 8] = "UsesThis"; + RangeFacts[RangeFacts["InStaticRegion"] = 16] = "InStaticRegion"; + })(RangeFacts || (RangeFacts = {})); + function getRangeToExtract(sourceFile, span) { + var length = span.length || 0; + if (length === 0) { + return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.StatementOrExpressionExpected)] }; + } + var start = getParentNodeInSpan(ts.getTokenAtPosition(sourceFile, span.start, false), sourceFile, span); + var end = getParentNodeInSpan(ts.findTokenOnLeftOfPosition(sourceFile, ts.textSpanEnd(span)), sourceFile, span); + var declarations = []; + var rangeFacts = RangeFacts.None; + if (!start || !end) { + return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.CannotExtractFunction)] }; + } + if (start.parent !== end.parent) { + var startParent = ts.skipParentheses(start.parent); + var endParent = ts.skipParentheses(end.parent); + if (ts.isBinaryExpression(startParent) && ts.isBinaryExpression(endParent) && ts.isNodeDescendantOf(startParent, endParent)) { + start = end = endParent; + } + else { + return createErrorResult(sourceFile, span.start, length, Messages.CannotExtractFunction); + } + } + if (start !== end) { + if (!isBlockLike(start.parent)) { + return createErrorResult(sourceFile, span.start, length, Messages.CannotExtractFunction); + } + var statements = []; + for (var _i = 0, _a = start.parent.statements; _i < _a.length; _i++) { + var statement = _a[_i]; + if (statement === start || statements.length) { + var errors = checkNode(statement); + if (errors) { + return { errors: errors }; + } + statements.push(statement); + } + if (statement === end) { + break; + } + } + return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations } }; + } + else { + var errors = checkRootNode(start) || checkNode(start); + if (errors) { + return { errors: errors }; + } + return { targetRange: { range: getStatementOrExpressionRange(start), facts: rangeFacts, declarations: declarations } }; + } + function createErrorResult(sourceFile, start, length, message) { + return { errors: [ts.createFileDiagnostic(sourceFile, start, length, message)] }; + } + function checkRootNode(node) { + if (ts.isIdentifier(ts.isExpressionStatement(node) ? node.expression : node)) { + return [ts.createDiagnosticForNode(node, Messages.InsufficientSelection)]; + } + return undefined; + } + function checkForStaticContext(nodeToCheck, containingClass) { + var current = nodeToCheck; + while (current !== containingClass) { + if (current.kind === 149) { + if (ts.hasModifier(current, 32)) { + rangeFacts |= RangeFacts.InStaticRegion; + } + break; + } + else if (current.kind === 146) { + var ctorOrMethod = ts.getContainingFunction(current); + if (ctorOrMethod.kind === 152) { + rangeFacts |= RangeFacts.InStaticRegion; + } + break; + } + else if (current.kind === 151) { + if (ts.hasModifier(current, 32)) { + rangeFacts |= RangeFacts.InStaticRegion; + } + } + current = current.parent; + } + } + function checkNode(nodeToCheck) { + var PermittedJumps; + (function (PermittedJumps) { + PermittedJumps[PermittedJumps["None"] = 0] = "None"; + PermittedJumps[PermittedJumps["Break"] = 1] = "Break"; + PermittedJumps[PermittedJumps["Continue"] = 2] = "Continue"; + PermittedJumps[PermittedJumps["Return"] = 4] = "Return"; + })(PermittedJumps || (PermittedJumps = {})); + if (!ts.isStatement(nodeToCheck) && !(ts.isExpression(nodeToCheck) && isExtractableExpression(nodeToCheck))) { + return [ts.createDiagnosticForNode(nodeToCheck, Messages.StatementOrExpressionExpected)]; + } + if (ts.isInAmbientContext(nodeToCheck)) { + return [ts.createDiagnosticForNode(nodeToCheck, Messages.CannotExtractAmbientBlock)]; + } + var containingClass = ts.getContainingClass(nodeToCheck); + if (containingClass) { + checkForStaticContext(nodeToCheck, containingClass); + } + var errors; + var permittedJumps = 4; + var seenLabels; + visit(nodeToCheck); + return errors; + function visit(node) { + if (errors) { + return true; + } + if (ts.isDeclaration(node)) { + var declaringNode = (node.kind === 226) ? node.parent.parent : node; + if (ts.hasModifier(declaringNode, 1)) { + (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.CannotExtractExportedEntity)); + return true; + } + declarations.push(node.symbol); + } + switch (node.kind) { + case 238: + (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.CannotExtractFunction)); + return true; + case 97: + if (node.parent.kind === 181) { + var containingClass_1 = ts.getContainingClass(node); + if (containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { + (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.CannotExtractFunction)); + return true; + } + } + else { + rangeFacts |= RangeFacts.UsesThis; + } + break; + } + if (!node || ts.isFunctionLike(node) || ts.isClassLike(node)) { + switch (node.kind) { + case 228: + case 229: + if (node.parent.kind === 265 && node.parent.externalModuleIndicator === undefined) { + (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.FunctionWillNotBeVisibleInTheNewScope)); + } + break; + } + return false; + } + var savedPermittedJumps = permittedJumps; + switch (node.kind) { + case 211: + permittedJumps = 0; + break; + case 224: + permittedJumps = 0; + break; + case 207: + if (node.parent && node.parent.kind === 224 && node.finallyBlock === node) { + permittedJumps = 4; + } + break; + case 257: + permittedJumps |= 1; + break; + default: + if (ts.isIterationStatement(node, false)) { + permittedJumps |= 1 | 2; + } + break; + } + switch (node.kind) { + case 169: + case 99: + rangeFacts |= RangeFacts.UsesThis; + break; + case 222: + { + var label = node.label; + (seenLabels || (seenLabels = [])).push(label.escapedText); + ts.forEachChild(node, visit); + seenLabels.pop(); + break; + } + case 218: + case 217: + { + var label = node.label; + if (label) { + if (!ts.contains(seenLabels, label.escapedText)) { + (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.CannotExtractRangeContainingLabeledBreakOrContinueStatementWithTargetOutsideOfTheRange)); + } + } + else { + if (!(permittedJumps & (node.kind === 218 ? 1 : 2))) { + (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.CannotExtractRangeContainingConditionalBreakOrContinueStatements)); + } + } + break; + } + case 191: + rangeFacts |= RangeFacts.IsAsyncFunction; + break; + case 197: + rangeFacts |= RangeFacts.IsGenerator; + break; + case 219: + if (permittedJumps & 4) { + rangeFacts |= RangeFacts.HasReturn; + } + else { + (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.CannotExtractRangeContainingConditionalReturnStatement)); + } + break; + default: + ts.forEachChild(node, visit); + break; + } + permittedJumps = savedPermittedJumps; + } + } + } + extractMethod_1.getRangeToExtract = getRangeToExtract; + function getStatementOrExpressionRange(node) { + if (ts.isStatement(node)) { + return [node]; + } + else if (ts.isPartOfExpression(node)) { + return ts.isExpressionStatement(node.parent) ? [node.parent] : node; + } return undefined; } - var ctorDeclaration = ctorSymbol.valueDeclaration; - var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); - var precedingNode; - var newClassDeclaration; - switch (ctorDeclaration.kind) { - case 228: - precedingNode = ctorDeclaration; - deleteNode(ctorDeclaration); - newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration); - break; - case 226: - precedingNode = ctorDeclaration.parent.parent; - if (ctorDeclaration.parent.declarations.length === 1) { - deleteNode(precedingNode); + function isValidExtractionTarget(node) { + return (node.kind === 228) || ts.isSourceFile(node) || ts.isModuleBlock(node) || ts.isClassLike(node); + } + function collectEnclosingScopes(range) { + var current = isReadonlyArray(range.range) ? ts.firstOrUndefined(range.range) : range.range; + if (range.facts & RangeFacts.UsesThis) { + var containingClass = ts.getContainingClass(current); + if (containingClass) { + return [containingClass]; + } + } + var start = current; + var scopes = undefined; + while (current) { + if (current !== start && isValidExtractionTarget(current)) { + (scopes = scopes || []).push(current); + } + if (current && current.parent && current.parent.kind === 146) { + current = ts.findAncestor(current, function (parent) { return ts.isFunctionLike(parent); }).parent; } else { - deleteNode(ctorDeclaration, true); + current = current.parent; } - newClassDeclaration = createClassFromVariableDeclaration(ctorDeclaration); - break; + } + return scopes; } - if (!newClassDeclaration) { - return undefined; + function getExtractionAtIndex(targetRange, context, requestedChangesIndex) { + var _a = getPossibleExtractionsWorker(targetRange, context), scopes = _a.scopes, _b = _a.readsAndWrites, target = _b.target, usagesPerScope = _b.usagesPerScope, errorsPerScope = _b.errorsPerScope; + ts.Debug.assert(!errorsPerScope[requestedChangesIndex].length, "The extraction went missing? How?"); + context.cancellationToken.throwIfCancellationRequested(); + return extractFunctionInScope(target, scopes[requestedChangesIndex], usagesPerScope[requestedChangesIndex], targetRange, context); } - changeTracker.insertNodeAfter(sourceFile, precedingNode, newClassDeclaration, { suffix: newLine }); - for (var _i = 0, deletes_1 = deletes; _i < deletes_1.length; _i++) { - var deleteCallback = deletes_1[_i]; - deleteCallback(); + extractMethod_1.getExtractionAtIndex = getExtractionAtIndex; + function getPossibleExtractions(targetRange, context) { + var extractions = getPossibleExtractionsWorker(targetRange, context); + return extractions && extractions.scopes.map(function (scope, i) { + return ({ scopeDescription: getDescriptionForScope(scope), errors: extractions.readsAndWrites.errorsPerScope[i] }); + }); } - return { - edits: changeTracker.getChanges() - }; - function deleteNode(node, inList) { - if (inList === void 0) { inList = false; } - if (deletedNodes.some(function (n) { return ts.isNodeDescendantOf(node, n); })) { - return; + extractMethod_1.getPossibleExtractions = getPossibleExtractions; + function getPossibleExtractionsWorker(targetRange, context) { + var sourceFile = context.file; + if (targetRange === undefined) { + return undefined; } - deletedNodes.push(node); - if (inList) { - deletes.push(function () { return changeTracker.deleteNodeInList(sourceFile, node); }); + var scopes = collectEnclosingScopes(targetRange); + if (scopes === undefined) { + return undefined; + } + var enclosingTextRange = getEnclosingTextRange(targetRange, sourceFile); + var readsAndWrites = collectReadsAndWrites(targetRange, scopes, enclosingTextRange, sourceFile, context.program.getTypeChecker()); + return { scopes: scopes, readsAndWrites: readsAndWrites }; + } + function getDescriptionForScope(scope) { + if (ts.isFunctionLike(scope)) { + switch (scope.kind) { + case 152: + return "constructor"; + case 186: + return scope.name + ? "function expression " + scope.name.text + : "anonymous function expression"; + case 228: + return "function '" + scope.name.text + "'"; + case 187: + return "arrow function"; + case 151: + return "method '" + scope.name.getText(); + case 153: + return "'get " + scope.name.getText() + "'"; + case 154: + return "'set " + scope.name.getText() + "'"; + } + } + else if (ts.isModuleBlock(scope)) { + return "namespace '" + scope.parent.name.getText() + "'"; + } + else if (ts.isClassLike(scope)) { + return scope.kind === 229 + ? "class '" + scope.name.text + "'" + : scope.name && scope.name.text + ? "class expression '" + scope.name.text + "'" + : "anonymous class expression"; + } + else if (ts.isSourceFile(scope)) { + return scope.externalModuleIndicator ? "module scope" : "global scope"; } else { - deletes.push(function () { return changeTracker.deleteNode(sourceFile, node); }); + return "unknown"; + } + } + function getUniqueName(fileText) { + var functionNameText = "newFunction"; + for (var i = 1; fileText.indexOf(functionNameText) !== -1; i++) { + functionNameText = "newFunction_" + i; } + return functionNameText; } - function createClassElementsFromSymbol(symbol) { - var memberElements = []; - if (symbol.members) { - symbol.members.forEach(function (member) { - var memberElement = createClassElement(member, undefined); - if (memberElement) { - memberElements.push(memberElement); + function extractFunctionInScope(node, scope, _a, range, context) { + var usagesInScope = _a.usages, substitutions = _a.substitutions; + var checker = context.program.getTypeChecker(); + var file = scope.getSourceFile(); + var functionNameText = getUniqueName(file.text); + var isJS = ts.isInJavaScriptFile(scope); + var functionName = ts.createIdentifier(functionNameText); + var returnType = undefined; + var parameters = []; + var callArguments = []; + var writes; + usagesInScope.forEach(function (usage, name) { + var typeNode = undefined; + if (!isJS) { + var type = checker.getTypeOfSymbolAtLocation(usage.symbol, usage.node); + type = checker.getBaseTypeOfLiteralType(type); + typeNode = checker.typeToTypeNode(type, node, ts.NodeBuilderFlags.NoTruncation); + } + var paramDecl = ts.createParameter(undefined, undefined, undefined, name, undefined, typeNode); + parameters.push(paramDecl); + if (usage.usage === 2) { + (writes || (writes = [])).push(usage); + } + callArguments.push(ts.createIdentifier(name)); + }); + if (ts.isExpression(node) && !isJS) { + var contextualType = checker.getContextualType(node); + returnType = checker.typeToTypeNode(contextualType); + } + var _b = transformFunctionBody(node, writes, substitutions, !!(range.facts & RangeFacts.HasReturn)), body = _b.body, returnValueProperty = _b.returnValueProperty; + var newFunction; + if (ts.isClassLike(scope)) { + var modifiers = isJS ? [] : [ts.createToken(112)]; + if (range.facts & RangeFacts.InStaticRegion) { + modifiers.push(ts.createToken(115)); + } + if (range.facts & RangeFacts.IsAsyncFunction) { + modifiers.push(ts.createToken(120)); + } + newFunction = ts.createMethod(undefined, modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(39) : undefined, functionName, undefined, undefined, parameters, returnType, body); + } + else { + newFunction = ts.createFunctionDeclaration(undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(120)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(39) : undefined, functionName, undefined, parameters, returnType, body); + } + var changeTracker = ts.textChanges.ChangeTracker.fromCodeFixContext(context); + var minInsertionPos = (isReadonlyArray(range.range) ? ts.lastOrUndefined(range.range) : range.range).end; + var nodeToInsertBefore = getNodeToInsertBefore(minInsertionPos, scope); + if (nodeToInsertBefore) { + changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newFunction, { suffix: context.newLineCharacter + context.newLineCharacter }); + } + else { + changeTracker.insertNodeBefore(context.file, scope.getLastToken(), newFunction, { prefix: context.newLineCharacter, suffix: context.newLineCharacter }); + } + var newNodes = []; + var called = getCalledExpression(scope, range, functionNameText); + var call = ts.createCall(called, undefined, callArguments); + if (range.facts & RangeFacts.IsGenerator) { + call = ts.createYield(ts.createToken(39), call); + } + if (range.facts & RangeFacts.IsAsyncFunction) { + call = ts.createAwait(call); + } + if (writes) { + if (returnValueProperty) { + newNodes.push(ts.createVariableStatement(undefined, [ts.createVariableDeclaration(returnValueProperty, ts.createKeywordTypeNode(119))])); + } + var assignments = getPropertyAssignmentsForWrites(writes); + if (returnValueProperty) { + assignments.unshift(ts.createShorthandPropertyAssignment(returnValueProperty)); + } + if (assignments.length === 1) { + if (returnValueProperty) { + newNodes.push(ts.createReturn(ts.createIdentifier(returnValueProperty))); + } + else { + newNodes.push(ts.createStatement(ts.createBinary(assignments[0].name, 58, call))); + if (range.facts & RangeFacts.HasReturn) { + newNodes.push(ts.createReturn()); + } + } + } + else { + newNodes.push(ts.createStatement(ts.createBinary(ts.createObjectLiteral(assignments), 58, call))); + if (returnValueProperty) { + newNodes.push(ts.createReturn(ts.createIdentifier(returnValueProperty))); } + } + } + else { + if (range.facts & RangeFacts.HasReturn) { + newNodes.push(ts.createReturn(call)); + } + else if (isReadonlyArray(range.range)) { + newNodes.push(ts.createStatement(call)); + } + else { + newNodes.push(call); + } + } + if (isReadonlyArray(range.range)) { + changeTracker.replaceNodesWithNodes(context.file, range.range, newNodes, { + nodeSeparator: context.newLineCharacter, + suffix: context.newLineCharacter }); } - if (symbol.exports) { - symbol.exports.forEach(function (member) { - var memberElement = createClassElement(member, [ts.createToken(115)]); - if (memberElement) { - memberElements.push(memberElement); + else { + changeTracker.replaceNodeWithNodes(context.file, range.range, newNodes, { nodeSeparator: context.newLineCharacter }); + } + var edits = changeTracker.getChanges(); + var renameRange = isReadonlyArray(range.range) ? range.range[0] : range.range; + var renameFilename = renameRange.getSourceFile().fileName; + var renameLocation = getRenameLocation(edits, renameFilename, functionNameText); + return { renameFilename: renameFilename, renameLocation: renameLocation, edits: edits }; + function getStatementsOrClassElements(scope) { + if (ts.isFunctionLike(scope)) { + var body_1 = scope.body; + if (ts.isBlock(body_1)) { + return body_1.statements; + } + } + else if (ts.isModuleBlock(scope) || ts.isSourceFile(scope)) { + return scope.statements; + } + else if (ts.isClassLike(scope)) { + return scope.members; + } + else { + ts.assertTypeIsNever(scope); + } + return ts.emptyArray; + } + function getNodeToInsertBefore(minPos, scope) { + var children = getStatementsOrClassElements(scope); + for (var _i = 0, children_3 = children; _i < children_3.length; _i++) { + var child = children_3[_i]; + if (child.pos >= minPos && ts.isFunctionLike(child) && !ts.isConstructorDeclaration(child)) { + return child; + } + } + } + } + function getRenameLocation(edits, renameFilename, functionNameText) { + var delta = 0; + for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) { + var _a = edits_1[_i], fileName = _a.fileName, textChanges_1 = _a.textChanges; + ts.Debug.assert(fileName === renameFilename); + for (var _b = 0, textChanges_2 = textChanges_1; _b < textChanges_2.length; _b++) { + var change = textChanges_2[_b]; + var span_17 = change.span, newText = change.newText; + var index = newText.indexOf(functionNameText); + if (index !== -1) { + return span_17.start + delta + index; + } + delta += newText.length - span_17.length; + } + } + throw new Error(); + } + function getCalledExpression(scope, range, functionNameText) { + var functionReference = ts.createIdentifier(functionNameText); + if (ts.isClassLike(scope)) { + var lhs = range.facts & RangeFacts.InStaticRegion ? ts.createIdentifier(scope.name.text) : ts.createThis(); + return ts.createPropertyAccess(lhs, functionReference); + } + else { + return functionReference; + } + } + function transformFunctionBody(body, writes, substitutions, hasReturn) { + if (ts.isBlock(body) && !writes && substitutions.size === 0) { + return { body: ts.createBlock(body.statements, true), returnValueProperty: undefined }; + } + var returnValueProperty; + var ignoreReturns = false; + var statements = ts.createNodeArray(ts.isBlock(body) ? body.statements.slice(0) : [ts.isStatement(body) ? body : ts.createReturn(body)]); + if (writes || substitutions.size) { + var rewrittenStatements = ts.visitNodes(statements, visitor).slice(); + if (writes && !hasReturn && ts.isStatement(body)) { + var assignments = getPropertyAssignmentsForWrites(writes); + if (assignments.length === 1) { + rewrittenStatements.push(ts.createReturn(assignments[0].name)); + } + else { + rewrittenStatements.push(ts.createReturn(ts.createObjectLiteral(assignments))); + } + } + return { body: ts.createBlock(rewrittenStatements, true), returnValueProperty: returnValueProperty }; + } + else { + return { body: ts.createBlock(statements, true), returnValueProperty: undefined }; + } + function visitor(node) { + if (!ignoreReturns && node.kind === 219 && writes) { + var assignments = getPropertyAssignmentsForWrites(writes); + if (node.expression) { + if (!returnValueProperty) { + returnValueProperty = "__return"; + } + assignments.unshift(ts.createPropertyAssignment(returnValueProperty, ts.visitNode(node.expression, visitor))); + } + if (assignments.length === 1) { + return ts.createReturn(assignments[0].name); + } + else { + return ts.createReturn(ts.createObjectLiteral(assignments)); + } + } + else { + var oldIgnoreReturns = ignoreReturns; + ignoreReturns = ignoreReturns || ts.isFunctionLike(node) || ts.isClassLike(node); + var substitution = substitutions.get(ts.getNodeId(node).toString()); + var result = substitution || ts.visitEachChild(node, visitor, ts.nullTransformationContext); + ignoreReturns = oldIgnoreReturns; + return result; + } + } + } + function getPropertyAssignmentsForWrites(writes) { + return writes.map(function (w) { return ts.createShorthandPropertyAssignment(w.symbol.name); }); + } + function isReadonlyArray(v) { + return ts.isArray(v); + } + function getEnclosingTextRange(targetRange, sourceFile) { + return isReadonlyArray(targetRange.range) + ? { pos: targetRange.range[0].getStart(sourceFile), end: targetRange.range[targetRange.range.length - 1].getEnd() } + : targetRange.range; + } + var Usage; + (function (Usage) { + Usage[Usage["Read"] = 1] = "Read"; + Usage[Usage["Write"] = 2] = "Write"; + })(Usage || (Usage = {})); + function collectReadsAndWrites(targetRange, scopes, enclosingTextRange, sourceFile, checker) { + var usagesPerScope = []; + var substitutionsPerScope = []; + var errorsPerScope = []; + var visibleDeclarationsInExtractedRange = []; + for (var _i = 0, scopes_1 = scopes; _i < scopes_1.length; _i++) { + var _ = scopes_1[_i]; + usagesPerScope.push({ usages: ts.createMap(), substitutions: ts.createMap() }); + substitutionsPerScope.push(ts.createMap()); + errorsPerScope.push([]); + } + var seenUsages = ts.createMap(); + var target = isReadonlyArray(targetRange.range) ? ts.createBlock(targetRange.range) : targetRange.range; + var containingLexicalScopeOfExtraction = ts.isBlockScope(scopes[0], scopes[0].parent) ? scopes[0] : ts.getEnclosingBlockScopeContainer(scopes[0]); + collectUsages(target); + var _loop_8 = function (i) { + var hasWrite = false; + var readonlyClassPropertyWrite = undefined; + usagesPerScope[i].usages.forEach(function (value) { + if (value.usage === 2) { + hasWrite = true; + if (value.symbol.flags & 106500 && + value.symbol.valueDeclaration && + ts.hasModifier(value.symbol.valueDeclaration, 64)) { + readonlyClassPropertyWrite = value.symbol.valueDeclaration; + } } }); + if (hasWrite && !isReadonlyArray(targetRange.range) && ts.isExpression(targetRange.range)) { + errorsPerScope[i].push(ts.createDiagnosticForNode(targetRange.range, Messages.CannotCombineWritesAndReturns)); + } + else if (readonlyClassPropertyWrite && i > 0) { + errorsPerScope[i].push(ts.createDiagnosticForNode(readonlyClassPropertyWrite, Messages.CannotCombineWritesAndReturns)); + } + }; + for (var i = 0; i < scopes.length; i++) { + _loop_8(i); } - return memberElements; - function shouldConvertDeclaration(_target, source) { - return ts.isFunctionLike(source); + if (visibleDeclarationsInExtractedRange.length) { + ts.forEachChild(containingLexicalScopeOfExtraction, checkForUsedDeclarations); } - function createClassElement(symbol, modifiers) { - if (!(symbol.flags & 4)) { - return; + return { target: target, usagesPerScope: usagesPerScope, errorsPerScope: errorsPerScope }; + function collectUsages(node, valueUsage) { + if (valueUsage === void 0) { valueUsage = 1; } + if (ts.isDeclaration(node) && node.symbol) { + visibleDeclarationsInExtractedRange.push(node.symbol); } - var memberDeclaration = symbol.valueDeclaration; - var assignmentBinaryExpression = memberDeclaration.parent; - if (!shouldConvertDeclaration(memberDeclaration, assignmentBinaryExpression.right)) { - return; + if (ts.isAssignmentExpression(node)) { + collectUsages(node.left, 2); + collectUsages(node.right); } - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 210 - ? assignmentBinaryExpression.parent : assignmentBinaryExpression; - deleteNode(nodeToDelete); - if (!assignmentBinaryExpression.right) { - return ts.createProperty([], modifiers, symbol.name, undefined, undefined, undefined); + else if (ts.isUnaryExpressionWithWrite(node)) { + collectUsages(node.operand, 2); } - switch (assignmentBinaryExpression.right.kind) { - case 186: - var functionExpression = assignmentBinaryExpression.right; - return ts.createMethod(undefined, modifiers, undefined, memberDeclaration.name, undefined, undefined, functionExpression.parameters, undefined, functionExpression.body); - case 187: - var arrowFunction = assignmentBinaryExpression.right; - var arrowFunctionBody = arrowFunction.body; - var bodyBlock = void 0; - if (arrowFunctionBody.kind === 207) { - bodyBlock = arrowFunctionBody; + else if (ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node)) { + ts.forEachChild(node, collectUsages); + } + else if (ts.isIdentifier(node)) { + if (!node.parent) { + return; + } + if (ts.isQualifiedName(node.parent) && node !== node.parent.left) { + return; + } + if (ts.isPropertyAccessExpression(node.parent) && node !== node.parent.expression) { + return; + } + recordUsage(node, valueUsage, ts.isPartOfTypeNode(node)); + } + else { + ts.forEachChild(node, collectUsages); + } + } + function recordUsage(n, usage, isTypeNode) { + var symbolId = recordUsagebySymbol(n, usage, isTypeNode); + if (symbolId) { + for (var i = 0; i < scopes.length; i++) { + var substitition = substitutionsPerScope[i].get(symbolId); + if (substitition) { + usagesPerScope[i].substitutions.set(ts.getNodeId(n).toString(), substitition); } - else { - var expression = arrowFunctionBody; - bodyBlock = ts.createBlock([ts.createReturn(expression)]); + } + } + } + function recordUsagebySymbol(identifier, usage, isTypeName) { + var symbol = identifier.parent && ts.isShorthandPropertyAssignment(identifier.parent) && identifier.parent.name === identifier + ? checker.getShorthandAssignmentValueSymbol(identifier.parent) + : checker.getSymbolAtLocation(identifier); + if (!symbol) { + return undefined; + } + var symbolId = ts.getSymbolId(symbol).toString(); + var lastUsage = seenUsages.get(symbolId); + if (lastUsage && lastUsage >= usage) { + return symbolId; + } + seenUsages.set(symbolId, usage); + if (lastUsage) { + for (var _i = 0, usagesPerScope_1 = usagesPerScope; _i < usagesPerScope_1.length; _i++) { + var perScope = usagesPerScope_1[_i]; + var prevEntry = perScope.usages.get(identifier.text); + if (prevEntry) { + perScope.usages.set(identifier.text, { usage: usage, symbol: symbol, node: identifier }); } - return ts.createMethod(undefined, modifiers, undefined, memberDeclaration.name, undefined, undefined, arrowFunction.parameters, undefined, bodyBlock); - default: - if (ts.isSourceFileJavaScript(sourceFile)) { - return; + } + return symbolId; + } + var declInFile = ts.find(symbol.getDeclarations(), function (d) { return d.getSourceFile() === sourceFile; }); + if (!declInFile) { + return undefined; + } + if (ts.rangeContainsStartEnd(enclosingTextRange, declInFile.getStart(), declInFile.end)) { + return undefined; + } + if (targetRange.facts & RangeFacts.IsGenerator && usage === 2) { + for (var _a = 0, errorsPerScope_1 = errorsPerScope; _a < errorsPerScope_1.length; _a++) { + var errors = errorsPerScope_1[_a]; + errors.push(ts.createDiagnosticForNode(identifier, Messages.CannotExtractRangeThatContainsWritesToReferencesLocatedOutsideOfTheTargetRangeInGenerators)); + } + } + for (var i = 0; i < scopes.length; i++) { + var scope = scopes[i]; + var resolvedSymbol = checker.resolveName(symbol.name, scope, symbol.flags); + if (resolvedSymbol === symbol) { + continue; + } + if (!substitutionsPerScope[i].has(symbolId)) { + var substitution = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.exportSymbol || symbol, scope, isTypeName); + if (substitution) { + substitutionsPerScope[i].set(symbolId, substitution); + } + else if (isTypeName) { + errorsPerScope[i].push(ts.createDiagnosticForNode(identifier, Messages.TypeWillNotBeVisibleInTheNewScope)); } - return ts.createProperty(undefined, modifiers, memberDeclaration.name, undefined, undefined, assignmentBinaryExpression.right); + else { + usagesPerScope[i].usages.set(identifier.text, { usage: usage, symbol: symbol, node: identifier }); + } + } } + return symbolId; + } + function checkForUsedDeclarations(node) { + if (node === targetRange.range || (isReadonlyArray(targetRange.range) && targetRange.range.indexOf(node) >= 0)) { + return; + } + var sym = checker.getSymbolAtLocation(node); + if (sym && visibleDeclarationsInExtractedRange.some(function (d) { return d === sym; })) { + for (var _i = 0, errorsPerScope_2 = errorsPerScope; _i < errorsPerScope_2.length; _i++) { + var scope = errorsPerScope_2[_i]; + scope.push(ts.createDiagnosticForNode(node, Messages.CannotExtractExportedEntity)); + } + return true; + } + else { + ts.forEachChild(node, checkForUsedDeclarations); + } + } + function tryReplaceWithQualifiedNameOrPropertyAccess(symbol, scopeDecl, isTypeNode) { + if (!symbol) { + return undefined; + } + if (symbol.getDeclarations().some(function (d) { return d.parent === scopeDecl; })) { + return ts.createIdentifier(symbol.name); + } + var prefix = tryReplaceWithQualifiedNameOrPropertyAccess(symbol.parent, scopeDecl, isTypeNode); + if (prefix === undefined) { + return undefined; + } + return isTypeNode ? ts.createQualifiedName(prefix, ts.createIdentifier(symbol.name)) : ts.createPropertyAccess(prefix, symbol.name); } } - function createClassFromVariableDeclaration(node) { - var initializer = node.initializer; - if (!initializer || initializer.kind !== 186) { + function getParentNodeInSpan(node, file, span) { + if (!node) return undefined; + while (node.parent) { + if (ts.isSourceFile(node.parent) || !spanContainsNode(span, node.parent, file)) { + return node; + } + node = node.parent; } - if (node.name.kind !== 71) { - return undefined; + } + function spanContainsNode(span, node, file) { + return ts.textSpanContainsPosition(span, node.getStart(file)) && + node.getEnd() <= ts.textSpanEnd(span); + } + function isExtractableExpression(node) { + switch (node.parent.kind) { + case 264: + return false; } - var memberElements = createClassElementsFromSymbol(initializer.symbol); - if (initializer.body) { - memberElements.unshift(ts.createConstructor(undefined, undefined, initializer.parameters, initializer.body)); + switch (node.kind) { + case 9: + return node.parent.kind !== 238 && + node.parent.kind !== 242; + case 198: + case 174: + case 176: + return false; + case 71: + return node.parent.kind !== 176 && + node.parent.kind !== 242 && + node.parent.kind !== 246; } - return ts.createClassDeclaration(undefined, undefined, node.name, undefined, undefined, memberElements); + return true; } - function createClassFromFunctionDeclaration(node) { - var memberElements = createClassElementsFromSymbol(ctorSymbol); - if (node.body) { - memberElements.unshift(ts.createConstructor(undefined, undefined, node.parameters, node.body)); + function isBlockLike(node) { + switch (node.kind) { + case 207: + case 265: + case 234: + case 257: + return true; + default: + return false; } - return ts.createClassDeclaration(undefined, undefined, node.name, undefined, undefined, memberElements); } - } + })(extractMethod = refactor.extractMethod || (refactor.extractMethod = {})); })(refactor = ts.refactor || (ts.refactor = {})); })(ts || (ts = {})); var ts; @@ -73491,7 +75463,7 @@ var ts; return pos; }; NodeObject.prototype.createSyntaxList = function (nodes) { - var list = createNode(295, nodes.pos, nodes.end, this); + var list = createNode(286, nodes.pos, nodes.end, this); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_9 = nodes; _i < nodes_9.length; _i++) { @@ -73514,9 +75486,9 @@ var ts; return; } if (ts.isJSDocCommentContainingNode(this)) { - var children_3 = []; - this.forEachChild(function (child) { children_3.push(child); }); - this._children = children_3; + var children_4 = []; + this.forEachChild(function (child) { children_4.push(child); }); + this._children = children_4; return; } var children = []; @@ -73568,7 +75540,7 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 267 || kid.kind > 294; }); + var child = ts.find(children, function (kid) { return kid.kind < 267 || kid.kind > 285; }); return child.kind < 143 ? child : child.getFirstToken(sourceFile); @@ -73643,11 +75615,21 @@ var ts; var SymbolObject = (function () { function SymbolObject(flags, name) { this.flags = flags; - this.name = name; + this.escapedName = name; } SymbolObject.prototype.getFlags = function () { return this.flags; }; + Object.defineProperty(SymbolObject.prototype, "name", { + get: function () { + return ts.unescapeLeadingUnderscores(this.escapedName); + }, + enumerable: true, + configurable: true + }); + SymbolObject.prototype.getEscapedName = function () { + return this.escapedName; + }; SymbolObject.prototype.getName = function () { return this.name; }; @@ -73682,6 +75664,13 @@ var ts; function IdentifierObject(_kind, pos, end) { return _super.call(this, pos, end) || this; } + Object.defineProperty(IdentifierObject.prototype, "text", { + get: function () { + return ts.unescapeLeadingUnderscores(this.escapedText); + }, + enumerable: true, + configurable: true + }); return IdentifierObject; }(TokenOrIdentifierObject)); IdentifierObject.prototype.kind = 71; @@ -73813,26 +75802,16 @@ var ts; function getDeclarationName(declaration) { var name = ts.getNameOfDeclaration(declaration); if (name) { - var result_8 = getTextOfIdentifierOrLiteral(name); - if (result_8 !== undefined) { - return result_8; + var result_9 = ts.getTextOfIdentifierOrLiteral(name); + if (result_9 !== undefined) { + return result_9; } if (name.kind === 144) { var expr = name.expression; if (expr.kind === 179) { return expr.name.text; } - return getTextOfIdentifierOrLiteral(expr); - } - } - return undefined; - } - function getTextOfIdentifierOrLiteral(node) { - if (node) { - if (node.kind === 71 || - node.kind === 9 || - node.kind === 8) { - return node.text; + return ts.getTextOfIdentifierOrLiteral(expr); } } return undefined; @@ -73868,7 +75847,6 @@ var ts; case 237: case 246: case 242: - case 237: case 239: case 240: case 153: @@ -73994,7 +75972,7 @@ var ts; function HostCache(host, getCanonicalFileName) { this.host = host; this.currentDirectory = host.getCurrentDirectory(); - this.fileNameToEntry = ts.createFileMap(); + this.fileNameToEntry = ts.createMap(); var rootFileNames = host.getScriptFileNames(); for (var _i = 0, rootFileNames_1 = rootFileNames; _i < rootFileNames_1.length; _i++) { var fileName = rootFileNames_1[_i]; @@ -74023,7 +76001,7 @@ var ts; return this.fileNameToEntry.get(path); }; HostCache.prototype.containsEntryByPath = function (path) { - return this.fileNameToEntry.contains(path); + return this.fileNameToEntry.has(path); }; HostCache.prototype.getOrCreateEntryByPath = function (fileName, path) { return this.containsEntryByPath(path) @@ -74032,7 +76010,7 @@ var ts; }; HostCache.prototype.getRootFileNames = function () { var fileNames = []; - this.fileNameToEntry.forEachValue(function (_path, value) { + this.fileNameToEntry.forEach(function (value) { if (value) { fileNames.push(value.hostFileName); } @@ -74275,8 +76253,8 @@ var ts; if (program) { var oldSourceFiles = program.getSourceFiles(); var oldSettingsKey = documentRegistry.getKeyForCompilationSettings(oldSettings); - for (var _i = 0, oldSourceFiles_1 = oldSourceFiles; _i < oldSourceFiles_1.length; _i++) { - var oldSourceFile = oldSourceFiles_1[_i]; + for (var _i = 0, oldSourceFiles_2 = oldSourceFiles; _i < oldSourceFiles_2.length; _i++) { + var oldSourceFile = oldSourceFiles_2[_i]; if (!newProgram.getSourceFile(oldSourceFile.fileName) || shouldCreateNewSourceFiles) { documentRegistry.releaseDocumentWithKey(oldSourceFile.path, oldSettingsKey); } @@ -74298,7 +76276,7 @@ var ts; if (!shouldCreateNewSourceFiles) { var oldSourceFile = program && program.getSourceFileByPath(path); if (oldSourceFile) { - ts.Debug.assert(hostFileInformation.scriptKind === oldSourceFile.scriptKind, "Registered script kind (" + oldSourceFile.scriptKind + ") should match new script kind (" + hostFileInformation.scriptKind + ") for file: " + path); + ts.Debug.assertEqual(hostFileInformation.scriptKind, oldSourceFile.scriptKind, "Registered script kind should match new script kind.", path); return documentRegistry.updateDocumentWithKey(fileName, path, newSettings, documentRegistryBucketKey, hostFileInformation.scriptSnapshot, hostFileInformation.version, hostFileInformation.scriptKind); } } @@ -74325,7 +76303,15 @@ var ts; return false; } } - return ts.compareDataObjects(program.getCompilerOptions(), hostCache.compilationSettings()); + var currentOptions = program.getCompilerOptions(); + var newOptions = hostCache.compilationSettings(); + if (!ts.compareDataObjects(currentOptions, newOptions)) { + return false; + } + if (currentOptions.configFile && newOptions.configFile) { + return currentOptions.configFile.text === newOptions.configFile.text; + } + return true; } } function getProgram() { @@ -74397,8 +76383,8 @@ var ts; var type = typeChecker.getTypeAtLocation(node); if (type) { return { - kind: ts.ScriptElementKind.unknown, - kindModifiers: ts.ScriptElementKindModifier.none, + kind: "", + kindModifiers: "", textSpan: ts.createTextSpan(node.getStart(), node.getWidth()), displayParts: ts.typeToDisplayParts(typeChecker, type, ts.getContainerNode(node)), documentation: type.symbol ? type.symbol.getDocumentationComment() : undefined, @@ -74458,7 +76444,7 @@ var ts; result.push({ fileName: entry.fileName, textSpan: highlightSpan.textSpan, - isWriteAccess: highlightSpan.kind === ts.HighlightSpanKind.writtenReference, + isWriteAccess: highlightSpan.kind === "writtenReference", isDefinition: false, isInString: highlightSpan.isInString, }); @@ -74490,12 +76476,8 @@ var ts; synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var outputFiles = []; - function writeFile(fileName, data, writeByteOrderMark) { - outputFiles.push({ - name: fileName, - writeByteOrderMark: writeByteOrderMark, - text: data - }); + function writeFile(fileName, text, writeByteOrderMark) { + outputFiles.push({ name: fileName, writeByteOrderMark: writeByteOrderMark, text: text }); } var customTransformers = host.getCustomTransformers && host.getCustomTransformers(); var emitOutput = program.emit(sourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers); @@ -74657,7 +76639,10 @@ var ts; function getFormattingEditsAfterKeystroke(fileName, position, key, options) { var sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); var settings = toEditorSettings(options); - if (key === "}") { + if (key === "{") { + return ts.formatting.formatOnOpeningCurly(position, sourceFile, getRuleProvider(settings), settings); + } + else if (key === "}") { return ts.formatting.formatOnClosingCurly(position, sourceFile, getRuleProvider(settings), settings); } else if (key === ";") { @@ -74671,27 +76656,13 @@ var ts; function getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions) { synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); - var span = { start: start, length: end - start }; - var newLineChar = ts.getNewLineOrDefaultFromHost(host); - var allFixes = []; - ts.forEach(ts.deduplicate(errorCodes), function (error) { + var span = ts.createTextSpanFromBounds(start, end); + var newLineCharacter = ts.getNewLineOrDefaultFromHost(host); + var rulesProvider = getRuleProvider(formatOptions); + return ts.flatMap(ts.deduplicate(errorCodes), function (errorCode) { cancellationToken.throwIfCancellationRequested(); - var context = { - errorCode: error, - sourceFile: sourceFile, - span: span, - program: program, - newLineCharacter: newLineChar, - host: host, - cancellationToken: cancellationToken, - rulesProvider: getRuleProvider(formatOptions) - }; - var fixes = ts.codefix.getFixes(context); - if (fixes) { - allFixes = allFixes.concat(fixes); - } + return ts.codefix.getFixes({ errorCode: errorCode, sourceFile: sourceFile, span: span, program: program, newLineCharacter: newLineCharacter, host: host, cancellationToken: cancellationToken, rulesProvider: rulesProvider }); }); - return allFixes; } function getDocCommentTemplateAtPosition(fileName, position) { return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position); @@ -74710,6 +76681,12 @@ var ts; if (ts.isInTemplateString(sourceFile, position)) { return false; } + switch (openingBrace) { + case 39: + case 34: + case 96: + return !ts.isInComment(sourceFile, position); + } return true; } function getTodoComments(fileName, descriptors) { @@ -74718,7 +76695,7 @@ var ts; cancellationToken.throwIfCancellationRequested(); var fileContents = sourceFile.text; var result = []; - if (descriptors.length > 0) { + if (descriptors.length > 0 && !isNodeModulesFile(sourceFile.fileName)) { var regExp = getTodoCommentsRegExp(); var matchArray = void 0; while (matchArray = regExp.exec(fileContents)) { @@ -74741,11 +76718,7 @@ var ts; continue; } var message = matchArray[2]; - result.push({ - descriptor: descriptor, - message: message, - position: matchPosition - }); + result.push({ descriptor: descriptor, message: message, position: matchPosition }); } } return result; @@ -74769,6 +76742,10 @@ var ts; (char >= 65 && char <= 90) || (char >= 48 && char <= 57); } + function isNodeModulesFile(path) { + var node_modulesFolderName = "/node_modules/"; + return path.indexOf(node_modulesFolderName) !== -1; + } } function getRenameInfo(fileName, position) { synchronizeHostData(); @@ -74853,36 +76830,26 @@ var ts; } ts.getNameTable = getNameTable; function initializeNameTable(sourceFile) { - var nameTable = ts.createMap(); - walk(sourceFile); - sourceFile.nameTable = nameTable; - function walk(node) { - switch (node.kind) { - case 71: - setNameTable(node.text, node); - break; - case 9: - case 8: - if (ts.isDeclarationName(node) || - node.parent.kind === 248 || - isArgumentOfElementAccessExpression(node) || - ts.isLiteralComputedPropertyDeclarationName(node)) { - setNameTable(node.text, node); - } - break; - default: - ts.forEachChild(node, walk); - if (node.jsDoc) { - for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { - var jsDoc = _a[_i]; - ts.forEachChild(jsDoc, walk); - } - } + var nameTable = sourceFile.nameTable = ts.createUnderscoreEscapedMap(); + sourceFile.forEachChild(function walk(node) { + if (ts.isIdentifier(node) && node.escapedText || ts.isStringOrNumericLiteral(node) && literalIsName(node)) { + var text = ts.getEscapedTextOfIdentifierOrLiteral(node); + nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); } - } - function setNameTable(text, node) { - nameTable.set(text, nameTable.get(text) === undefined ? node.pos : -1); - } + ts.forEachChild(node, walk); + if (node.jsDoc) { + for (var _i = 0, _a = node.jsDoc; _i < _a.length; _i++) { + var jsDoc = _a[_i]; + ts.forEachChild(jsDoc, walk); + } + } + }); + } + function literalIsName(node) { + return ts.isDeclarationName(node) || + node.parent.kind === 248 || + isArgumentOfElementAccessExpression(node) || + ts.isLiteralComputedPropertyDeclarationName(node); } function isObjectLiteralElement(node) { switch (node.kind) { @@ -74915,27 +76882,31 @@ var ts; function getPropertySymbolsFromContextualType(typeChecker, node) { var objectLiteral = node.parent; var contextualType = typeChecker.getContextualType(objectLiteral); - var name = ts.getTextOfPropertyName(node.name); - if (name && contextualType) { - var result_9 = []; - var symbol = contextualType.getProperty(name); - if (contextualType.flags & 65536) { - ts.forEach(contextualType.types, function (t) { + return getPropertySymbolsFromType(contextualType, node.name); + } + ts.getPropertySymbolsFromContextualType = getPropertySymbolsFromContextualType; + function getPropertySymbolsFromType(type, propName) { + var name = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(propName)); + if (name && type) { + var result_10 = []; + var symbol = type.getProperty(name); + if (type.flags & 65536) { + ts.forEach(type.types, function (t) { var symbol = t.getProperty(name); if (symbol) { - result_9.push(symbol); + result_10.push(symbol); } }); - return result_9; + return result_10; } if (symbol) { - result_9.push(symbol); - return result_9; + result_10.push(symbol); + return result_10; } } return undefined; } - ts.getPropertySymbolsFromContextualType = getPropertySymbolsFromContextualType; + ts.getPropertySymbolsFromType = getPropertySymbolsFromType; function isArgumentOfElementAccessExpression(node) { return node && node.parent && @@ -74992,7 +76963,7 @@ var ts; LogLevel[LogLevel["requestTime"] = 2] = "requestTime"; LogLevel[LogLevel["verbose"] = 3] = "verbose"; })(LogLevel = server.LogLevel || (server.LogLevel = {})); - server.emptyArray = []; + server.emptyArray = createSortedArray(); var Msg; (function (Msg) { Msg.Err = "Err"; @@ -75013,7 +76984,7 @@ var ts; function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports, cachePath) { return { projectName: project.getProjectName(), - fileNames: project.getFileNames(true), + fileNames: project.getFileNames(true, true), compilerOptions: project.getCompilerOptions(), typeAcquisition: typeAcquisition, unresolvedImports: unresolvedImports, @@ -75070,22 +77041,6 @@ var ts; } } server.mergeMapLikes = mergeMapLikes; - function removeItemFromSet(items, itemToRemove) { - if (items.length === 0) { - return; - } - var index = items.indexOf(itemToRemove); - if (index < 0) { - return; - } - if (index === items.length - 1) { - items.pop(); - } - else { - items[index] = items.pop(); - } - } - server.removeItemFromSet = removeItemFromSet; function toNormalizedPath(fileName) { return ts.normalizePath(fileName); } @@ -75125,42 +77080,10 @@ var ts; return "/dev/null/inferredProject" + counter + "*"; } server.makeInferredProjectName = makeInferredProjectName; - function toSortedReadonlyArray(arr) { - arr.sort(); - return arr; - } - server.toSortedReadonlyArray = toSortedReadonlyArray; - function enumerateInsertsAndDeletes(a, b, inserted, deleted, compare) { - compare = compare || ts.compareValues; - var aIndex = 0; - var bIndex = 0; - var aLen = a.length; - var bLen = b.length; - while (aIndex < aLen && bIndex < bLen) { - var aItem = a[aIndex]; - var bItem = b[bIndex]; - var compareResult = compare(aItem, bItem); - if (compareResult === -1) { - inserted(aItem); - aIndex++; - } - else if (compareResult === 1) { - deleted(bItem); - bIndex++; - } - else { - aIndex++; - bIndex++; - } - } - while (aIndex < aLen) { - inserted(a[aIndex++]); - } - while (bIndex < bLen) { - deleted(b[bIndex++]); - } + function createSortedArray() { + return []; } - server.enumerateInsertsAndDeletes = enumerateInsertsAndDeletes; + server.createSortedArray = createSortedArray; var ThrottledOperations = (function () { function ThrottledOperations(host) { this.host = host; @@ -75207,6 +77130,208 @@ var ts; server.GcTimer = GcTimer; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); +(function (ts) { + var server; + (function (server) { + function insertSorted(array, insert, compare) { + if (array.length === 0) { + array.push(insert); + return; + } + var insertIndex = ts.binarySearch(array, insert, compare); + if (insertIndex < 0) { + array.splice(~insertIndex, 0, insert); + } + } + server.insertSorted = insertSorted; + function removeSorted(array, remove, compare) { + if (!array || array.length === 0) { + return; + } + if (array[0] === remove) { + array.splice(0, 1); + return; + } + var removeIndex = ts.binarySearch(array, remove, compare); + if (removeIndex >= 0) { + array.splice(removeIndex, 1); + } + } + server.removeSorted = removeSorted; + function toSortedArray(arr, comparer) { + arr.sort(comparer); + return arr; + } + server.toSortedArray = toSortedArray; + function toDeduplicatedSortedArray(arr) { + arr.sort(); + ts.filterMutate(arr, isNonDuplicateInSortedArray); + return arr; + } + server.toDeduplicatedSortedArray = toDeduplicatedSortedArray; + function isNonDuplicateInSortedArray(value, index, array) { + return index === 0 || value !== array[index - 1]; + } + function enumerateInsertsAndDeletes(newItems, oldItems, inserted, deleted, compare) { + compare = compare || ts.compareValues; + var newIndex = 0; + var oldIndex = 0; + var newLen = newItems.length; + var oldLen = oldItems.length; + while (newIndex < newLen && oldIndex < oldLen) { + var newItem = newItems[newIndex]; + var oldItem = oldItems[oldIndex]; + var compareResult = compare(newItem, oldItem); + if (compareResult === -1) { + inserted(newItem); + newIndex++; + } + else if (compareResult === 1) { + deleted(oldItem); + oldIndex++; + } + else { + newIndex++; + oldIndex++; + } + } + while (newIndex < newLen) { + inserted(newItems[newIndex++]); + } + while (oldIndex < oldLen) { + deleted(oldItems[oldIndex++]); + } + } + server.enumerateInsertsAndDeletes = enumerateInsertsAndDeletes; + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); +var ts; +(function (ts) { + var server; + (function (server) { + var protocol; + (function (protocol) { + var CommandTypes; + (function (CommandTypes) { + CommandTypes["Brace"] = "brace"; + CommandTypes["BraceFull"] = "brace-full"; + CommandTypes["BraceCompletion"] = "braceCompletion"; + CommandTypes["Change"] = "change"; + CommandTypes["Close"] = "close"; + CommandTypes["Completions"] = "completions"; + CommandTypes["CompletionsFull"] = "completions-full"; + CommandTypes["CompletionDetails"] = "completionEntryDetails"; + CommandTypes["CompileOnSaveAffectedFileList"] = "compileOnSaveAffectedFileList"; + CommandTypes["CompileOnSaveEmitFile"] = "compileOnSaveEmitFile"; + CommandTypes["Configure"] = "configure"; + CommandTypes["Definition"] = "definition"; + CommandTypes["DefinitionFull"] = "definition-full"; + CommandTypes["Implementation"] = "implementation"; + CommandTypes["ImplementationFull"] = "implementation-full"; + CommandTypes["Exit"] = "exit"; + CommandTypes["Format"] = "format"; + CommandTypes["Formatonkey"] = "formatonkey"; + CommandTypes["FormatFull"] = "format-full"; + CommandTypes["FormatonkeyFull"] = "formatonkey-full"; + CommandTypes["FormatRangeFull"] = "formatRange-full"; + CommandTypes["Geterr"] = "geterr"; + CommandTypes["GeterrForProject"] = "geterrForProject"; + CommandTypes["SemanticDiagnosticsSync"] = "semanticDiagnosticsSync"; + CommandTypes["SyntacticDiagnosticsSync"] = "syntacticDiagnosticsSync"; + CommandTypes["NavBar"] = "navbar"; + CommandTypes["NavBarFull"] = "navbar-full"; + CommandTypes["Navto"] = "navto"; + CommandTypes["NavtoFull"] = "navto-full"; + CommandTypes["NavTree"] = "navtree"; + CommandTypes["NavTreeFull"] = "navtree-full"; + CommandTypes["Occurrences"] = "occurrences"; + CommandTypes["DocumentHighlights"] = "documentHighlights"; + CommandTypes["DocumentHighlightsFull"] = "documentHighlights-full"; + CommandTypes["Open"] = "open"; + CommandTypes["Quickinfo"] = "quickinfo"; + CommandTypes["QuickinfoFull"] = "quickinfo-full"; + CommandTypes["References"] = "references"; + CommandTypes["ReferencesFull"] = "references-full"; + CommandTypes["Reload"] = "reload"; + CommandTypes["Rename"] = "rename"; + CommandTypes["RenameInfoFull"] = "rename-full"; + CommandTypes["RenameLocationsFull"] = "renameLocations-full"; + CommandTypes["Saveto"] = "saveto"; + CommandTypes["SignatureHelp"] = "signatureHelp"; + CommandTypes["SignatureHelpFull"] = "signatureHelp-full"; + CommandTypes["TypeDefinition"] = "typeDefinition"; + CommandTypes["ProjectInfo"] = "projectInfo"; + CommandTypes["ReloadProjects"] = "reloadProjects"; + CommandTypes["Unknown"] = "unknown"; + CommandTypes["OpenExternalProject"] = "openExternalProject"; + CommandTypes["OpenExternalProjects"] = "openExternalProjects"; + CommandTypes["CloseExternalProject"] = "closeExternalProject"; + CommandTypes["SynchronizeProjectList"] = "synchronizeProjectList"; + CommandTypes["ApplyChangedToOpenFiles"] = "applyChangedToOpenFiles"; + CommandTypes["EncodedSemanticClassificationsFull"] = "encodedSemanticClassifications-full"; + CommandTypes["Cleanup"] = "cleanup"; + CommandTypes["OutliningSpans"] = "outliningSpans"; + CommandTypes["TodoComments"] = "todoComments"; + CommandTypes["Indentation"] = "indentation"; + CommandTypes["DocCommentTemplate"] = "docCommentTemplate"; + CommandTypes["CompilerOptionsDiagnosticsFull"] = "compilerOptionsDiagnostics-full"; + CommandTypes["NameOrDottedNameSpan"] = "nameOrDottedNameSpan"; + CommandTypes["BreakpointStatement"] = "breakpointStatement"; + CommandTypes["CompilerOptionsForInferredProjects"] = "compilerOptionsForInferredProjects"; + CommandTypes["GetCodeFixes"] = "getCodeFixes"; + CommandTypes["GetCodeFixesFull"] = "getCodeFixes-full"; + CommandTypes["GetSupportedCodeFixes"] = "getSupportedCodeFixes"; + CommandTypes["GetApplicableRefactors"] = "getApplicableRefactors"; + CommandTypes["GetEditsForRefactor"] = "getEditsForRefactor"; + CommandTypes["GetEditsForRefactorFull"] = "getEditsForRefactor-full"; + })(CommandTypes = protocol.CommandTypes || (protocol.CommandTypes = {})); + var IndentStyle; + (function (IndentStyle) { + IndentStyle["None"] = "None"; + IndentStyle["Block"] = "Block"; + IndentStyle["Smart"] = "Smart"; + })(IndentStyle = protocol.IndentStyle || (protocol.IndentStyle = {})); + var JsxEmit; + (function (JsxEmit) { + JsxEmit["None"] = "None"; + JsxEmit["Preserve"] = "Preserve"; + JsxEmit["ReactNative"] = "ReactNative"; + JsxEmit["React"] = "React"; + })(JsxEmit = protocol.JsxEmit || (protocol.JsxEmit = {})); + var ModuleKind; + (function (ModuleKind) { + ModuleKind["None"] = "None"; + ModuleKind["CommonJS"] = "CommonJS"; + ModuleKind["AMD"] = "AMD"; + ModuleKind["UMD"] = "UMD"; + ModuleKind["System"] = "System"; + ModuleKind["ES6"] = "ES6"; + ModuleKind["ES2015"] = "ES2015"; + ModuleKind["ESNext"] = "ESNext"; + })(ModuleKind = protocol.ModuleKind || (protocol.ModuleKind = {})); + var ModuleResolutionKind; + (function (ModuleResolutionKind) { + ModuleResolutionKind["Classic"] = "Classic"; + ModuleResolutionKind["Node"] = "Node"; + })(ModuleResolutionKind = protocol.ModuleResolutionKind || (protocol.ModuleResolutionKind = {})); + var NewLineKind; + (function (NewLineKind) { + NewLineKind["Crlf"] = "Crlf"; + NewLineKind["Lf"] = "Lf"; + })(NewLineKind = protocol.NewLineKind || (protocol.NewLineKind = {})); + var ScriptTarget; + (function (ScriptTarget) { + ScriptTarget["ES3"] = "ES3"; + ScriptTarget["ES5"] = "ES5"; + ScriptTarget["ES6"] = "ES6"; + ScriptTarget["ES2015"] = "ES2015"; + ScriptTarget["ES2016"] = "ES2016"; + ScriptTarget["ES2017"] = "ES2017"; + ScriptTarget["ESNext"] = "ESNext"; + })(ScriptTarget = protocol.ScriptTarget || (protocol.ScriptTarget = {})); + })(protocol = server.protocol || (server.protocol = {})); + })(server = ts.server || (ts.server = {})); +})(ts || (ts = {})); var ts; (function (ts) { var server; @@ -75259,100 +77384,28 @@ var ts; source: diag.source }; } - function formatConfigFileDiag(diag) { - return { - start: undefined, - end: undefined, - text: ts.flattenDiagnosticMessageText(diag.messageText, "\n"), - category: ts.DiagnosticCategory[diag.category].toLowerCase(), - source: diag.source - }; + function convertToLocation(lineAndCharacter) { + return { line: lineAndCharacter.line + 1, offset: lineAndCharacter.character + 1 }; + } + function formatConfigFileDiag(diag, includeFileName) { + var start = diag.file && convertToLocation(ts.getLineAndCharacterOfPosition(diag.file, diag.start)); + var end = diag.file && convertToLocation(ts.getLineAndCharacterOfPosition(diag.file, diag.start + diag.length)); + var text = ts.flattenDiagnosticMessageText(diag.messageText, "\n"); + var code = diag.code, source = diag.source; + var category = ts.DiagnosticCategory[diag.category].toLowerCase(); + return includeFileName ? { start: start, end: end, text: text, code: code, category: category, source: source, fileName: diag.file && diag.file.fileName } : + { start: start, end: end, text: text, code: code, category: category, source: source }; } function allEditsBeforePos(edits, pos) { - for (var _i = 0, edits_1 = edits; _i < edits_1.length; _i++) { - var edit = edits_1[_i]; + for (var _i = 0, edits_2 = edits; _i < edits_2.length; _i++) { + var edit = edits_2[_i]; if (ts.textSpanEnd(edit.span) >= pos) { return false; } } return true; } - var CommandNames; - (function (CommandNames) { - CommandNames.Brace = "brace"; - CommandNames.BraceFull = "brace-full"; - CommandNames.BraceCompletion = "braceCompletion"; - CommandNames.Change = "change"; - CommandNames.Close = "close"; - CommandNames.Completions = "completions"; - CommandNames.CompletionsFull = "completions-full"; - CommandNames.CompletionDetails = "completionEntryDetails"; - CommandNames.CompileOnSaveAffectedFileList = "compileOnSaveAffectedFileList"; - CommandNames.CompileOnSaveEmitFile = "compileOnSaveEmitFile"; - CommandNames.Configure = "configure"; - CommandNames.Definition = "definition"; - CommandNames.DefinitionFull = "definition-full"; - CommandNames.Exit = "exit"; - CommandNames.Format = "format"; - CommandNames.Formatonkey = "formatonkey"; - CommandNames.FormatFull = "format-full"; - CommandNames.FormatonkeyFull = "formatonkey-full"; - CommandNames.FormatRangeFull = "formatRange-full"; - CommandNames.Geterr = "geterr"; - CommandNames.GeterrForProject = "geterrForProject"; - CommandNames.Implementation = "implementation"; - CommandNames.ImplementationFull = "implementation-full"; - CommandNames.SemanticDiagnosticsSync = "semanticDiagnosticsSync"; - CommandNames.SyntacticDiagnosticsSync = "syntacticDiagnosticsSync"; - CommandNames.NavBar = "navbar"; - CommandNames.NavBarFull = "navbar-full"; - CommandNames.NavTree = "navtree"; - CommandNames.NavTreeFull = "navtree-full"; - CommandNames.Navto = "navto"; - CommandNames.NavtoFull = "navto-full"; - CommandNames.Occurrences = "occurrences"; - CommandNames.DocumentHighlights = "documentHighlights"; - CommandNames.DocumentHighlightsFull = "documentHighlights-full"; - CommandNames.Open = "open"; - CommandNames.Quickinfo = "quickinfo"; - CommandNames.QuickinfoFull = "quickinfo-full"; - CommandNames.References = "references"; - CommandNames.ReferencesFull = "references-full"; - CommandNames.Reload = "reload"; - CommandNames.Rename = "rename"; - CommandNames.RenameInfoFull = "rename-full"; - CommandNames.RenameLocationsFull = "renameLocations-full"; - CommandNames.Saveto = "saveto"; - CommandNames.SignatureHelp = "signatureHelp"; - CommandNames.SignatureHelpFull = "signatureHelp-full"; - CommandNames.TypeDefinition = "typeDefinition"; - CommandNames.ProjectInfo = "projectInfo"; - CommandNames.ReloadProjects = "reloadProjects"; - CommandNames.Unknown = "unknown"; - CommandNames.OpenExternalProject = "openExternalProject"; - CommandNames.OpenExternalProjects = "openExternalProjects"; - CommandNames.CloseExternalProject = "closeExternalProject"; - CommandNames.SynchronizeProjectList = "synchronizeProjectList"; - CommandNames.ApplyChangedToOpenFiles = "applyChangedToOpenFiles"; - CommandNames.EncodedSemanticClassificationsFull = "encodedSemanticClassifications-full"; - CommandNames.Cleanup = "cleanup"; - CommandNames.OutliningSpans = "outliningSpans"; - CommandNames.TodoComments = "todoComments"; - CommandNames.Indentation = "indentation"; - CommandNames.DocCommentTemplate = "docCommentTemplate"; - CommandNames.CompilerOptionsDiagnosticsFull = "compilerOptionsDiagnostics-full"; - CommandNames.NameOrDottedNameSpan = "nameOrDottedNameSpan"; - CommandNames.BreakpointStatement = "breakpointStatement"; - CommandNames.CompilerOptionsForInferredProjects = "compilerOptionsForInferredProjects"; - CommandNames.GetCodeFixes = "getCodeFixes"; - CommandNames.GetCodeFixesFull = "getCodeFixes-full"; - CommandNames.GetSupportedCodeFixes = "getSupportedCodeFixes"; - CommandNames.GetApplicableRefactors = "getApplicableRefactors"; - CommandNames.GetRefactorCodeActions = "getRefactorCodeActions"; - CommandNames.GetRefactorCodeActionsFull = "getRefactorCodeActions-full"; - CommandNames.GetEditsForRefactor = "getEditsForRefactor"; - CommandNames.GetEditsForRefactorFull = "getEditsForRefactor-full"; - })(CommandNames = server.CommandNames || (server.CommandNames = {})); + server.CommandNames = server.protocol.CommandTypes; function formatMessage(msg, logger, byteLength, newLine) { var verboseLogging = logger.hasLevel(server.LogLevel.verbose); var json = JSON.stringify(msg); @@ -75365,26 +77418,17 @@ var ts; server.formatMessage = formatMessage; var MultistepOperation = (function () { function MultistepOperation(operationHost) { - var _this = this; this.operationHost = operationHost; - this.completed = true; - this.next = { - immediate: function (action) { return _this.immediate(action); }, - delay: function (ms, action) { return _this.delay(ms, action); } - }; } MultistepOperation.prototype.startNew = function (action) { this.complete(); this.requestId = this.operationHost.getCurrentRequestId(); - this.completed = false; this.executeAction(action); }; MultistepOperation.prototype.complete = function () { - if (!this.completed) { - if (this.requestId) { - this.operationHost.sendRequestCompletedEvent(this.requestId); - } - this.completed = true; + if (this.requestId !== undefined) { + this.operationHost.sendRequestCompletedEvent(this.requestId); + this.requestId = undefined; } this.setTimerHandle(undefined); this.setImmediateId(undefined); @@ -75414,7 +77458,7 @@ var ts; stop = true; } else { - action(this.next); + action(this); } } catch (e) { @@ -75449,19 +77493,19 @@ var ts; var _this = this; this.changeSeq = 0; this.handlers = ts.createMapFromTemplate((_a = {}, - _a[CommandNames.OpenExternalProject] = function (request) { + _a[server.CommandNames.OpenExternalProject] = function (request) { _this.projectService.openExternalProject(request.arguments, false); return _this.requiredResponse(true); }, - _a[CommandNames.OpenExternalProjects] = function (request) { + _a[server.CommandNames.OpenExternalProjects] = function (request) { _this.projectService.openExternalProjects(request.arguments.projects); return _this.requiredResponse(true); }, - _a[CommandNames.CloseExternalProject] = function (request) { + _a[server.CommandNames.CloseExternalProject] = function (request) { _this.projectService.closeExternalProject(request.arguments.projectFileName); return _this.requiredResponse(true); }, - _a[CommandNames.SynchronizeProjectList] = function (request) { + _a[server.CommandNames.SynchronizeProjectList] = function (request) { var result = _this.projectService.synchronizeProjectList(request.arguments.knownProjects); if (!result.some(function (p) { return p.projectErrors && p.projectErrors.length !== 0; })) { return _this.requiredResponse(result); @@ -75479,219 +77523,219 @@ var ts; }); return _this.requiredResponse(converted); }, - _a[CommandNames.ApplyChangedToOpenFiles] = function (request) { + _a[server.CommandNames.ApplyChangedToOpenFiles] = function (request) { _this.projectService.applyChangesInOpenFiles(request.arguments.openFiles, request.arguments.changedFiles, request.arguments.closedFiles); _this.changeSeq++; return _this.requiredResponse(true); }, - _a[CommandNames.Exit] = function () { + _a[server.CommandNames.Exit] = function () { _this.exit(); return _this.notRequired(); }, - _a[CommandNames.Definition] = function (request) { + _a[server.CommandNames.Definition] = function (request) { return _this.requiredResponse(_this.getDefinition(request.arguments, true)); }, - _a[CommandNames.DefinitionFull] = function (request) { + _a[server.CommandNames.DefinitionFull] = function (request) { return _this.requiredResponse(_this.getDefinition(request.arguments, false)); }, - _a[CommandNames.TypeDefinition] = function (request) { + _a[server.CommandNames.TypeDefinition] = function (request) { return _this.requiredResponse(_this.getTypeDefinition(request.arguments)); }, - _a[CommandNames.Implementation] = function (request) { + _a[server.CommandNames.Implementation] = function (request) { return _this.requiredResponse(_this.getImplementation(request.arguments, true)); }, - _a[CommandNames.ImplementationFull] = function (request) { + _a[server.CommandNames.ImplementationFull] = function (request) { return _this.requiredResponse(_this.getImplementation(request.arguments, false)); }, - _a[CommandNames.References] = function (request) { + _a[server.CommandNames.References] = function (request) { return _this.requiredResponse(_this.getReferences(request.arguments, true)); }, - _a[CommandNames.ReferencesFull] = function (request) { + _a[server.CommandNames.ReferencesFull] = function (request) { return _this.requiredResponse(_this.getReferences(request.arguments, false)); }, - _a[CommandNames.Rename] = function (request) { + _a[server.CommandNames.Rename] = function (request) { return _this.requiredResponse(_this.getRenameLocations(request.arguments, true)); }, - _a[CommandNames.RenameLocationsFull] = function (request) { + _a[server.CommandNames.RenameLocationsFull] = function (request) { return _this.requiredResponse(_this.getRenameLocations(request.arguments, false)); }, - _a[CommandNames.RenameInfoFull] = function (request) { + _a[server.CommandNames.RenameInfoFull] = function (request) { return _this.requiredResponse(_this.getRenameInfo(request.arguments)); }, - _a[CommandNames.Open] = function (request) { + _a[server.CommandNames.Open] = function (request) { _this.openClientFile(server.toNormalizedPath(request.arguments.file), request.arguments.fileContent, server.convertScriptKindName(request.arguments.scriptKindName), request.arguments.projectRootPath ? server.toNormalizedPath(request.arguments.projectRootPath) : undefined); return _this.notRequired(); }, - _a[CommandNames.Quickinfo] = function (request) { + _a[server.CommandNames.Quickinfo] = function (request) { return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, true)); }, - _a[CommandNames.QuickinfoFull] = function (request) { + _a[server.CommandNames.QuickinfoFull] = function (request) { return _this.requiredResponse(_this.getQuickInfoWorker(request.arguments, false)); }, - _a[CommandNames.OutliningSpans] = function (request) { + _a[server.CommandNames.OutliningSpans] = function (request) { return _this.requiredResponse(_this.getOutliningSpans(request.arguments)); }, - _a[CommandNames.TodoComments] = function (request) { + _a[server.CommandNames.TodoComments] = function (request) { return _this.requiredResponse(_this.getTodoComments(request.arguments)); }, - _a[CommandNames.Indentation] = function (request) { + _a[server.CommandNames.Indentation] = function (request) { return _this.requiredResponse(_this.getIndentation(request.arguments)); }, - _a[CommandNames.NameOrDottedNameSpan] = function (request) { + _a[server.CommandNames.NameOrDottedNameSpan] = function (request) { return _this.requiredResponse(_this.getNameOrDottedNameSpan(request.arguments)); }, - _a[CommandNames.BreakpointStatement] = function (request) { + _a[server.CommandNames.BreakpointStatement] = function (request) { return _this.requiredResponse(_this.getBreakpointStatement(request.arguments)); }, - _a[CommandNames.BraceCompletion] = function (request) { + _a[server.CommandNames.BraceCompletion] = function (request) { return _this.requiredResponse(_this.isValidBraceCompletion(request.arguments)); }, - _a[CommandNames.DocCommentTemplate] = function (request) { + _a[server.CommandNames.DocCommentTemplate] = function (request) { return _this.requiredResponse(_this.getDocCommentTemplate(request.arguments)); }, - _a[CommandNames.Format] = function (request) { + _a[server.CommandNames.Format] = function (request) { return _this.requiredResponse(_this.getFormattingEditsForRange(request.arguments)); }, - _a[CommandNames.Formatonkey] = function (request) { + _a[server.CommandNames.Formatonkey] = function (request) { return _this.requiredResponse(_this.getFormattingEditsAfterKeystroke(request.arguments)); }, - _a[CommandNames.FormatFull] = function (request) { + _a[server.CommandNames.FormatFull] = function (request) { return _this.requiredResponse(_this.getFormattingEditsForDocumentFull(request.arguments)); }, - _a[CommandNames.FormatonkeyFull] = function (request) { + _a[server.CommandNames.FormatonkeyFull] = function (request) { return _this.requiredResponse(_this.getFormattingEditsAfterKeystrokeFull(request.arguments)); }, - _a[CommandNames.FormatRangeFull] = function (request) { + _a[server.CommandNames.FormatRangeFull] = function (request) { return _this.requiredResponse(_this.getFormattingEditsForRangeFull(request.arguments)); }, - _a[CommandNames.Completions] = function (request) { + _a[server.CommandNames.Completions] = function (request) { return _this.requiredResponse(_this.getCompletions(request.arguments, true)); }, - _a[CommandNames.CompletionsFull] = function (request) { + _a[server.CommandNames.CompletionsFull] = function (request) { return _this.requiredResponse(_this.getCompletions(request.arguments, false)); }, - _a[CommandNames.CompletionDetails] = function (request) { + _a[server.CommandNames.CompletionDetails] = function (request) { return _this.requiredResponse(_this.getCompletionEntryDetails(request.arguments)); }, - _a[CommandNames.CompileOnSaveAffectedFileList] = function (request) { + _a[server.CommandNames.CompileOnSaveAffectedFileList] = function (request) { return _this.requiredResponse(_this.getCompileOnSaveAffectedFileList(request.arguments)); }, - _a[CommandNames.CompileOnSaveEmitFile] = function (request) { + _a[server.CommandNames.CompileOnSaveEmitFile] = function (request) { return _this.requiredResponse(_this.emitFile(request.arguments)); }, - _a[CommandNames.SignatureHelp] = function (request) { + _a[server.CommandNames.SignatureHelp] = function (request) { return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, true)); }, - _a[CommandNames.SignatureHelpFull] = function (request) { + _a[server.CommandNames.SignatureHelpFull] = function (request) { return _this.requiredResponse(_this.getSignatureHelpItems(request.arguments, false)); }, - _a[CommandNames.CompilerOptionsDiagnosticsFull] = function (request) { + _a[server.CommandNames.CompilerOptionsDiagnosticsFull] = function (request) { return _this.requiredResponse(_this.getCompilerOptionsDiagnostics(request.arguments)); }, - _a[CommandNames.EncodedSemanticClassificationsFull] = function (request) { + _a[server.CommandNames.EncodedSemanticClassificationsFull] = function (request) { return _this.requiredResponse(_this.getEncodedSemanticClassifications(request.arguments)); }, - _a[CommandNames.Cleanup] = function () { + _a[server.CommandNames.Cleanup] = function () { _this.cleanup(); return _this.requiredResponse(true); }, - _a[CommandNames.SemanticDiagnosticsSync] = function (request) { + _a[server.CommandNames.SemanticDiagnosticsSync] = function (request) { return _this.requiredResponse(_this.getSemanticDiagnosticsSync(request.arguments)); }, - _a[CommandNames.SyntacticDiagnosticsSync] = function (request) { + _a[server.CommandNames.SyntacticDiagnosticsSync] = function (request) { return _this.requiredResponse(_this.getSyntacticDiagnosticsSync(request.arguments)); }, - _a[CommandNames.Geterr] = function (request) { + _a[server.CommandNames.Geterr] = function (request) { _this.errorCheck.startNew(function (next) { return _this.getDiagnostics(next, request.arguments.delay, request.arguments.files); }); return _this.notRequired(); }, - _a[CommandNames.GeterrForProject] = function (request) { + _a[server.CommandNames.GeterrForProject] = function (request) { _this.errorCheck.startNew(function (next) { return _this.getDiagnosticsForProject(next, request.arguments.delay, request.arguments.file); }); return _this.notRequired(); }, - _a[CommandNames.Change] = function (request) { + _a[server.CommandNames.Change] = function (request) { _this.change(request.arguments); return _this.notRequired(); }, - _a[CommandNames.Configure] = function (request) { + _a[server.CommandNames.Configure] = function (request) { _this.projectService.setHostConfiguration(request.arguments); - _this.output(undefined, CommandNames.Configure, request.seq); + _this.output(undefined, server.CommandNames.Configure, request.seq); return _this.notRequired(); }, - _a[CommandNames.Reload] = function (request) { + _a[server.CommandNames.Reload] = function (request) { _this.reload(request.arguments, request.seq); return _this.requiredResponse({ reloadFinished: true }); }, - _a[CommandNames.Saveto] = function (request) { + _a[server.CommandNames.Saveto] = function (request) { var savetoArgs = request.arguments; _this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); return _this.notRequired(); }, - _a[CommandNames.Close] = function (request) { + _a[server.CommandNames.Close] = function (request) { var closeArgs = request.arguments; _this.closeClientFile(closeArgs.file); return _this.notRequired(); }, - _a[CommandNames.Navto] = function (request) { + _a[server.CommandNames.Navto] = function (request) { return _this.requiredResponse(_this.getNavigateToItems(request.arguments, true)); }, - _a[CommandNames.NavtoFull] = function (request) { + _a[server.CommandNames.NavtoFull] = function (request) { return _this.requiredResponse(_this.getNavigateToItems(request.arguments, false)); }, - _a[CommandNames.Brace] = function (request) { + _a[server.CommandNames.Brace] = function (request) { return _this.requiredResponse(_this.getBraceMatching(request.arguments, true)); }, - _a[CommandNames.BraceFull] = function (request) { + _a[server.CommandNames.BraceFull] = function (request) { return _this.requiredResponse(_this.getBraceMatching(request.arguments, false)); }, - _a[CommandNames.NavBar] = function (request) { + _a[server.CommandNames.NavBar] = function (request) { return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, true)); }, - _a[CommandNames.NavBarFull] = function (request) { + _a[server.CommandNames.NavBarFull] = function (request) { return _this.requiredResponse(_this.getNavigationBarItems(request.arguments, false)); }, - _a[CommandNames.NavTree] = function (request) { + _a[server.CommandNames.NavTree] = function (request) { return _this.requiredResponse(_this.getNavigationTree(request.arguments, true)); }, - _a[CommandNames.NavTreeFull] = function (request) { + _a[server.CommandNames.NavTreeFull] = function (request) { return _this.requiredResponse(_this.getNavigationTree(request.arguments, false)); }, - _a[CommandNames.Occurrences] = function (request) { + _a[server.CommandNames.Occurrences] = function (request) { return _this.requiredResponse(_this.getOccurrences(request.arguments)); }, - _a[CommandNames.DocumentHighlights] = function (request) { + _a[server.CommandNames.DocumentHighlights] = function (request) { return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, true)); }, - _a[CommandNames.DocumentHighlightsFull] = function (request) { + _a[server.CommandNames.DocumentHighlightsFull] = function (request) { return _this.requiredResponse(_this.getDocumentHighlights(request.arguments, false)); }, - _a[CommandNames.CompilerOptionsForInferredProjects] = function (request) { + _a[server.CommandNames.CompilerOptionsForInferredProjects] = function (request) { _this.setCompilerOptionsForInferredProjects(request.arguments); return _this.requiredResponse(true); }, - _a[CommandNames.ProjectInfo] = function (request) { + _a[server.CommandNames.ProjectInfo] = function (request) { return _this.requiredResponse(_this.getProjectInfo(request.arguments)); }, - _a[CommandNames.ReloadProjects] = function () { + _a[server.CommandNames.ReloadProjects] = function () { _this.projectService.reloadProjects(); return _this.notRequired(); }, - _a[CommandNames.GetCodeFixes] = function (request) { + _a[server.CommandNames.GetCodeFixes] = function (request) { return _this.requiredResponse(_this.getCodeFixes(request.arguments, true)); }, - _a[CommandNames.GetCodeFixesFull] = function (request) { + _a[server.CommandNames.GetCodeFixesFull] = function (request) { return _this.requiredResponse(_this.getCodeFixes(request.arguments, false)); }, - _a[CommandNames.GetSupportedCodeFixes] = function () { + _a[server.CommandNames.GetSupportedCodeFixes] = function () { return _this.requiredResponse(_this.getSupportedCodeFixes()); }, - _a[CommandNames.GetApplicableRefactors] = function (request) { + _a[server.CommandNames.GetApplicableRefactors] = function (request) { return _this.requiredResponse(_this.getApplicableRefactors(request.arguments)); }, - _a[CommandNames.GetEditsForRefactor] = function (request) { + _a[server.CommandNames.GetEditsForRefactor] = function (request) { return _this.requiredResponse(_this.getEditsForRefactor(request.arguments, true)); }, - _a[CommandNames.GetEditsForRefactorFull] = function (request) { + _a[server.CommandNames.GetEditsForRefactorFull] = function (request) { return _this.requiredResponse(_this.getEditsForRefactor(request.arguments, false)); }, _a)); @@ -75720,6 +77764,7 @@ var ts; logger: this.logger, cancellationToken: this.cancellationToken, useSingleInferredProject: opts.useSingleInferredProject, + useInferredProjectPerProjectRoot: opts.useInferredProjectPerProjectRoot, typingsInstaller: this.typingsInstaller, throttleWaitMilliseconds: throttleWaitMilliseconds, eventHandler: this.eventHandler, @@ -75746,7 +77791,7 @@ var ts; case server.ContextEvent: var _a = event.data, project_1 = _a.project, fileName_2 = _a.fileName; this.projectService.logger.info("got context event, updating diagnostics for " + fileName_2); - this.errorCheck.startNew(function (next) { return _this.updateErrorCheck(next, [{ fileName: fileName_2, project: project_1 }], _this.changeSeq, function (n) { return n === _this.changeSeq; }, 100); }); + this.errorCheck.startNew(function (next) { return _this.updateErrorCheck(next, [{ fileName: fileName_2, project: project_1 }], 100); }); break; case server.ConfigFileDiagEvent: var _b = event.data, triggerFile = _b.triggerFile, configFileName = _b.configFileName, diagnostics = _b.diagnostics; @@ -75790,7 +77835,7 @@ var ts; this.host.write(formatMessage(msg, this.logger, this.byteLength, this.host.newLine)); }; Session.prototype.configFileDiagnosticEvent = function (triggerFile, configFile, diagnostics) { - var bakedDiags = ts.map(diagnostics, formatConfigFileDiag); + var bakedDiags = ts.map(diagnostics, function (diagnostic) { return formatConfigFileDiag(diagnostic, true); }); var ev = { seq: 0, type: "event", @@ -75854,26 +77899,24 @@ var ts; this.logError(err, "syntactic check"); } }; - Session.prototype.updateProjectStructure = function (seq, matchSeq, ms) { + Session.prototype.updateProjectStructure = function () { var _this = this; - if (ms === void 0) { ms = 1500; } + var ms = 1500; + var seq = this.changeSeq; this.host.setTimeout(function () { - if (matchSeq(seq)) { + if (_this.changeSeq === seq) { _this.projectService.refreshInferredProjects(); } }, ms); }; - Session.prototype.updateErrorCheck = function (next, checkList, seq, matchSeq, ms, followMs, requireOpen) { + Session.prototype.updateErrorCheck = function (next, checkList, ms, requireOpen) { var _this = this; - if (ms === void 0) { ms = 1500; } - if (followMs === void 0) { followMs = 200; } if (requireOpen === void 0) { requireOpen = true; } - if (followMs > ms) { - followMs = ms; - } + var seq = this.changeSeq; + var followMs = Math.min(ms, 200); var index = 0; var checkOne = function () { - if (matchSeq(seq)) { + if (_this.changeSeq === seq) { var checkSpec_1 = checkList[index]; index++; if (checkSpec_1.project.containsFile(checkSpec_1.fileName, requireOpen)) { @@ -75887,7 +77930,7 @@ var ts; } } }; - if ((checkList.length > index) && (matchSeq(seq))) { + if (checkList.length > index && this.changeSeq === seq) { next.delay(ms, checkOne); } }; @@ -75917,9 +77960,37 @@ var ts; Session.prototype.getProject = function (projectFileName) { return projectFileName && this.projectService.findProject(projectFileName); }; + Session.prototype.getConfigFileAndProject = function (args) { + var project = this.getProject(args.projectFileName); + var file = server.toNormalizedPath(args.file); + return { + configFile: project && project.hasConfigFile(file) && file, + project: project + }; + }; + Session.prototype.getConfigFileDiagnostics = function (configFile, project, includeLinePosition) { + var projectErrors = project.getAllProjectErrors(); + var optionsErrors = project.getLanguageService().getCompilerOptionsDiagnostics(); + var diagnosticsForConfigFile = ts.filter(ts.concatenate(projectErrors, optionsErrors), function (diagnostic) { return diagnostic.file && diagnostic.file.fileName === configFile; }); + return includeLinePosition ? + this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(diagnosticsForConfigFile) : + ts.map(diagnosticsForConfigFile, function (diagnostic) { return formatConfigFileDiag(diagnostic, false); }); + }; + Session.prototype.convertToDiagnosticsWithLinePositionFromDiagnosticFile = function (diagnostics) { + var _this = this; + return diagnostics.map(function (d) { return ({ + message: ts.flattenDiagnosticMessageText(d.messageText, _this.host.newLine), + start: d.start, + length: d.length, + category: ts.DiagnosticCategory[d.category].toLowerCase(), + code: d.code, + startLocation: d.file && convertToLocation(ts.getLineAndCharacterOfPosition(d.file, d.start)), + endLocation: d.file && convertToLocation(ts.getLineAndCharacterOfPosition(d.file, d.start + d.length)) + }); }); + }; Session.prototype.getCompilerOptionsDiagnostics = function (args) { var project = this.getProject(args.projectFileName); - return this.convertToDiagnosticsWithLinePosition(project.getLanguageService().getCompilerOptionsDiagnostics(), undefined); + return this.convertToDiagnosticsWithLinePosition(ts.filter(project.getLanguageService().getCompilerOptionsDiagnostics(), function (diagnostic) { return !diagnostic.file; }), undefined); }; Session.prototype.convertToDiagnosticsWithLinePosition = function (diagnostics, scriptInfo) { var _this = this; @@ -75937,7 +78008,7 @@ var ts; Session.prototype.getDiagnosticsWorker = function (args, isSemantic, selector, includeLinePosition) { var _a = this.getFileAndProject(args), project = _a.project, file = _a.file; if (isSemantic && isDeclarationFileInJSOnlyNonConfiguredProject(project, file)) { - return []; + return server.emptyArray; } var scriptInfo = project.getScriptInfoForNormalizedPath(file); var diagnostics = selector(project, file); @@ -75989,7 +78060,7 @@ var ts; var position = this.getPosition(args, project.getScriptInfoForNormalizedPath(file)); var implementations = project.getLanguageService().getImplementationAtPosition(file, position); if (!implementations) { - return []; + return server.emptyArray; } if (simplifiedResult) { return implementations.map(function (_a) { @@ -76032,9 +78103,17 @@ var ts; }); }; Session.prototype.getSyntacticDiagnosticsSync = function (args) { + var configFile = this.getConfigFileAndProject(args).configFile; + if (configFile) { + return server.emptyArray; + } return this.getDiagnosticsWorker(args, false, function (project, file) { return project.getLanguageService().getSyntacticDiagnostics(file); }, args.includeLinePosition); }; Session.prototype.getSemanticDiagnosticsSync = function (args) { + var _a = this.getConfigFileAndProject(args), configFile = _a.configFile, project = _a.project; + if (configFile) { + return this.getConfigFileDiagnostics(configFile, project, args.includeLinePosition); + } return this.getDiagnosticsWorker(args, true, function (project, file) { return project.getLanguageService().getSemanticDiagnostics(file); }, args.includeLinePosition); }; Session.prototype.getDocumentHighlights = function (args, simplifiedResult) { @@ -76067,17 +78146,17 @@ var ts; } }; Session.prototype.setCompilerOptionsForInferredProjects = function (args) { - this.projectService.setCompilerOptionsForInferredProjects(args.options); + this.projectService.setCompilerOptionsForInferredProjects(args.options, args.projectRootPath); }; Session.prototype.getProjectInfo = function (args) { - return this.getProjectInfoWorker(args.file, args.projectFileName, args.needFileNameList); + return this.getProjectInfoWorker(args.file, args.projectFileName, args.needFileNameList, false); }; - Session.prototype.getProjectInfoWorker = function (uncheckedFileName, projectFileName, needFileNameList) { + Session.prototype.getProjectInfoWorker = function (uncheckedFileName, projectFileName, needFileNameList, excludeConfigFiles) { var project = this.getFileAndProjectWorker(uncheckedFileName, projectFileName, true, true).project; var projectInfo = { configFileName: project.getProjectName(), languageServiceDisabled: !project.languageServiceEnabled, - fileNames: needFileNameList ? project.getFileNames() : undefined + fileNames: needFileNameList ? project.getFileNames(false, excludeConfigFiles) : undefined }; return projectInfo; }; @@ -76129,13 +78208,13 @@ var ts; if (!renameInfo.canRename) { return { info: renameInfo, - locs: [] + locs: server.emptyArray }; } var fileSpans = server.combineProjectOutput(projects, function (project) { var renameLocations = project.getLanguageService().findRenameLocations(file, position, args.findInStrings, args.findInComments); if (!renameLocations) { - return []; + return server.emptyArray; } return renameLocations.map(function (location) { var locationScriptInfo = project.getScriptInfo(location.fileName); @@ -76146,21 +78225,22 @@ var ts; }; }); }, compareRenameLocation, function (a, b) { return a.file === b.file && a.start.line === b.start.line && a.start.offset === b.start.offset; }); - var locs = fileSpans.reduce(function (accum, cur) { - var curFileAccum; - if (accum.length > 0) { - curFileAccum = accum[accum.length - 1]; + var locs = []; + for (var _i = 0, fileSpans_1 = fileSpans; _i < fileSpans_1.length; _i++) { + var cur = fileSpans_1[_i]; + var curFileAccum = void 0; + if (locs.length > 0) { + curFileAccum = locs[locs.length - 1]; if (curFileAccum.file !== cur.file) { curFileAccum = undefined; } } if (!curFileAccum) { curFileAccum = { file: cur.file, locs: [] }; - accum.push(curFileAccum); + locs.push(curFileAccum); } curFileAccum.locs.push({ start: cur.start, end: cur.end }); - return accum; - }, []); + } return { info: renameInfo, locs: locs }; } else { @@ -76215,7 +78295,7 @@ var ts; var refs = server.combineProjectOutput(projects, function (project) { var references = project.getLanguageService().getReferencesAtPosition(file, position); if (!references) { - return []; + return server.emptyArray; } return references.map(function (ref) { var refScriptInfo = project.getScriptInfo(ref.fileName); @@ -76256,7 +78336,7 @@ var ts; if (this.eventHandler) { this.eventHandler({ eventName: "configFileDiag", - data: { triggerFile: fileName, configFileName: configFileName, diagnostics: configFileErrors || [] } + data: { triggerFile: fileName, configFileName: configFileName, diagnostics: configFileErrors || server.emptyArray } }); } }; @@ -76373,32 +78453,29 @@ var ts; var formatOptions = this.projectService.getFormatCodeOptions(file); var edits = project.getLanguageService(false).getFormattingEditsAfterKeystroke(file, position, args.key, formatOptions); if ((args.key === "\n") && ((!edits) || (edits.length === 0) || allEditsBeforePos(edits, position))) { - var lineInfo = scriptInfo.getLineInfo(args.line); - if (lineInfo && (lineInfo.leaf) && (lineInfo.leaf.text)) { - var lineText = lineInfo.leaf.text; - if (lineText.search("\\S") < 0) { - var preferredIndent = project.getLanguageService(false).getIndentationAtPosition(file, position, formatOptions); - var hasIndent = 0; - var i = void 0, len = void 0; - for (i = 0, len = lineText.length; i < len; i++) { - if (lineText.charAt(i) === " ") { - hasIndent++; - } - else if (lineText.charAt(i) === "\t") { - hasIndent += formatOptions.tabSize; - } - else { - break; - } + var _b = scriptInfo.getLineInfo(args.line), lineText = _b.lineText, absolutePosition = _b.absolutePosition; + if (lineText && lineText.search("\\S") < 0) { + var preferredIndent = project.getLanguageService(false).getIndentationAtPosition(file, position, formatOptions); + var hasIndent = 0; + var i = void 0, len = void 0; + for (i = 0, len = lineText.length; i < len; i++) { + if (lineText.charAt(i) === " ") { + hasIndent++; } - if (preferredIndent !== hasIndent) { - var firstNoWhiteSpacePosition = lineInfo.offset + i; - edits.push({ - span: ts.createTextSpanFromBounds(lineInfo.offset, firstNoWhiteSpacePosition), - newText: ts.formatting.getIndentationString(preferredIndent, formatOptions) - }); + else if (lineText.charAt(i) === "\t") { + hasIndent += formatOptions.tabSize; + } + else { + break; } } + if (preferredIndent !== hasIndent) { + var firstNoWhiteSpacePosition = absolutePosition + i; + edits.push({ + span: ts.createTextSpanFromBounds(absolutePosition, firstNoWhiteSpacePosition), + newText: ts.formatting.getIndentationString(preferredIndent, formatOptions) + }); + } } } if (!edits) { @@ -76423,14 +78500,13 @@ var ts; return undefined; } if (simplifiedResult) { - return completions.entries.reduce(function (result, entry) { + return ts.mapDefined(completions.entries, function (entry) { if (completions.isMemberCompletion || (entry.name.toLowerCase().indexOf(prefix.toLowerCase()) === 0)) { var name = entry.name, kind = entry.kind, kindModifiers = entry.kindModifiers, sortText = entry.sortText, replacementSpan = entry.replacementSpan; var convertedSpan = replacementSpan ? _this.decorateSpan(replacementSpan, scriptInfo) : undefined; - result.push({ name: name, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }); + return { name: name, kind: kind, kindModifiers: kindModifiers, sortText: sortText, replacementSpan: convertedSpan }; } - return result; - }, []).sort(function (a, b) { return ts.compareStrings(a.name, b.name); }); + }).sort(function (a, b) { return ts.compareStrings(a.name, b.name); }); } else { return completions; @@ -76440,19 +78516,15 @@ var ts; var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; var scriptInfo = project.getScriptInfoForNormalizedPath(file); var position = this.getPosition(args, scriptInfo); - return args.entryNames.reduce(function (accum, entryName) { - var details = project.getLanguageService().getCompletionEntryDetails(file, position, entryName); - if (details) { - accum.push(details); - } - return accum; - }, []); + return ts.mapDefined(args.entryNames, function (entryName) { + return project.getLanguageService().getCompletionEntryDetails(file, position, entryName); + }); }; Session.prototype.getCompileOnSaveAffectedFileList = function (args) { var info = this.projectService.getScriptInfo(args.file); var result = []; if (!info) { - return []; + return server.emptyArray; } var projectsToSearch = args.projectFileName ? [this.projectService.findProject(args.projectFileName)] : info.containingProjects; for (var _i = 0, projectsToSearch_1 = projectsToSearch; _i < projectsToSearch_1.length; _i++) { @@ -76488,12 +78560,12 @@ var ts; return undefined; } if (simplifiedResult) { - var span_17 = helpItems.applicableSpan; + var span_18 = helpItems.applicableSpan; return { items: helpItems.items, applicableSpan: { - start: scriptInfo.positionToLineOffset(span_17.start), - end: scriptInfo.positionToLineOffset(span_17.start + span_17.length) + start: scriptInfo.positionToLineOffset(span_18.start), + end: scriptInfo.positionToLineOffset(span_18.start + span_18.length) }, selectedItemIndex: helpItems.selectedItemIndex, argumentIndex: helpItems.argumentIndex, @@ -76506,20 +78578,16 @@ var ts; }; Session.prototype.getDiagnostics = function (next, delay, fileNames) { var _this = this; - var checkList = fileNames.reduce(function (accum, uncheckedFileName) { + var checkList = ts.mapDefined(fileNames, function (uncheckedFileName) { var fileName = server.toNormalizedPath(uncheckedFileName); var project = _this.projectService.getDefaultProjectForFile(fileName, true); - if (project) { - accum.push({ fileName: fileName, project: project }); - } - return accum; - }, []); + return project && { fileName: fileName, project: project }; + }); if (checkList.length > 0) { - this.updateErrorCheck(next, checkList, this.changeSeq, function (n) { return n === _this.changeSeq; }, delay); + this.updateErrorCheck(next, checkList, delay); } }; Session.prototype.change = function (args) { - var _this = this; var _a = this.getFileAndProject(args, false), file = _a.file, project = _a.project; if (project) { var scriptInfo = project.getScriptInfoForNormalizedPath(file); @@ -76529,7 +78597,7 @@ var ts; scriptInfo.editContent(start, end, args.insertString); this.changeSeq++; } - this.updateProjectStructure(this.changeSeq, function (n) { return n === _this.changeSeq; }); + this.updateProjectStructure(); } }; Session.prototype.reload = function (args, reqSeq) { @@ -76539,7 +78607,7 @@ var ts; if (project) { this.changeSeq++; if (project.reloadScript(file, tempFileName)) { - this.output(undefined, CommandNames.Reload, reqSeq); + this.output(undefined, server.CommandNames.Reload, reqSeq); } } }; @@ -76608,7 +78676,7 @@ var ts; return server.combineProjectOutput(projects, function (project) { var navItems = project.getLanguageService().getNavigateToItems(args.searchValue, args.maxResultCount, fileName, project.isNonTsProject()); if (!navItems) { - return []; + return server.emptyArray; } return navItems.map(function (navItem) { var scriptInfo = project.getScriptInfo(navItem.fileName); @@ -76707,7 +78775,7 @@ var ts; } if (simplifiedResult) { var file_2 = result.renameFilename; - var location = undefined; + var location = void 0; if (file_2 !== undefined && result.renameLocation !== undefined) { var renameScriptInfo = project.getScriptInfoForNormalizedPath(server.toNormalizedPath(file_2)); location = renameScriptInfo.positionToLineOffset(result.renameLocation); @@ -76798,8 +78866,7 @@ var ts; : spans; }; Session.prototype.getDiagnosticsForProject = function (next, delay, fileName) { - var _this = this; - var _a = this.getProjectInfoWorker(fileName, undefined, true), fileNames = _a.fileNames, languageServiceDisabled = _a.languageServiceDisabled; + var _a = this.getProjectInfoWorker(fileName, undefined, true, true), fileNames = _a.fileNames, languageServiceDisabled = _a.languageServiceDisabled; if (languageServiceDisabled) { return; } @@ -76833,7 +78900,7 @@ var ts; fileNamesInProject = highPriorityFiles.concat(mediumPriorityFiles).concat(lowPriorityFiles).concat(veryLowPriorityFiles); if (fileNamesInProject.length > 0) { var checkList = fileNamesInProject.map(function (fileName) { return ({ fileName: fileName, project: project }); }); - this.updateErrorCheck(next, checkList, this.changeSeq, function (n) { return n === _this.changeSeq; }, delay, 200, false); + this.updateErrorCheck(next, checkList, delay, false); } }; Session.prototype.getCanonicalFileName = function (fileName) { @@ -76880,7 +78947,7 @@ var ts; } else { this.logger.msg("Unrecognized JSON command: " + JSON.stringify(request), server.Msg.Err); - this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); + this.output(undefined, server.CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); return { responseRequired: false }; } }; @@ -76919,7 +78986,7 @@ var ts; return; } this.logError(err, message); - this.output(undefined, request ? request.command : CommandNames.Unknown, request ? request.seq : 0, "Error processing request. " + err.message + "\n" + err.stack); + this.output(undefined, request ? request.command : server.CommandNames.Unknown, request ? request.seq : 0, "Error processing request. " + err.message + "\n" + err.stack); } }; return Session; @@ -76940,33 +79007,26 @@ var ts; CharRangeSection[CharRangeSection["Mid"] = 3] = "Mid"; CharRangeSection[CharRangeSection["End"] = 4] = "End"; CharRangeSection[CharRangeSection["PostEnd"] = 5] = "PostEnd"; - })(CharRangeSection = server.CharRangeSection || (server.CharRangeSection = {})); - var BaseLineIndexWalker = (function () { - function BaseLineIndexWalker() { - this.goSubtree = true; - this.done = false; - } - BaseLineIndexWalker.prototype.leaf = function (_rangeStart, _rangeLength, _ll) { - }; - return BaseLineIndexWalker; - }()); - var EditWalker = (function (_super) { - __extends(EditWalker, _super); + })(CharRangeSection || (CharRangeSection = {})); + var EditWalker = (function () { function EditWalker() { - var _this = _super.call(this) || this; - _this.lineIndex = new LineIndex(); - _this.endBranch = []; - _this.state = CharRangeSection.Entire; - _this.initialText = ""; - _this.trailingText = ""; - _this.suppressTrailingText = false; - _this.lineIndex.root = new LineNode(); - _this.startPath = [_this.lineIndex.root]; - _this.stack = [_this.lineIndex.root]; - return _this; - } - EditWalker.prototype.insertLines = function (insertedText) { - if (this.suppressTrailingText) { + this.goSubtree = true; + this.lineIndex = new LineIndex(); + this.endBranch = []; + this.state = 2; + this.initialText = ""; + this.trailingText = ""; + this.lineIndex.root = new LineNode(); + this.startPath = [this.lineIndex.root]; + this.stack = [this.lineIndex.root]; + } + Object.defineProperty(EditWalker.prototype, "done", { + get: function () { return false; }, + enumerable: true, + configurable: true + }); + EditWalker.prototype.insertLines = function (insertedText, suppressTrailingText) { + if (suppressTrailingText) { this.trailingText = ""; } if (insertedText) { @@ -76979,7 +79039,7 @@ var ts; var lines = lm.lines; if (lines.length > 1) { if (lines[lines.length - 1] === "") { - lines.length--; + lines.pop(); } } var branchParent; @@ -76999,20 +79059,18 @@ var ts; if (lastZeroCount) { branchParent.remove(lastZeroCount); } - var insertionNode = this.startPath[this.startPath.length - 2]; var leafNode = this.startPath[this.startPath.length - 1]; - var len = lines.length; - if (len > 0) { + if (lines.length > 0) { leafNode.text = lines[0]; - if (len > 1) { - var insertedNodes = new Array(len - 1); + if (lines.length > 1) { + var insertedNodes = new Array(lines.length - 1); var startNode = leafNode; for (var i = 1; i < lines.length; i++) { insertedNodes[i - 1] = new LineLeaf(lines[i]); } var pathIndex = this.startPath.length - 2; while (pathIndex >= 0) { - insertionNode = this.startPath[pathIndex]; + var insertionNode = this.startPath[pathIndex]; insertedNodes = insertionNode.insertAt(startNode, insertedNodes); pathIndex--; startNode = insertionNode; @@ -77034,6 +79092,7 @@ var ts; } } else { + var insertionNode = this.startPath[this.startPath.length - 2]; insertionNode.remove(leafNode); for (var j = this.startPath.length - 2; j >= 0; j--) { this.startPath[j].updateCounts(); @@ -77043,15 +79102,14 @@ var ts; }; EditWalker.prototype.post = function (_relativeStart, _relativeLength, lineCollection) { if (lineCollection === this.lineCollectionAtBranch) { - this.state = CharRangeSection.End; + this.state = 4; } - this.stack.length--; - return undefined; + this.stack.pop(); }; EditWalker.prototype.pre = function (_relativeStart, _relativeLength, lineCollection, _parent, nodeType) { var currentNode = this.stack[this.stack.length - 1]; - if ((this.state === CharRangeSection.Entire) && (nodeType === CharRangeSection.Start)) { - this.state = CharRangeSection.Start; + if ((this.state === 2) && (nodeType === 1)) { + this.state = 1; this.branchNode = currentNode; this.lineCollectionAtBranch = lineCollection; } @@ -77064,68 +79122,67 @@ var ts; return new LineNode(); } switch (nodeType) { - case CharRangeSection.PreStart: + case 0: this.goSubtree = false; - if (this.state !== CharRangeSection.End) { + if (this.state !== 4) { currentNode.add(lineCollection); } break; - case CharRangeSection.Start: - if (this.state === CharRangeSection.End) { + case 1: + if (this.state === 4) { this.goSubtree = false; } else { child = fresh(lineCollection); currentNode.add(child); - this.startPath[this.startPath.length] = child; + this.startPath.push(child); } break; - case CharRangeSection.Entire: - if (this.state !== CharRangeSection.End) { + case 2: + if (this.state !== 4) { child = fresh(lineCollection); currentNode.add(child); - this.startPath[this.startPath.length] = child; + this.startPath.push(child); } else { if (!lineCollection.isLeaf()) { child = fresh(lineCollection); currentNode.add(child); - this.endBranch[this.endBranch.length] = child; + this.endBranch.push(child); } } break; - case CharRangeSection.Mid: + case 3: this.goSubtree = false; break; - case CharRangeSection.End: - if (this.state !== CharRangeSection.End) { + case 4: + if (this.state !== 4) { this.goSubtree = false; } else { if (!lineCollection.isLeaf()) { child = fresh(lineCollection); currentNode.add(child); - this.endBranch[this.endBranch.length] = child; + this.endBranch.push(child); } } break; - case CharRangeSection.PostEnd: + case 5: this.goSubtree = false; - if (this.state !== CharRangeSection.Start) { + if (this.state !== 1) { currentNode.add(lineCollection); } break; } if (this.goSubtree) { - this.stack[this.stack.length] = child; + this.stack.push(child); } - return lineCollection; }; EditWalker.prototype.leaf = function (relativeStart, relativeLength, ll) { - if (this.state === CharRangeSection.Start) { + if (this.state === 1) { this.initialText = ll.text.substring(0, relativeStart); } - else if (this.state === CharRangeSection.Entire) { + else if (this.state === 2) { this.initialText = ll.text.substring(0, relativeStart); this.trailingText = ll.text.substring(relativeStart + relativeLength); } @@ -77134,7 +79191,7 @@ var ts; } }; return EditWalker; - }(BaseLineIndexWalker)); + }()); var TextChange = (function () { function TextChange(pos, deleteLen, insertedText) { this.pos = pos; @@ -77146,7 +79203,6 @@ var ts; }; return TextChange; }()); - server.TextChange = TextChange; var ScriptVersionCache = (function () { function ScriptVersionCache() { this.changes = []; @@ -77164,43 +79220,27 @@ var ts; return this.currentVersion % ScriptVersionCache.maxVersions; }; ScriptVersionCache.prototype.edit = function (pos, deleteLen, insertedText) { - this.changes[this.changes.length] = new TextChange(pos, deleteLen, insertedText); - if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) || - (deleteLen > ScriptVersionCache.changeLengthThreshold) || - (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) { - this.getSnapshot(); - } - }; - ScriptVersionCache.prototype.latest = function () { - return this.versions[this.currentVersionToIndex()]; - }; - ScriptVersionCache.prototype.latestVersion = function () { - if (this.changes.length > 0) { + this.changes.push(new TextChange(pos, deleteLen, insertedText)); + if (this.changes.length > ScriptVersionCache.changeNumberThreshold || + deleteLen > ScriptVersionCache.changeLengthThreshold || + insertedText && insertedText.length > ScriptVersionCache.changeLengthThreshold) { this.getSnapshot(); } - return this.currentVersion; - }; - ScriptVersionCache.prototype.reloadFromFile = function (filename) { - var content = this.host.readFile(filename); - if (!content) { - content = ""; - } - this.reload(content); }; ScriptVersionCache.prototype.reload = function (script) { this.currentVersion++; this.changes = []; - var snap = new LineIndexSnapshot(this.currentVersion, this); + var snap = new LineIndexSnapshot(this.currentVersion, this, new LineIndex()); for (var i = 0; i < this.versions.length; i++) { this.versions[i] = undefined; } this.versions[this.currentVersionToIndex()] = snap; - snap.index = new LineIndex(); var lm = LineIndex.linesFromText(script); snap.index.load(lm.lines); this.minVersion = this.currentVersion; }; - ScriptVersionCache.prototype.getSnapshot = function () { + ScriptVersionCache.prototype.getSnapshot = function () { return this._getSnapshot(); }; + ScriptVersionCache.prototype._getSnapshot = function () { var snap = this.versions[this.currentVersionToIndex()]; if (this.changes.length > 0) { var snapIndex = snap.index; @@ -77208,9 +79248,7 @@ var ts; var change = _a[_i]; snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); } - snap = new LineIndexSnapshot(this.currentVersion + 1, this); - snap.index = snapIndex; - snap.changesSincePreviousVersion = this.changes; + snap = new LineIndexSnapshot(this.currentVersion + 1, this, snapIndex, this.changes); this.currentVersion = snap.version; this.versions[this.currentVersionToIndex()] = snap; this.changes = []; @@ -77220,6 +79258,24 @@ var ts; } return snap; }; + ScriptVersionCache.prototype.getSnapshotVersion = function () { + return this._getSnapshot().version; + }; + ScriptVersionCache.prototype.getLineInfo = function (line) { + return this._getSnapshot().index.lineNumberToInfo(line); + }; + ScriptVersionCache.prototype.lineOffsetToPosition = function (line, column) { + return this._getSnapshot().index.absolutePositionOfStartOfLine(line) + (column - 1); + }; + ScriptVersionCache.prototype.positionToLineOffset = function (position) { + return this._getSnapshot().index.positionToLineOffset(position); + }; + ScriptVersionCache.prototype.lineToTextSpan = function (line) { + var index = this._getSnapshot().index; + var _a = index.lineNumberToInfo(line + 1), lineText = _a.lineText, absolutePosition = _a.absolutePosition; + var len = lineText !== undefined ? lineText.length : index.absolutePositionOfStartOfLine(line + 2) - absolutePosition; + return ts.createTextSpan(absolutePosition, len); + }; ScriptVersionCache.prototype.getTextChangesBetweenVersions = function (oldVersion, newVersion) { if (oldVersion < newVersion) { if (oldVersion >= this.minVersion) { @@ -77228,7 +79284,7 @@ var ts; var snap = this.versions[this.versionToIndex(i)]; for (var _i = 0, _a = snap.changesSincePreviousVersion; _i < _a.length; _i++) { var textChange = _a[_i]; - textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); + textChangeRanges.push(textChange.getTextChangeRange()); } } return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges); @@ -77241,12 +79297,10 @@ var ts; return ts.unchangedTextChangeRange; } }; - ScriptVersionCache.fromString = function (host, script) { + ScriptVersionCache.fromString = function (script) { var svc = new ScriptVersionCache(); - var snap = new LineIndexSnapshot(0, svc); + var snap = new LineIndexSnapshot(0, svc, new LineIndex()); svc.versions[svc.currentVersion] = snap; - svc.host = host; - snap.index = new LineIndex(); var lm = LineIndex.linesFromText(script); snap.index.load(lm.lines); return svc; @@ -77258,10 +79312,12 @@ var ts; }()); server.ScriptVersionCache = ScriptVersionCache; var LineIndexSnapshot = (function () { - function LineIndexSnapshot(version, cache) { + function LineIndexSnapshot(version, cache, index, changesSincePreviousVersion) { + if (changesSincePreviousVersion === void 0) { changesSincePreviousVersion = server.emptyArray; } this.version = version; this.cache = cache; - this.changesSincePreviousVersion = []; + this.index = index; + this.changesSincePreviousVersion = changesSincePreviousVersion; } LineIndexSnapshot.prototype.getText = function (rangeStart, rangeEnd) { return this.index.getText(rangeStart, rangeEnd - rangeStart); @@ -77269,59 +79325,40 @@ var ts; LineIndexSnapshot.prototype.getLength = function () { return this.index.root.charCount(); }; - LineIndexSnapshot.prototype.getLineStartPositions = function () { - var starts = [-1]; - var count = 1; - var pos = 0; - this.index.every(function (ll) { - starts[count] = pos; - count++; - pos += ll.text.length; - return true; - }, 0); - return starts; - }; - LineIndexSnapshot.prototype.getLineMapper = function () { - var _this = this; - return function (line) { - return _this.index.lineNumberToInfo(line).offset; - }; - }; - LineIndexSnapshot.prototype.getTextChangeRangeSinceVersion = function (scriptVersion) { - if (this.version <= scriptVersion) { - return ts.unchangedTextChangeRange; - } - else { - return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version); - } - }; LineIndexSnapshot.prototype.getChangeRange = function (oldSnapshot) { if (oldSnapshot instanceof LineIndexSnapshot && this.cache === oldSnapshot.cache) { - return this.getTextChangeRangeSinceVersion(oldSnapshot.version); + if (this.version <= oldSnapshot.version) { + return ts.unchangedTextChangeRange; + } + else { + return this.cache.getTextChangesBetweenVersions(oldSnapshot.version, this.version); + } } }; return LineIndexSnapshot; }()); - server.LineIndexSnapshot = LineIndexSnapshot; var LineIndex = (function () { function LineIndex() { this.checkEdits = false; } - LineIndex.prototype.charOffsetToLineNumberAndPos = function (charOffset) { - return this.root.charOffsetToLineNumberAndPos(1, charOffset); + LineIndex.prototype.absolutePositionOfStartOfLine = function (oneBasedLine) { + return this.lineNumberToInfo(oneBasedLine).absolutePosition; }; - LineIndex.prototype.lineNumberToInfo = function (lineNumber) { + LineIndex.prototype.positionToLineOffset = function (position) { + var _a = this.root.charOffsetToLineInfo(1, position), oneBasedLine = _a.oneBasedLine, zeroBasedColumn = _a.zeroBasedColumn; + return { line: oneBasedLine, offset: zeroBasedColumn + 1 }; + }; + LineIndex.prototype.positionToColumnAndLineText = function (position) { + return this.root.charOffsetToLineInfo(1, position); + }; + LineIndex.prototype.lineNumberToInfo = function (oneBasedLine) { var lineCount = this.root.lineCount(); - if (lineNumber <= lineCount) { - var lineInfo = this.root.lineNumberToInfo(lineNumber, 0); - lineInfo.line = lineNumber; - return lineInfo; + if (oneBasedLine <= lineCount) { + var _a = this.root.lineNumberToInfo(oneBasedLine, 0), position = _a.position, leaf = _a.leaf; + return { absolutePosition: position, lineText: leaf && leaf.text }; } else { - return { - line: lineNumber, - offset: this.root.charCount() - }; + return { absolutePosition: this.root.charCount(), lineText: undefined }; } }; LineIndex.prototype.load = function (lines) { @@ -77372,11 +79409,8 @@ var ts; return !walkFns.done; }; LineIndex.prototype.edit = function (pos, deleteLength, newText) { - function editFlat(source, s, dl, nt) { - if (nt === void 0) { nt = ""; } - return source.substring(0, s) + nt + source.substring(s + dl, source.length); - } if (this.root.charCount() === 0) { + ts.Debug.assert(deleteLength === 0); if (newText !== undefined) { this.load(LineIndex.linesFromText(newText).lines); return this; @@ -77385,9 +79419,11 @@ var ts; else { var checkText = void 0; if (this.checkEdits) { - checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); + var source = this.getText(0, this.root.charCount()); + checkText = source.slice(0, pos) + newText + source.slice(pos + deleteLength); } var walker = new EditWalker(); + var suppressTrailingText = false; if (pos >= this.root.charCount()) { pos = this.root.charCount() - 1; var endString = this.getText(pos, 1); @@ -77398,88 +79434,68 @@ var ts; newText = endString; } deleteLength = 0; - walker.suppressTrailingText = true; + suppressTrailingText = true; } else if (deleteLength > 0) { var e = pos + deleteLength; - var lineInfo = this.charOffsetToLineNumberAndPos(e); - if ((lineInfo && (lineInfo.offset === 0))) { - deleteLength += lineInfo.text.length; - if (newText) { - newText = newText + lineInfo.text; - } - else { - newText = lineInfo.text; - } + var _a = this.positionToColumnAndLineText(e), zeroBasedColumn = _a.zeroBasedColumn, lineText = _a.lineText; + if (zeroBasedColumn === 0) { + deleteLength += lineText.length; + newText = newText ? newText + lineText : lineText; } } - if (pos < this.root.charCount()) { - this.root.walk(pos, deleteLength, walker); - walker.insertLines(newText); - } + this.root.walk(pos, deleteLength, walker); + walker.insertLines(newText, suppressTrailingText); if (this.checkEdits) { - var updatedText = this.getText(0, this.root.charCount()); + var updatedText = walker.lineIndex.getText(0, walker.lineIndex.getLength()); ts.Debug.assert(checkText === updatedText, "buffer edit mismatch"); } return walker.lineIndex; } }; LineIndex.buildTreeFromBottom = function (nodes) { - var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity); - var interiorNodes = []; - var nodeIndex = 0; - for (var i = 0; i < nodeCount; i++) { - interiorNodes[i] = new LineNode(); - var charCount = 0; - var lineCount = 0; - for (var j = 0; j < lineCollectionCapacity; j++) { - if (nodeIndex < nodes.length) { - interiorNodes[i].add(nodes[nodeIndex]); - charCount += nodes[nodeIndex].charCount(); - lineCount += nodes[nodeIndex].lineCount(); - } - else { - break; - } - nodeIndex++; - } - interiorNodes[i].totalChars = charCount; - interiorNodes[i].totalLines = lineCount; + if (nodes.length < lineCollectionCapacity) { + return new LineNode(nodes); } - if (interiorNodes.length === 1) { - return interiorNodes[0]; - } - else { - return this.buildTreeFromBottom(interiorNodes); + var interiorNodes = new Array(Math.ceil(nodes.length / lineCollectionCapacity)); + var nodeIndex = 0; + for (var i = 0; i < interiorNodes.length; i++) { + var end = Math.min(nodeIndex + lineCollectionCapacity, nodes.length); + interiorNodes[i] = new LineNode(nodes.slice(nodeIndex, end)); + nodeIndex = end; } + return this.buildTreeFromBottom(interiorNodes); }; LineIndex.linesFromText = function (text) { - var lineStarts = ts.computeLineStarts(text); - if (lineStarts.length === 0) { - return { lines: [], lineMap: lineStarts }; + var lineMap = ts.computeLineStarts(text); + if (lineMap.length === 0) { + return { lines: [], lineMap: lineMap }; } - var lines = new Array(lineStarts.length); - var lc = lineStarts.length - 1; + var lines = new Array(lineMap.length); + var lc = lineMap.length - 1; for (var lmi = 0; lmi < lc; lmi++) { - lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); + lines[lmi] = text.substring(lineMap[lmi], lineMap[lmi + 1]); } - var endText = text.substring(lineStarts[lc]); + var endText = text.substring(lineMap[lc]); if (endText.length > 0) { lines[lc] = endText; } else { - lines.length--; + lines.pop(); } - return { lines: lines, lineMap: lineStarts }; + return { lines: lines, lineMap: lineMap }; }; return LineIndex; }()); server.LineIndex = LineIndex; var LineNode = (function () { - function LineNode() { + function LineNode(children) { + if (children === void 0) { children = []; } + this.children = children; this.totalChars = 0; this.totalLines = 0; - this.children = []; + if (children.length) + this.updateCounts(); } LineNode.prototype.isLeaf = function () { return false; @@ -77516,40 +79532,37 @@ var ts; }; LineNode.prototype.walk = function (rangeStart, rangeLength, walkFns) { var childIndex = 0; - var child = this.children[0]; - var childCharCount = child.charCount(); + var childCharCount = this.children[childIndex].charCount(); var adjustedStart = rangeStart; while (adjustedStart >= childCharCount) { - this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); + this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, 0); adjustedStart -= childCharCount; childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); + childCharCount = this.children[childIndex].charCount(); } if ((adjustedStart + rangeLength) <= childCharCount) { - if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { + if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, 2)) { return; } } else { - if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { + if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, 1)) { return; } var adjustedLength = rangeLength - (childCharCount - adjustedStart); childIndex++; - child = this.children[childIndex]; + var child = this.children[childIndex]; childCharCount = child.charCount(); while (adjustedLength > childCharCount) { - if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { + if (this.execWalk(0, childCharCount, walkFns, childIndex, 3)) { return; } adjustedLength -= childCharCount; childIndex++; - child = this.children[childIndex]; - childCharCount = child.charCount(); + childCharCount = this.children[childIndex].charCount(); } if (adjustedLength > 0) { - if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { + if (this.execWalk(0, adjustedLength, walkFns, childIndex, 4)) { return; } } @@ -77558,102 +79571,46 @@ var ts; var clen = this.children.length; if (childIndex < (clen - 1)) { for (var ej = childIndex + 1; ej < clen; ej++) { - this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); + this.skipChild(0, 0, ej, walkFns, 5); } } } }; - LineNode.prototype.charOffsetToLineNumberAndPos = function (lineNumber, charOffset) { - var childInfo = this.childFromCharOffset(lineNumber, charOffset); - if (!childInfo.child) { - return { - line: lineNumber, - offset: charOffset, - }; + LineNode.prototype.charOffsetToLineInfo = function (lineNumberAccumulator, relativePosition) { + if (this.children.length === 0) { + return { oneBasedLine: lineNumberAccumulator, zeroBasedColumn: relativePosition, lineText: undefined }; } - else if (childInfo.childIndex < this.children.length) { - if (childInfo.child.isLeaf()) { - return { - line: childInfo.lineNumber, - offset: childInfo.charOffset, - text: (childInfo.child).text, - leaf: (childInfo.child) - }; + for (var _i = 0, _a = this.children; _i < _a.length; _i++) { + var child = _a[_i]; + if (child.charCount() > relativePosition) { + if (child.isLeaf()) { + return { oneBasedLine: lineNumberAccumulator, zeroBasedColumn: relativePosition, lineText: child.text }; + } + else { + return child.charOffsetToLineInfo(lineNumberAccumulator, relativePosition); + } } else { - var lineNode = (childInfo.child); - return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); + relativePosition -= child.charCount(); + lineNumberAccumulator += child.lineCount(); } } - else { - var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); - return { line: this.lineCount(), offset: lineInfo.leaf.charCount() }; - } - }; - LineNode.prototype.lineNumberToInfo = function (lineNumber, charOffset) { - var childInfo = this.childFromLineNumber(lineNumber, charOffset); - if (!childInfo.child) { - return { - line: lineNumber, - offset: charOffset - }; - } - else if (childInfo.child.isLeaf()) { - return { - line: lineNumber, - offset: childInfo.charOffset, - text: (childInfo.child).text, - leaf: (childInfo.child) - }; - } - else { - var lineNode = (childInfo.child); - return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); - } + var leaf = this.lineNumberToInfo(this.lineCount(), 0).leaf; + return { oneBasedLine: this.lineCount(), zeroBasedColumn: leaf.charCount(), lineText: undefined }; }; - LineNode.prototype.childFromLineNumber = function (lineNumber, charOffset) { - var child; - var relativeLineNumber = lineNumber; - var i; - var len; - for (i = 0, len = this.children.length; i < len; i++) { - child = this.children[i]; + LineNode.prototype.lineNumberToInfo = function (relativeOneBasedLine, positionAccumulator) { + for (var _i = 0, _a = this.children; _i < _a.length; _i++) { + var child = _a[_i]; var childLineCount = child.lineCount(); - if (childLineCount >= relativeLineNumber) { - break; - } - else { - relativeLineNumber -= childLineCount; - charOffset += child.charCount(); - } - } - return { - child: child, - childIndex: i, - relativeLineNumber: relativeLineNumber, - charOffset: charOffset - }; - }; - LineNode.prototype.childFromCharOffset = function (lineNumber, charOffset) { - var child; - var i; - var len; - for (i = 0, len = this.children.length; i < len; i++) { - child = this.children[i]; - if (child.charCount() > charOffset) { - break; + if (childLineCount >= relativeOneBasedLine) { + return child.isLeaf() ? { position: positionAccumulator, leaf: child } : child.lineNumberToInfo(relativeOneBasedLine, positionAccumulator); } else { - charOffset -= child.charCount(); - lineNumber += child.lineCount(); + relativeOneBasedLine -= childLineCount; + positionAccumulator += child.charCount(); } } - return { - child: child, - childIndex: i, - charOffset: charOffset, - lineNumber: lineNumber - }; + return { position: positionAccumulator, leaf: undefined }; }; LineNode.prototype.splitAfter = function (childIndex) { var splitNode; @@ -77679,13 +79636,11 @@ var ts; this.children[i] = this.children[i + 1]; } } - this.children.length--; + this.children.pop(); }; LineNode.prototype.findChildIndex = function (child) { - var childIndex = 0; - var clen = this.children.length; - while ((this.children[childIndex] !== child) && (childIndex < clen)) - childIndex++; + var childIndex = this.children.indexOf(child); + ts.Debug.assert(childIndex !== -1); return childIndex; }; LineNode.prototype.insertAt = function (child, nodes) { @@ -77726,12 +79681,12 @@ var ts; } for (var i = splitNodes.length - 1; i >= 0; i--) { if (splitNodes[i].children.length === 0) { - splitNodes.length--; + splitNodes.pop(); } } } if (shiftNode) { - splitNodes[splitNodes.length] = shiftNode; + splitNodes.push(shiftNode); } this.updateCounts(); for (var i = 0; i < splitNodeCount; i++) { @@ -77741,8 +79696,8 @@ var ts; } }; LineNode.prototype.add = function (collection) { - this.children[this.children.length] = collection; - return (this.children.length < lineCollectionCapacity); + this.children.push(collection); + ts.Debug.assert(this.children.length <= lineCollectionCapacity); }; LineNode.prototype.charCount = function () { return this.totalChars; @@ -77752,7 +79707,6 @@ var ts; }; return LineNode; }()); - server.LineNode = LineNode; var LineLeaf = (function () { function LineLeaf(text) { this.text = text; @@ -77771,7 +79725,6 @@ var ts; }; return LineLeaf; }()); - server.LineLeaf = LineLeaf; })(server = ts.server || (ts.server = {})); })(ts || (ts = {})); var ts; @@ -77787,7 +79740,7 @@ var ts; } TextStorage.prototype.getVersion = function () { return this.svc - ? "SVC-" + this.svcVersion + "-" + this.svc.getSnapshot().version + ? "SVC-" + this.svcVersion + "-" + this.svc.getSnapshotVersion() : "Text-" + this.textVersion; }; TextStorage.prototype.hasScriptVersionCache = function () { @@ -77825,7 +79778,7 @@ var ts; : ts.ScriptSnapshot.fromString(this.getOrLoadText()); }; TextStorage.prototype.getLineInfo = function (line) { - return this.switchToScriptVersionCache().getSnapshot().index.lineNumberToInfo(line); + return this.switchToScriptVersionCache().getLineInfo(line); }; TextStorage.prototype.lineToTextSpan = function (line) { if (!this.svc) { @@ -77834,34 +79787,20 @@ var ts; var end = line + 1 < lineMap.length ? lineMap[line + 1] : this.text.length; return ts.createTextSpanFromBounds(start, end); } - var index = this.svc.getSnapshot().index; - var lineInfo = index.lineNumberToInfo(line + 1); - var len; - if (lineInfo.leaf) { - len = lineInfo.leaf.text.length; - } - else { - var nextLineInfo = index.lineNumberToInfo(line + 2); - len = nextLineInfo.offset - lineInfo.offset; - } - return ts.createTextSpan(lineInfo.offset, len); + return this.svc.lineToTextSpan(line); }; TextStorage.prototype.lineOffsetToPosition = function (line, offset) { if (!this.svc) { - return ts.computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1); + return ts.computePositionOfLineAndCharacter(this.getLineMap(), line - 1, offset - 1, this.text); } - var index = this.svc.getSnapshot().index; - var lineInfo = index.lineNumberToInfo(line); - return (lineInfo.offset + offset - 1); + return this.svc.lineOffsetToPosition(line, offset); }; TextStorage.prototype.positionToLineOffset = function (position) { if (!this.svc) { var _a = ts.computeLineAndCharacterOfPosition(this.getLineMap(), position), line = _a.line, character = _a.character; return { line: line + 1, offset: character + 1 }; } - var index = this.svc.getSnapshot().index; - var lineOffset = index.charOffsetToLineNumberAndPos(position); - return { line: lineOffset.line, offset: lineOffset.offset + 1 }; + return this.svc.positionToLineOffset(position); }; TextStorage.prototype.getFileText = function (tempFileName) { return this.host.readFile(tempFileName || this.fileName) || ""; @@ -77871,7 +79810,7 @@ var ts; }; TextStorage.prototype.switchToScriptVersionCache = function (newText) { if (!this.svc) { - this.svc = server.ScriptVersionCache.fromString(this.host, newText !== undefined ? newText : this.getOrLoadText()); + this.svc = server.ScriptVersionCache.fromString(newText !== undefined ? newText : this.getOrLoadText()); this.svcVersion++; this.text = undefined; } @@ -77968,7 +79907,7 @@ var ts; } break; default: - server.removeItemFromSet(this.containingProjects, project); + ts.unorderedRemoveItem(this.containingProjects, project); break; } }; @@ -77977,7 +79916,7 @@ var ts; var p = _a[_i]; p.removeFile(this, false); } - this.containingProjects.length = 0; + ts.clear(this.containingProjects); }; ScriptInfo.prototype.getDefaultProject = function () { switch (this.containingProjects.length) { @@ -78083,8 +80022,8 @@ var ts; this.host = host; this.project = project; this.cancellationToken = cancellationToken; - this.resolvedModuleNames = ts.createFileMap(); - this.resolvedTypeReferenceDirectives = ts.createFileMap(); + this.resolvedModuleNames = ts.createMap(); + this.resolvedTypeReferenceDirectives = ts.createMap(); this.cancellationToken = new ts.ThrottledCancellationToken(cancellationToken, project.projectService.throttleWaitMilliseconds); this.getCanonicalFileName = ts.createGetCanonicalFileName(this.host.useCaseSensitiveFileNames); if (host.trace) { @@ -78095,7 +80034,7 @@ var ts; ? _this.project.projectService.typingsInstaller.globalTypingsCacheLocation : undefined; var primaryResult = ts.resolveModuleName(moduleName, containingFile, compilerOptions, host); - if (ts.moduleHasNonRelativeName(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTypeScript(primaryResult.resolvedModule.extension)) && globalCache !== undefined) { + if (!ts.isExternalModuleNameRelative(moduleName) && !(primaryResult.resolvedModule && ts.extensionIsTypeScript(primaryResult.resolvedModule.extension)) && globalCache !== undefined) { var _a = ts.loadModuleFromGlobalCache(moduleName, _this.project.getProjectName(), compilerOptions, host, globalCache), resolvedModule = _a.resolvedModule, failedLookupLocations = _a.failedLookupLocations; if (resolvedModule) { return { resolvedModule: resolvedModule, failedLookupLocations: primaryResult.failedLookupLocations.concat(failedLookupLocations) }; @@ -78227,8 +80166,9 @@ var ts; LSHost.prototype.resolvePath = function (path) { return this.host.resolvePath(path); }; - LSHost.prototype.fileExists = function (path) { - return this.host.fileExists(path); + LSHost.prototype.fileExists = function (file) { + var path = ts.toPath(file, this.host.getCurrentDirectory(), this.getCanonicalFileName); + return !this.project.isWatchedMissingFile(path) && this.host.fileExists(file); }; LSHost.prototype.readFile = function (fileName) { return this.host.readFile(fileName); @@ -78236,15 +80176,15 @@ var ts; LSHost.prototype.directoryExists = function (path) { return this.host.directoryExists(path); }; - LSHost.prototype.readDirectory = function (path, extensions, exclude, include) { - return this.host.readDirectory(path, extensions, exclude, include); + LSHost.prototype.readDirectory = function (path, extensions, exclude, include, depth) { + return this.host.readDirectory(path, extensions, exclude, include, depth); }; LSHost.prototype.getDirectories = function (path) { return this.host.getDirectories(path); }; LSHost.prototype.notifyFileRemoved = function (info) { - this.resolvedModuleNames.remove(info.path); - this.resolvedTypeReferenceDirectives.remove(info.path); + this.resolvedModuleNames.delete(info.path); + this.resolvedTypeReferenceDirectives.delete(info.path); }; LSHost.prototype.setCompilationSettings = function (opt) { if (ts.changesAffectModuleResolution(this.compilationSettings, opt)) { @@ -78348,7 +80288,7 @@ var ts; this.perProjectCache.set(projectName, { compilerOptions: compilerOptions, typeAcquisition: typeAcquisition, - typings: server.toSortedReadonlyArray(newTypings), + typings: server.toSortedArray(newTypings), unresolvedImports: unresolvedImports, poisoned: false }); @@ -78423,7 +80363,7 @@ var ts; this.ctor = ctor; } AbstractBuilder.prototype.getFileInfos = function () { - return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = ts.createFileMap()); + return this.fileInfos_doNotAccessDirectly || (this.fileInfos_doNotAccessDirectly = ts.createMap()); }; AbstractBuilder.prototype.hasFileInfos = function () { return !!this.fileInfos_doNotAccessDirectly; @@ -78444,16 +80384,16 @@ var ts; return fileInfo; }; AbstractBuilder.prototype.getFileInfoPaths = function () { - return this.getFileInfos().getKeys(); + return ts.arrayFrom(this.getFileInfos().keys()); }; AbstractBuilder.prototype.setFileInfo = function (path, info) { this.getFileInfos().set(path, info); }; AbstractBuilder.prototype.removeFileInfo = function (path) { - this.getFileInfos().remove(path); + this.getFileInfos().delete(path); }; AbstractBuilder.prototype.forEachFileInfo = function (action) { - this.getFileInfos().forEachValue(function (_path, value) { return action(value); }); + this.getFileInfos().forEach(action); }; AbstractBuilder.prototype.emitFile = function (scriptInfo, writeFile) { this.ensureFileInfoIfInProject(scriptInfo); @@ -78514,50 +80454,25 @@ var ts; __extends(ModuleBuilderFileInfo, _super); function ModuleBuilderFileInfo() { var _this = _super !== null && _super.apply(this, arguments) || this; - _this.references = []; - _this.referencedBy = []; + _this.references = server.createSortedArray(); + _this.referencedBy = server.createSortedArray(); return _this; } ModuleBuilderFileInfo.compareFileInfos = function (lf, rf) { - var l = lf.scriptInfo.fileName; - var r = rf.scriptInfo.fileName; - return (l < r ? -1 : (l > r ? 1 : 0)); - }; - ModuleBuilderFileInfo.addToReferenceList = function (array, fileInfo) { - if (array.length === 0) { - array.push(fileInfo); - return; - } - var insertIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos); - if (insertIndex < 0) { - array.splice(~insertIndex, 0, fileInfo); - } - }; - ModuleBuilderFileInfo.removeFromReferenceList = function (array, fileInfo) { - if (!array || array.length === 0) { - return; - } - if (array[0] === fileInfo) { - array.splice(0, 1); - return; - } - var removeIndex = ts.binarySearch(array, fileInfo, ModuleBuilderFileInfo.compareFileInfos); - if (removeIndex >= 0) { - array.splice(removeIndex, 1); - } + return ts.compareStrings(lf.scriptInfo.fileName, rf.scriptInfo.fileName); }; ModuleBuilderFileInfo.prototype.addReferencedBy = function (fileInfo) { - ModuleBuilderFileInfo.addToReferenceList(this.referencedBy, fileInfo); + server.insertSorted(this.referencedBy, fileInfo, ModuleBuilderFileInfo.compareFileInfos); }; ModuleBuilderFileInfo.prototype.removeReferencedBy = function (fileInfo) { - ModuleBuilderFileInfo.removeFromReferenceList(this.referencedBy, fileInfo); + server.removeSorted(this.referencedBy, fileInfo, ModuleBuilderFileInfo.compareFileInfos); }; ModuleBuilderFileInfo.prototype.removeFileReferences = function () { for (var _i = 0, _a = this.references; _i < _a.length; _i++) { var reference = _a[_i]; reference.removeReferencedBy(this); } - this.references = []; + ts.clear(this.references); }; return ModuleBuilderFileInfo; }(BuilderFileInfo)); @@ -78575,13 +80490,10 @@ var ts; ModuleBuilder.prototype.getReferencedFileInfos = function (fileInfo) { var _this = this; if (!fileInfo.isExternalModuleOrHasOnlyAmbientExternalModules()) { - return []; + return server.createSortedArray(); } var referencedFilePaths = this.project.getReferencedFiles(fileInfo.scriptInfo.path); - if (referencedFilePaths.length > 0) { - return ts.map(referencedFilePaths, function (f) { return _this.getOrCreateFileInfo(f); }).sort(ModuleBuilderFileInfo.compareFileInfos); - } - return []; + return server.toSortedArray(referencedFilePaths.map(function (f) { return _this.getOrCreateFileInfo(f); }), ModuleBuilderFileInfo.compareFileInfos); }; ModuleBuilder.prototype.ensureFileInfoIfInProject = function (_scriptInfo) { this.ensureProjectDependencyGraphUpToDate(); @@ -78615,31 +80527,9 @@ var ts; } var newReferences = this.getReferencedFileInfos(fileInfo); var oldReferences = fileInfo.references; - var oldIndex = 0; - var newIndex = 0; - while (oldIndex < oldReferences.length && newIndex < newReferences.length) { - var oldReference = oldReferences[oldIndex]; - var newReference = newReferences[newIndex]; - var compare = ModuleBuilderFileInfo.compareFileInfos(oldReference, newReference); - if (compare < 0) { - oldReference.removeReferencedBy(fileInfo); - oldIndex++; - } - else if (compare > 0) { - newReference.addReferencedBy(fileInfo); - newIndex++; - } - else { - oldIndex++; - newIndex++; - } - } - for (var i = oldIndex; i < oldReferences.length; i++) { - oldReferences[i].removeReferencedBy(fileInfo); - } - for (var i = newIndex; i < newReferences.length; i++) { - newReferences[i].addReferencedBy(fileInfo); - } + server.enumerateInsertsAndDeletes(newReferences, oldReferences, function (newReference) { return newReference.addReferencedBy(fileInfo); }, function (oldReference) { + oldReference.removeReferencedBy(fileInfo); + }, ModuleBuilderFileInfo.compareFileInfos); fileInfo.references = newReferences; fileInfo.scriptVersionForReferences = fileInfo.scriptInfo.getLatestVersion(); }; @@ -78744,7 +80634,7 @@ var ts; server.allFilesAreJsOrDts = allFilesAreJsOrDts; var UnresolvedImportsMap = (function () { function UnresolvedImportsMap() { - this.perFileMap = ts.createFileMap(); + this.perFileMap = ts.createMap(); this.version = 0; } UnresolvedImportsMap.prototype.clear = function () { @@ -78755,7 +80645,7 @@ var ts; return this.version; }; UnresolvedImportsMap.prototype.remove = function (path) { - this.perFileMap.remove(path); + this.perFileMap.delete(path); this.version++; }; UnresolvedImportsMap.prototype.get = function (path) { @@ -78777,7 +80667,8 @@ var ts; this.compilerOptions = compilerOptions; this.compileOnSaveEnabled = compileOnSaveEnabled; this.rootFiles = []; - this.rootFilesMap = ts.createFileMap(); + this.rootFilesMap = ts.createMap(); + this.missingFilesMap = ts.createMap(); this.cachedUnresolvedImportsPerFile = new UnresolvedImportsMap(); this.languageServiceEnabled = true; this.lastReportedVersion = 0; @@ -78818,7 +80709,8 @@ var ts; log("Loading " + moduleName + " from " + initialDir + " (resolved to " + resolvedPath + ")"); var result = host.require(resolvedPath, moduleName); if (result.error) { - log("Failed to load module: " + JSON.stringify(result.error)); + var err = result.error.stack || result.error.message || JSON.stringify(result.error); + log("Failed to load module '" + moduleName + "': " + err); return undefined; } return result.module; @@ -78828,7 +80720,10 @@ var ts; this.compilerOptions.noEmitForJsFiles = true; } }; - Project.prototype.getProjectErrors = function () { + Project.prototype.getGlobalProjectErrors = function () { + return ts.filter(this.projectErrors, function (diagnostic) { return !diagnostic.file; }); + }; + Project.prototype.getAllProjectErrors = function () { return this.projectErrors; }; Project.prototype.getLanguageService = function (ensureSynchronized) { @@ -78902,6 +80797,8 @@ var ts; this.projectErrors = undefined; this.lsHost.dispose(); this.lsHost = undefined; + this.missingFilesMap.forEach(function (fileWatcher) { return fileWatcher.close(); }); + this.missingFilesMap = undefined; this.languageService.dispose(); this.languageService = undefined; }; @@ -78943,7 +80840,7 @@ var ts; return ts.map(this.program.getSourceFiles(), function (sourceFile) { var scriptInfo = _this.projectService.getScriptInfoForPath(sourceFile.path); if (!scriptInfo) { - ts.Debug.assert(false, "scriptInfo for a file '" + sourceFile.fileName + "' is missing."); + ts.Debug.fail("scriptInfo for a file '" + sourceFile.fileName + "' is missing."); } return scriptInfo; }); @@ -78954,7 +80851,7 @@ var ts; } return this.getLanguageService().getEmitOutput(info.fileName, emitOnlyDtsFiles); }; - Project.prototype.getFileNames = function (excludeFilesFromExternalLibraries) { + Project.prototype.getFileNames = function (excludeFilesFromExternalLibraries, excludeConfigFiles) { if (!this.program) { return []; } @@ -78976,8 +80873,39 @@ var ts; } result.push(server.asNormalizedPath(f.fileName)); } + if (!excludeConfigFiles) { + var configFile = this.program.getCompilerOptions().configFile; + if (configFile) { + result.push(server.asNormalizedPath(configFile.fileName)); + if (configFile.extendedSourceFiles) { + for (var _b = 0, _c = configFile.extendedSourceFiles; _b < _c.length; _b++) { + var f = _c[_b]; + result.push(server.asNormalizedPath(f)); + } + } + } + } return result; }; + Project.prototype.hasConfigFile = function (configFilePath) { + if (this.program && this.languageServiceEnabled) { + var configFile = this.program.getCompilerOptions().configFile; + if (configFile) { + if (configFilePath === server.asNormalizedPath(configFile.fileName)) { + return true; + } + if (configFile.extendedSourceFiles) { + for (var _i = 0, _a = configFile.extendedSourceFiles; _i < _a.length; _i++) { + var f = _a[_i]; + if (configFilePath === server.asNormalizedPath(f)) { + return true; + } + } + } + } + } + return false; + }; Project.prototype.getAllEmittableFiles = function () { if (!this.languageServiceEnabled) { return []; @@ -79003,7 +80931,7 @@ var ts; } }; Project.prototype.isRoot = function (info) { - return this.rootFilesMap && this.rootFilesMap.contains(info.path); + return this.rootFilesMap && this.rootFilesMap.has(info.path); }; Project.prototype.addRoot = function (info) { if (!this.isRoot(info)) { @@ -79026,7 +80954,7 @@ var ts; this.markAsDirty(); }; Project.prototype.registerFileUpdate = function (fileName) { - (this.updatedFileNames || (this.updatedFileNames = ts.createMap())).set(fileName, fileName); + (this.updatedFileNames || (this.updatedFileNames = ts.createMap())).set(fileName, true); }; Project.prototype.markAsDirty = function () { this.projectStateVersion++; @@ -79067,24 +80995,23 @@ var ts; var file = changedFiles_1[_i]; this.cachedUnresolvedImportsPerFile.remove(file); } - var unresolvedImports; - if (hasChanges || changedFiles.length) { - var result = []; - for (var _a = 0, _b = this.program.getSourceFiles(); _a < _b.length; _a++) { - var sourceFile = _b[_a]; - this.extractUnresolvedImportsFromSourceFile(sourceFile, result); - } - this.lastCachedUnresolvedImportsList = server.toSortedReadonlyArray(result); - } - unresolvedImports = this.lastCachedUnresolvedImportsList; - var cachedTypings = this.projectService.typingsCache.getTypingsForProject(this, unresolvedImports, hasChanges); - if (this.setTypings(cachedTypings)) { - hasChanges = this.updateGraphWorker() || hasChanges; - } if (this.languageServiceEnabled) { + if (hasChanges || changedFiles.length) { + var result = []; + for (var _a = 0, _b = this.program.getSourceFiles(); _a < _b.length; _a++) { + var sourceFile = _b[_a]; + this.extractUnresolvedImportsFromSourceFile(sourceFile, result); + } + this.lastCachedUnresolvedImportsList = server.toDeduplicatedSortedArray(result); + } + var cachedTypings = this.projectService.typingsCache.getTypingsForProject(this, this.lastCachedUnresolvedImportsList, hasChanges); + if (this.setTypings(cachedTypings)) { + hasChanges = this.updateGraphWorker() || hasChanges; + } this.builder.onProjectUpdateGraph(); } else { + this.lastCachedUnresolvedImportsList = undefined; this.builder.clear(); } if (hasChanges) { @@ -79104,9 +81031,8 @@ var ts; var _this = this; var oldProgram = this.program; this.program = this.languageService.getProgram(); - var hasChanges = false; - if (!oldProgram || (this.program !== oldProgram && !(oldProgram.structureIsReused & 2))) { - hasChanges = true; + var hasChanges = !oldProgram || (this.program !== oldProgram && !(oldProgram.structureIsReused & 2)); + if (hasChanges) { if (oldProgram) { for (var _i = 0, _a = oldProgram.getSourceFiles(); _i < _a.length; _i++) { var f = _a[_i]; @@ -79119,6 +81045,32 @@ var ts; } } } + var missingFilePaths = this.program.getMissingFilePaths(); + var missingFilePathsSet_1 = ts.arrayToSet(missingFilePaths); + this.missingFilesMap.forEach(function (fileWatcher, missingFilePath) { + if (!missingFilePathsSet_1.has(missingFilePath)) { + _this.missingFilesMap.delete(missingFilePath); + fileWatcher.close(); + } + }); + var _loop_9 = function (missingFilePath) { + if (!this_1.missingFilesMap.has(missingFilePath)) { + var fileWatcher_1 = this_1.projectService.host.watchFile(missingFilePath, function (_filename, eventKind) { + if (eventKind === ts.FileWatcherEventKind.Created && _this.missingFilesMap.has(missingFilePath)) { + fileWatcher_1.close(); + _this.missingFilesMap.delete(missingFilePath); + _this.markAsDirty(); + _this.updateGraph(); + } + }); + this_1.missingFilesMap.set(missingFilePath, fileWatcher_1); + } + }; + var this_1 = this; + for (var _b = 0, missingFilePaths_1 = missingFilePaths; _b < missingFilePaths_1.length; _b++) { + var missingFilePath = missingFilePaths_1[_b]; + _loop_9(missingFilePath); + } } var oldExternalFiles = this.externalFiles || server.emptyArray; this.externalFiles = this.getExternalFiles(); @@ -79133,6 +81085,9 @@ var ts; }); return hasChanges; }; + Project.prototype.isWatchedMissingFile = function (path) { + return this.missingFilesMap.has(path); + }; Project.prototype.getScriptInfoLSHost = function (fileName) { var scriptInfo = this.projectService.getOrCreateScriptInfo(fileName, false); if (scriptInfo) { @@ -79157,7 +81112,7 @@ var ts; var strBuilder = ""; for (var _i = 0, _a = this.program.getSourceFiles(); _i < _a.length; _i++) { var file = _a[_i]; - strBuilder += file.fileName + "\n"; + strBuilder += "\t" + file.fileName + "\n"; } return strBuilder; }; @@ -79196,10 +81151,11 @@ var ts; this.updatedFileNames = undefined; if (this.lastReportedFileNames && lastKnownVersion === this.lastReportedVersion) { if (this.projectStructureVersion === this.lastReportedVersion && !updatedFileNames) { - return { info: info, projectErrors: this.projectErrors }; + return { info: info, projectErrors: this.getGlobalProjectErrors() }; } var lastReportedFileNames_1 = this.lastReportedFileNames; - var currentFiles_1 = ts.arrayToMap(this.getFileNames(), function (x) { return x; }); + var externalFiles = this.getExternalFiles().map(function (f) { return server.toNormalizedPath(f); }); + var currentFiles_1 = ts.arrayToSet(this.getFileNames().concat(externalFiles)); var added_1 = []; var removed_1 = []; var updated = updatedFileNames ? ts.arrayFrom(updatedFileNames.keys()) : []; @@ -79215,13 +81171,15 @@ var ts; }); this.lastReportedFileNames = currentFiles_1; this.lastReportedVersion = this.projectStructureVersion; - return { info: info, changes: { added: added_1, removed: removed_1, updated: updated }, projectErrors: this.projectErrors }; + return { info: info, changes: { added: added_1, removed: removed_1, updated: updated }, projectErrors: this.getGlobalProjectErrors() }; } else { var projectFileNames = this.getFileNames(); - this.lastReportedFileNames = ts.arrayToMap(projectFileNames, function (x) { return x; }); + var externalFiles = this.getExternalFiles().map(function (f) { return server.toNormalizedPath(f); }); + var allFiles = projectFileNames.concat(externalFiles); + this.lastReportedFileNames = ts.arrayToSet(allFiles); this.lastReportedVersion = this.projectStructureVersion; - return { info: info, files: projectFileNames, projectErrors: this.projectErrors }; + return { info: info, files: allFiles, projectErrors: this.getGlobalProjectErrors() }; } }; Project.prototype.getReferencedFiles = function (path) { @@ -79271,17 +81229,18 @@ var ts; }; Project.prototype.removeRoot = function (info) { ts.orderedRemoveItem(this.rootFiles, info); - this.rootFilesMap.remove(info.path); + this.rootFilesMap.delete(info.path); }; return Project; }()); server.Project = Project; var InferredProject = (function (_super) { __extends(InferredProject, _super); - function InferredProject(projectService, documentRegistry, compilerOptions) { + function InferredProject(projectService, documentRegistry, compilerOptions, projectRootPath) { var _this = _super.call(this, InferredProject.newName(), ProjectKind.Inferred, projectService, documentRegistry, undefined, true, compilerOptions, false) || this; _this._isJsInferredProject = false; _this.directoriesWatchedForTsconfig = []; + _this.projectRootPath = projectRootPath; return _this; } InferredProject.prototype.toggleJsInferredProject = function (isJsInferredProject) { @@ -79291,7 +81250,7 @@ var ts; } }; InferredProject.prototype.setCompilerOptions = function (options) { - var newOptions = options ? ts.clone(options) : this.getCompilerOptions(); + var newOptions = options ? ts.cloneCompilerOptions(options) : this.getCompilerOptions(); if (!newOptions) { return; } @@ -79385,20 +81344,24 @@ var ts; } } if (this.projectService.globalPlugins) { - var _loop_7 = function (globalPluginName) { + var _loop_10 = function (globalPluginName) { + if (!globalPluginName) + return "continue"; if (options.plugins && options.plugins.some(function (p) { return p.name === globalPluginName; })) return "continue"; - this_1.enablePlugin({ name: globalPluginName, global: true }, searchPaths); + this_2.projectService.logger.info("Loading global plugin " + globalPluginName); + this_2.enablePlugin({ name: globalPluginName, global: true }, searchPaths); }; - var this_1 = this; + var this_2 = this; for (var _b = 0, _c = this.projectService.globalPlugins; _b < _c.length; _b++) { var globalPluginName = _c[_b]; - _loop_7(globalPluginName); + _loop_10(globalPluginName); } } }; ConfiguredProject.prototype.enablePlugin = function (pluginConfigEntry, searchPaths) { var _this = this; + this.projectService.logger.info("Enabling plugin " + pluginConfigEntry.name + " from candidate paths: " + searchPaths.join(",")); var log = function (message) { _this.projectService.logger.info(message); }; @@ -79410,7 +81373,7 @@ var ts; return; } } - this.projectService.logger.info("Couldn't find " + pluginConfigEntry.name + " anywhere in paths: " + searchPaths.join(",")); + this.projectService.logger.info("Couldn't find " + pluginConfigEntry.name); }; ConfiguredProject.prototype.enableProxy = function (pluginModuleFactory, configEntry) { try { @@ -79426,7 +81389,16 @@ var ts; serverHost: this.projectService.host }; var pluginModule = pluginModuleFactory({ typescript: ts }); - this.languageService = pluginModule.create(info); + var newLS = pluginModule.create(info); + for (var _i = 0, _a = Object.keys(this.languageService); _i < _a.length; _i++) { + var k = _a[_i]; + if (!(k in newLS)) { + this.projectService.logger.info("Plugin activation warning: Missing proxied method " + k + " in created LS. Patching."); + newLS[k] = this.languageService[k]; + } + } + this.projectService.logger.info("Plugin validation succeded"); + this.languageService = newLS; this.plugins.push(pluginModule); } catch (e) { @@ -79447,7 +81419,7 @@ var ts; }; ConfiguredProject.prototype.getExternalFiles = function () { var _this = this; - return server.toSortedReadonlyArray(ts.flatMap(this.plugins, function (plugin) { + return server.toSortedArray(ts.flatMap(this.plugins, function (plugin) { if (typeof plugin.getExternalFiles !== "function") return; try { @@ -79455,6 +81427,9 @@ var ts; } catch (e) { _this.projectService.logger.info("A plugin threw an exception in getExternalFiles: " + e); + if (e.stack) { + _this.projectService.logger.info(e.stack); + } } })); }; @@ -79516,10 +81491,12 @@ var ts; } this.typeRootsWatchers = undefined; } - this.directoriesWatchedForWildcards.forEach(function (watcher) { - watcher.close(); - }); - this.directoriesWatchedForWildcards = undefined; + if (this.directoriesWatchedForWildcards) { + this.directoriesWatchedForWildcards.forEach(function (watcher) { + watcher.close(); + }); + this.directoriesWatchedForWildcards = undefined; + } this.stopWatchingDirectory(); }; ConfiguredProject.prototype.addOpenRef = function () { @@ -79676,17 +81653,14 @@ var ts; } server.convertScriptKindName = convertScriptKindName; function combineProjectOutput(projects, action, comparer, areEqual) { - var result = projects.reduce(function (previous, current) { return ts.concatenate(previous, action(current)); }, []).sort(comparer); + var result = ts.flatMap(projects, action).sort(comparer); return projects.length > 1 ? ts.deduplicate(result, areEqual) : result; } server.combineProjectOutput = combineProjectOutput; var fileNamePropertyReader = { getFileName: function (x) { return x; }, getScriptKind: function (_) { return undefined; }, - hasMixedContent: function (fileName, extraFileExtensions) { - var mixedContentExtensions = ts.map(ts.filter(extraFileExtensions, function (item) { return item.isMixedContent; }), function (item) { return item.extension; }); - return ts.forEach(mixedContentExtensions, function (extension) { return ts.fileExtensionIs(fileName, extension); }); - } + hasMixedContent: function (fileName, extraFileExtensions) { return ts.some(extraFileExtensions, function (ext) { return ext.isMixedContent && ts.fileExtensionIs(fileName, ext.extension); }); }, }; var externalFilePropertyReader = { getFileName: function (x) { return x.fileName; }, @@ -79746,18 +81720,21 @@ var ts; }()); var ProjectService = (function () { function ProjectService(opts) { - this.filenameToScriptInfo = ts.createFileMap(); + this.filenameToScriptInfo = ts.createMap(); this.externalProjectToConfiguredProjectMap = ts.createMap(); this.externalProjects = []; this.inferredProjects = []; this.configuredProjects = []; this.openFiles = []; + this.compilerOptionsForInferredProjectsPerProjectRoot = ts.createMap(); this.projectToSizeMap = ts.createMap(); + this.safelist = defaultTypeSafeList; this.seenProjects = ts.createMap(); this.host = opts.host; this.logger = opts.logger; this.cancellationToken = opts.cancellationToken; this.useSingleInferredProject = opts.useSingleInferredProject; + this.useInferredProjectPerProjectRoot = opts.useInferredProjectPerProjectRoot; this.typingsInstaller = opts.typingsInstaller || server.nullTypingsInstaller; this.throttleWaitMilliseconds = opts.throttleWaitMilliseconds; this.eventHandler = opts.eventHandler; @@ -79790,10 +81767,11 @@ var ts; if (!this.eventHandler) { return; } - this.eventHandler({ + var event = { eventName: server.ProjectLanguageServiceStateEvent, data: { project: project, languageServiceEnabled: languageServiceEnabled } - }); + }; + this.eventHandler(event); }; ProjectService.prototype.updateTypingsForProject = function (response) { var project = this.findProject(response.projectName); @@ -79810,16 +81788,28 @@ var ts; } project.updateGraph(); }; - ProjectService.prototype.setCompilerOptionsForInferredProjects = function (projectCompilerOptions) { - this.compilerOptionsForInferredProjects = convertCompilerOptions(projectCompilerOptions); - this.compilerOptionsForInferredProjects.allowNonTsExtensions = true; - this.compileOnSaveForInferredProjects = projectCompilerOptions.compileOnSave; + ProjectService.prototype.setCompilerOptionsForInferredProjects = function (projectCompilerOptions, projectRootPath) { + ts.Debug.assert(projectRootPath === undefined || this.useInferredProjectPerProjectRoot, "Setting compiler options per project root path is only supported when useInferredProjectPerProjectRoot is enabled"); + var compilerOptions = convertCompilerOptions(projectCompilerOptions); + compilerOptions.allowNonTsExtensions = true; + if (projectRootPath) { + this.compilerOptionsForInferredProjectsPerProjectRoot.set(projectRootPath, compilerOptions); + } + else { + this.compilerOptionsForInferredProjects = compilerOptions; + } + var updatedProjects = []; for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) { - var proj = _a[_i]; - proj.setCompilerOptions(this.compilerOptionsForInferredProjects); - proj.compileOnSaveEnabled = projectCompilerOptions.compileOnSave; + var project = _a[_i]; + if (projectRootPath ? + project.projectRootPath === projectRootPath : + !project.projectRootPath || !this.compilerOptionsForInferredProjectsPerProjectRoot.has(project.projectRootPath)) { + project.setCompilerOptions(compilerOptions); + project.compileOnSaveEnabled = compilerOptions.compileOnSave; + updatedProjects.push(project); + } } - this.updateProjectGraphs(this.inferredProjects); + this.updateProjectGraphs(updatedProjects); }; ProjectService.prototype.stopWatchingDirectory = function (directory) { this.directoryWatchers.stopWatchingDirectory(directory); @@ -79902,7 +81892,7 @@ var ts; if (info && (!info.isScriptOpen())) { if (info.containingProjects.length === 0) { info.stopWatcher(); - this.filenameToScriptInfo.remove(info.path); + this.filenameToScriptInfo.delete(info.path); } else { info.reloadFromFile(); @@ -79915,7 +81905,7 @@ var ts; this.logger.info(info.fileName + " deleted"); info.stopWatcher(); if (!info.isScriptOpen()) { - this.filenameToScriptInfo.remove(info.path); + this.filenameToScriptInfo.delete(info.path); this.lastDeletedFile = info; var containingProjects = info.containingProjects.slice(); info.detachAllProjects(); @@ -79926,10 +81916,11 @@ var ts; } for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { var openFile = _a[_i]; - this.eventHandler({ + var event = { eventName: server.ContextEvent, data: { project: openFile.getDefaultProject(), fileName: openFile.fileName } - }); + }; + this.eventHandler(event); } } this.printProjects(); @@ -79989,19 +81980,19 @@ var ts; project.close(); switch (project.projectKind) { case server.ProjectKind.External: - server.removeItemFromSet(this.externalProjects, project); + ts.unorderedRemoveItem(this.externalProjects, project); this.projectToSizeMap.delete(project.externalProjectName); break; case server.ProjectKind.Configured: - server.removeItemFromSet(this.configuredProjects, project); + ts.unorderedRemoveItem(this.configuredProjects, project); this.projectToSizeMap.delete(project.canonicalConfigFilePath); break; case server.ProjectKind.Inferred: - server.removeItemFromSet(this.inferredProjects, project); + ts.unorderedRemoveItem(this.inferredProjects, project); break; } }; - ProjectService.prototype.assignScriptInfoToInferredProjectIfNecessary = function (info, addToListOfOpenFiles) { + ProjectService.prototype.assignScriptInfoToInferredProjectIfNecessary = function (info, addToListOfOpenFiles, projectRootPath) { var externalProject = this.findContainingExternalProject(info.fileName); if (externalProject) { if (addToListOfOpenFiles) { @@ -80026,19 +82017,19 @@ var ts; return; } if (info.containingProjects.length === 0) { - var inferredProject = this.createInferredProjectWithRootFileIfNecessary(info); - if (!this.useSingleInferredProject) { + var inferredProject = this.createInferredProjectWithRootFileIfNecessary(info, projectRootPath); + if (!this.useSingleInferredProject && !inferredProject.projectRootPath) { for (var _b = 0, _c = this.openFiles; _b < _c.length; _b++) { var f = _c[_b]; if (f.containingProjects.length === 0 || !inferredProject.containsScriptInfo(f)) { continue; } for (var _d = 0, _e = f.containingProjects; _d < _e.length; _d++) { - var fContainingProject = _e[_d]; - if (fContainingProject.projectKind === server.ProjectKind.Inferred && - fContainingProject.isRoot(f) && - fContainingProject !== inferredProject) { - this.removeProject(fContainingProject); + var containingProject = _e[_d]; + if (containingProject.projectKind === server.ProjectKind.Inferred && + containingProject !== inferredProject && + containingProject.isRoot(f)) { + this.removeProject(containingProject); f.attachToProject(inferredProject); } } @@ -80051,7 +82042,7 @@ var ts; }; ProjectService.prototype.closeOpenFile = function (info) { info.close(); - server.removeItemFromSet(this.openFiles, info); + ts.unorderedRemoveItem(this.openFiles, info); var projectsToRemove; for (var _i = 0, _a = info.containingProjects; _i < _a.length; _i++) { var p = _a[_i]; @@ -80097,14 +82088,13 @@ var ts; } }; ProjectService.prototype.deleteOrphanScriptInfoNotInAnyProject = function () { - for (var _i = 0, _a = this.filenameToScriptInfo.getKeys(); _i < _a.length; _i++) { - var path = _a[_i]; - var info = this.filenameToScriptInfo.get(path); + var _this = this; + this.filenameToScriptInfo.forEach(function (info) { if (!info.isScriptOpen() && info.containingProjects.length === 0) { info.stopWatcher(); - this.filenameToScriptInfo.remove(info.path); + _this.filenameToScriptInfo.delete(info.path); } - } + }); }; ProjectService.prototype.openOrUpdateConfiguredProjectForFile = function (fileName, projectRootPath) { var searchPath = ts.getDirectoryPath(fileName); @@ -80150,31 +82140,32 @@ var ts; return undefined; }; ProjectService.prototype.printProjects = function () { + var _this = this; if (!this.logger.hasLevel(server.LogLevel.verbose)) { return; } this.logger.startGroup(); var counter = 0; - counter = printProjects(this.logger, this.externalProjects, counter); - counter = printProjects(this.logger, this.configuredProjects, counter); - counter = printProjects(this.logger, this.inferredProjects, counter); - this.logger.info("Open files: "); - for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { - var rootFile = _a[_i]; - this.logger.info(rootFile.fileName); - } - this.logger.endGroup(); - function printProjects(logger, projects, counter) { + var printProjects = function (projects, counter) { for (var _i = 0, projects_4 = projects; _i < projects_4.length; _i++) { var project = projects_4[_i]; project.updateGraph(); - logger.info("Project '" + project.getProjectName() + "' (" + server.ProjectKind[project.projectKind] + ") " + counter); - logger.info(project.filesToString()); - logger.info("-----------------------------------------------"); + _this.logger.info("Project '" + project.getProjectName() + "' (" + server.ProjectKind[project.projectKind] + ") " + counter); + _this.logger.info(project.filesToString()); + _this.logger.info("-----------------------------------------------"); counter++; } return counter; + }; + counter = printProjects(this.externalProjects, counter); + counter = printProjects(this.configuredProjects, counter); + printProjects(this.inferredProjects, counter); + this.logger.info("Open files: "); + for (var _i = 0, _a = this.openFiles; _i < _a.length; _i++) { + var rootFile = _a[_i]; + this.logger.info("\t" + rootFile.fileName); } + this.logger.endGroup(); }; ProjectService.prototype.findConfiguredProjectByProjectName = function (configFileName) { configFileName = server.asNormalizedPath(this.toCanonicalFileName(configFileName)); @@ -80191,30 +82182,27 @@ var ts; ProjectService.prototype.convertConfigFileContentToProjectOptions = function (configFilename) { configFilename = ts.normalizePath(configFilename); var configFileContent = this.host.readFile(configFilename); - var errors; - var result = ts.parseConfigFileTextToJson(configFilename, configFileContent); - var config = result.config; - if (result.error) { - var _a = ts.sanitizeConfigFile(configFilename, configFileContent), sanitizedConfig = _a.configJsonObject, diagnostics = _a.diagnostics; - config = sanitizedConfig; - errors = diagnostics.length ? diagnostics : [result.error]; + var result = ts.parseJsonText(configFilename, configFileContent); + if (!result.endOfFileToken) { + result.endOfFileToken = { kind: 1 }; } - var parsedCommandLine = ts.parseJsonConfigFileContent(config, this.host, ts.getDirectoryPath(configFilename), {}, configFilename, [], this.hostConfiguration.extraFileExtensions); + var errors = result.parseDiagnostics; + var parsedCommandLine = ts.parseJsonSourceFileConfigFileContent(result, this.host, ts.getDirectoryPath(configFilename), {}, configFilename, [], this.hostConfiguration.extraFileExtensions); if (parsedCommandLine.errors.length) { - errors = ts.concatenate(errors, parsedCommandLine.errors); + errors.push.apply(errors, parsedCommandLine.errors); } ts.Debug.assert(!!parsedCommandLine.fileNames); if (parsedCommandLine.fileNames.length === 0) { - (errors || (errors = [])).push(ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename)); + errors.push(ts.createCompilerDiagnostic(ts.Diagnostics.The_config_file_0_found_doesn_t_contain_any_source_files, configFilename)); return { success: false, configFileErrors: errors }; } var projectOptions = { files: parsedCommandLine.fileNames, compilerOptions: parsedCommandLine.options, - configHasExtendsProperty: config.extends !== undefined, - configHasFilesProperty: config.files !== undefined, - configHasIncludeProperty: config.include !== undefined, - configHasExcludeProperty: config.exclude !== undefined, + configHasExtendsProperty: parsedCommandLine.raw["extends"] !== undefined, + configHasFilesProperty: parsedCommandLine.raw["files"] !== undefined, + configHasIncludeProperty: parsedCommandLine.raw["include"] !== undefined, + configHasExcludeProperty: parsedCommandLine.raw["exclude"] !== undefined, wildcardDirectories: ts.createMapFromTemplate(parsedCommandLine.wildcardDirectories), typeAcquisition: parsedCommandLine.typeAcquisition, compileOnSave: parsedCommandLine.compileOnSave @@ -80298,10 +82286,11 @@ var ts; if (!this.eventHandler) { return; } - this.eventHandler({ + var event = { eventName: server.ConfigFileDiagEvent, - data: { configFileName: configFileName, diagnostics: diagnostics || [], triggerFile: triggerFile } - }); + data: { configFileName: configFileName, diagnostics: diagnostics || server.emptyArray, triggerFile: triggerFile } + }; + this.eventHandler(event); }; ProjectService.prototype.createAndAddConfiguredProject = function (configFileName, projectOptions, configFileErrors, clientFileName) { var _this = this; @@ -80352,7 +82341,7 @@ var ts; return { success: conversionResult.success, project: project, - errors: project.getProjectErrors() + errors: project.getGlobalProjectErrors() }; }; ProjectService.prototype.updateNonInferredProject = function (project, newUncheckedFiles, propertyReader, newOptions, newTypeAcquisition, compileOnSave, configFileErrors) { @@ -80450,18 +82439,60 @@ var ts; } return configFileErrors; }; - ProjectService.prototype.createInferredProjectWithRootFileIfNecessary = function (root) { + ProjectService.prototype.getOrCreateInferredProjectForProjectRootPathIfEnabled = function (root, projectRootPath) { + if (!this.useInferredProjectPerProjectRoot) { + return undefined; + } + if (projectRootPath) { + for (var _i = 0, _a = this.inferredProjects; _i < _a.length; _i++) { + var project = _a[_i]; + if (project.projectRootPath === projectRootPath) { + return project; + } + } + return this.createInferredProject(false, projectRootPath); + } + var bestMatch; + for (var _b = 0, _c = this.inferredProjects; _b < _c.length; _b++) { + var project = _c[_b]; + if (!project.projectRootPath) + continue; + if (!ts.containsPath(project.projectRootPath, root.path, this.host.getCurrentDirectory(), !this.host.useCaseSensitiveFileNames)) + continue; + if (bestMatch && bestMatch.projectRootPath.length > project.projectRootPath.length) + continue; + bestMatch = project; + } + return bestMatch; + }; + ProjectService.prototype.getOrCreateSingleInferredProjectIfEnabled = function () { + if (!this.useSingleInferredProject) { + return undefined; + } + if (this.inferredProjects.length > 0 && this.inferredProjects[0].projectRootPath === undefined) { + return this.inferredProjects[0]; + } + return this.createInferredProject(true); + }; + ProjectService.prototype.createInferredProject = function (isSingleInferredProject, projectRootPath) { + var compilerOptions = projectRootPath && this.compilerOptionsForInferredProjectsPerProjectRoot.get(projectRootPath) || this.compilerOptionsForInferredProjects; + var project = new server.InferredProject(this, this.documentRegistry, compilerOptions, projectRootPath); + if (isSingleInferredProject) { + this.inferredProjects.unshift(project); + } + else { + this.inferredProjects.push(project); + } + return project; + }; + ProjectService.prototype.createInferredProjectWithRootFileIfNecessary = function (root, projectRootPath) { var _this = this; - var useExistingProject = this.useSingleInferredProject && this.inferredProjects.length; - var project = useExistingProject - ? this.inferredProjects[0] - : new server.InferredProject(this, this.documentRegistry, this.compilerOptionsForInferredProjects); + var project = this.getOrCreateInferredProjectForProjectRootPathIfEnabled(root, projectRootPath) || + this.getOrCreateSingleInferredProjectIfEnabled() || + this.createInferredProject(); project.addRoot(root); this.directoryWatchers.startWatchingContainingDirectoriesForFile(root.fileName, project, function (fileName) { return _this.onConfigFileAddedForInferredProject(fileName); }); project.updateGraph(); - if (!useExistingProject) { - this.inferredProjects.push(project); - } return project; }; ProjectService.prototype.getOrCreateScriptInfo = function (uncheckedFileName, openedByClient, fileContent, scriptKind) { @@ -80594,7 +82625,7 @@ var ts; project.markAsDirty(); } var info = this.getOrCreateScriptInfoForNormalizedPath(fileName, true, fileContent, scriptKind, hasMixedContent); - this.assignScriptInfoToInferredProjectIfNecessary(info, true); + this.assignScriptInfoToInferredProjectIfNecessary(info, true, projectRootPath); this.deleteOrphanScriptInfoNotInAnyProject(); this.printProjects(); return { configFileName: configFileName, configFileErrors: configFileErrors }; @@ -80608,13 +82639,13 @@ var ts; this.printProjects(); }; ProjectService.prototype.collectChanges = function (lastKnownProjectVersions, currentProjects, result) { - var _loop_8 = function (proj) { + var _loop_11 = function (proj) { var knownProject = ts.forEach(lastKnownProjectVersions, function (p) { return p.projectName === proj.getProjectName() && p; }); result.push(proj.getChangesSinceVersion(knownProject && knownProject.version)); }; for (var _i = 0, currentProjects_1 = currentProjects; _i < currentProjects_1.length; _i++) { var proj = currentProjects_1[_i]; - _loop_8(proj); + _loop_11(proj); } }; ProjectService.prototype.synchronizeProjectList = function (knownProjects) { @@ -80630,7 +82661,7 @@ var ts; for (var _i = 0, openFiles_1 = openFiles; _i < openFiles_1.length; _i++) { var file = openFiles_1[_i]; var scriptInfo = this.getScriptInfo(file.fileName); - ts.Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen()); + ts.Debug.assert(!scriptInfo || !scriptInfo.isScriptOpen(), "Script should not exist and not be open already"); var normalizedPath = scriptInfo ? scriptInfo.fileName : server.toNormalizedPath(file.fileName); this.openClientFileWithNormalizedPath(normalizedPath, file.content, tryConvertScriptKindName(file.scriptKind), file.hasMixedContent); } @@ -80717,7 +82748,7 @@ var ts; return filename.replace(this.filenameEscapeRegexp, "\\$&"); }; ProjectService.prototype.resetSafeList = function () { - ProjectService.safelist = defaultTypeSafeList; + this.safelist = defaultTypeSafeList; }; ProjectService.prototype.loadSafeList = function (fileName) { var raw = JSON.parse(this.host.readFile(fileName, "utf-8")); @@ -80725,7 +82756,7 @@ var ts; var k = _a[_i]; raw[k].match = new RegExp(raw[k].match, "i"); } - ProjectService.safelist = raw; + this.safelist = raw; }; ProjectService.prototype.applySafeList = function (proj) { var _this = this; @@ -80733,12 +82764,12 @@ var ts; var types = (typeAcquisition && typeAcquisition.include) || []; var excludeRules = []; var normalizedNames = rootFiles.map(function (f) { return ts.normalizeSlashes(f.fileName); }); - var _loop_9 = function (name) { - var rule = ProjectService.safelist[name]; + var _loop_12 = function (name) { + var rule = this_3.safelist[name]; for (var _i = 0, normalizedNames_1 = normalizedNames; _i < normalizedNames_1.length; _i++) { var root = normalizedNames_1[_i]; if (rule.match.test(root)) { - this_2.logger.info("Excluding files based on rule " + name); + this_3.logger.info("Excluding files based on rule " + name); if (rule.types) { for (var _a = 0, _b = rule.types; _a < _b.length; _a++) { var type = _b[_a]; @@ -80748,7 +82779,7 @@ var ts; } } if (rule.exclude) { - var _loop_10 = function (exclude) { + var _loop_13 = function (exclude) { var processedRule = root.replace(rule.match, function () { var groups = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -80771,7 +82802,7 @@ var ts; }; for (var _c = 0, _d = rule.exclude; _c < _d.length; _c++) { var exclude = _d[_c]; - _loop_10(exclude); + _loop_13(exclude); } } else { @@ -80787,10 +82818,10 @@ var ts; proj.typeAcquisition.include = types; } }; - var this_2 = this; - for (var _i = 0, _a = Object.keys(ProjectService.safelist); _i < _a.length; _i++) { + var this_3 = this; + for (var _i = 0, _a = Object.keys(this.safelist); _i < _a.length; _i++) { var name = _a[_i]; - _loop_9(name); + _loop_12(name); } var excludeRegexes = excludeRules.map(function (e) { return new RegExp(e, "i"); }); proj.rootFiles = proj.rootFiles.filter(function (_file, index) { return !excludeRegexes.some(function (re) { return re.test(normalizedNames[index]); }); }); @@ -80886,7 +82917,6 @@ var ts; this.refreshInferredProjects(); } }; - ProjectService.safelist = defaultTypeSafeList; ProjectService.filenameEscapeRegexp = /[-\/\\^$*+?.()|[\]{}]/g; return ProjectService; }()); @@ -81060,23 +83090,8 @@ var ts; } } CoreServicesShimHostAdapter.prototype.readDirectory = function (rootDir, extensions, exclude, include, depth) { - try { - var pattern = ts.getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); - return JSON.parse(this.shimHost.readDirectory(rootDir, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)); - } - catch (e) { - var results = []; - for (var _i = 0, extensions_2 = extensions; _i < extensions_2.length; _i++) { - var extension = extensions_2[_i]; - for (var _a = 0, _b = this.readDirectoryFallback(rootDir, extension, exclude); _a < _b.length; _a++) { - var file = _b[_a]; - if (!ts.contains(results, file)) { - results.push(file); - } - } - } - return results; - } + var pattern = ts.getFileMatcherPatterns(rootDir, exclude, include, this.shimHost.useCaseSensitiveFileNames(), this.shimHost.getCurrentDirectory()); + return JSON.parse(this.shimHost.readDirectory(rootDir, JSON.stringify(extensions), JSON.stringify(pattern.basePaths), pattern.excludePattern, pattern.includeFilePattern, pattern.includeDirectoryPattern, depth)); }; CoreServicesShimHostAdapter.prototype.fileExists = function (fileName) { return this.shimHost.fileExists(fileName); @@ -81084,9 +83099,6 @@ var ts; CoreServicesShimHostAdapter.prototype.readFile = function (fileName) { return this.shimHost.readFile(fileName); }; - CoreServicesShimHostAdapter.prototype.readDirectoryFallback = function (rootDir, extension, exclude) { - return JSON.parse(this.shimHost.readDirectory(rootDir, extension, JSON.stringify(exclude))); - }; CoreServicesShimHostAdapter.prototype.getDirectories = function (path) { return JSON.parse(this.shimHost.getDirectories(path)); }; @@ -81409,7 +83421,7 @@ var ts; var compilerOptions = JSON.parse(compilerOptionsJson); var result = ts.resolveModuleName(moduleName, ts.normalizeSlashes(fileName), compilerOptions, _this.host); var resolvedFileName = result.resolvedModule ? result.resolvedModule.resolvedFileName : undefined; - if (result.resolvedModule && result.resolvedModule.extension !== ts.Extension.Ts && result.resolvedModule.extension !== ts.Extension.Tsx && result.resolvedModule.extension !== ts.Extension.Dts) { + if (result.resolvedModule && result.resolvedModule.extension !== ".ts" && result.resolvedModule.extension !== ".tsx" && result.resolvedModule.extension !== ".d.ts") { resolvedFileName = undefined; } return { @@ -81469,24 +83481,15 @@ var ts; var _this = this; return this.forwardJSONCall("getTSConfigFileInfo('" + fileName + "')", function () { var text = sourceTextSnapshot.getText(0, sourceTextSnapshot.getLength()); - var result = ts.parseConfigFileTextToJson(fileName, text); - if (result.error) { - return { - options: {}, - typeAcquisition: {}, - files: [], - raw: {}, - errors: [realizeDiagnostic(result.error, "\r\n")] - }; - } + var result = ts.parseJsonText(fileName, text); var normalizedFileName = ts.normalizeSlashes(fileName); - var configFile = ts.parseJsonConfigFileContent(result.config, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName); + var configFile = ts.parseJsonSourceFileConfigFileContent(result, _this.host, ts.getDirectoryPath(normalizedFileName), {}, normalizedFileName); return { options: configFile.options, typeAcquisition: configFile.typeAcquisition, files: configFile.fileNames, raw: configFile.raw, - errors: realizeDiagnostics(configFile.errors, "\r\n") + errors: realizeDiagnostics(result.parseDiagnostics.concat(configFile.errors), "\r\n") }; }); }; @@ -81498,7 +83501,10 @@ var ts; var getCanonicalFileName = ts.createGetCanonicalFileName(false); return this.forwardJSONCall("discoverTypings()", function () { var info = JSON.parse(discoverTypingsJson); - return ts.JsTyping.discoverTypings(_this.host, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName), info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports); + if (_this.safeList === undefined) { + _this.safeList = ts.JsTyping.loadSafeList(_this.host, ts.toPath(info.safeListPath, info.safeListPath, getCanonicalFileName)); + } + return ts.JsTyping.discoverTypings(_this.host, function (msg) { return _this.logger.log(msg); }, info.fileNames, ts.toPath(info.projectRootPath, info.projectRootPath, getCanonicalFileName), _this.safeList, info.packageNameToTypingLocation, info.typeAcquisition, info.unresolvedImports); }); }; return CoreServicesShimObject; @@ -81544,7 +83550,7 @@ var ts; } }; TypeScriptServicesFactory.prototype.close = function () { - this._shims = []; + ts.clear(this._shims); this.documentRegistry = undefined; }; TypeScriptServicesFactory.prototype.registerShim = function (shim) { @@ -81573,4 +83579,4 @@ var TypeScript; Services.TypeScriptServicesFactory = ts.TypeScriptServicesFactory; })(Services = TypeScript.Services || (TypeScript.Services = {})); })(TypeScript || (TypeScript = {})); -var toolsVersion = "2.4"; +var toolsVersion = "2.5"; |