typescript 4.6.0-dev.20211117 → 4.6.0-dev.20211121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +52 -44
- package/lib/tsserver.js +70 -71
- package/lib/tsserverlibrary.d.ts +3 -3
- package/lib/tsserverlibrary.js +70 -71
- package/lib/typescript.d.ts +3 -3
- package/lib/typescript.js +69 -70
- package/lib/typescriptServices.d.ts +3 -3
- package/lib/typescriptServices.js +69 -70
- package/lib/typingsInstaller.js +62 -66
- package/package.json +1 -1
|
@@ -897,7 +897,7 @@ declare namespace ts {
|
|
|
897
897
|
export interface TypePredicateNode extends TypeNode {
|
|
898
898
|
readonly kind: SyntaxKind.TypePredicate;
|
|
899
899
|
readonly parent: SignatureDeclaration | JSDocTypeExpression;
|
|
900
|
-
readonly assertsModifier?:
|
|
900
|
+
readonly assertsModifier?: AssertsKeyword;
|
|
901
901
|
readonly parameterName: Identifier | ThisTypeNode;
|
|
902
902
|
readonly type?: TypeNode;
|
|
903
903
|
}
|
|
@@ -968,7 +968,7 @@ declare namespace ts {
|
|
|
968
968
|
}
|
|
969
969
|
export interface MappedTypeNode extends TypeNode, Declaration {
|
|
970
970
|
readonly kind: SyntaxKind.MappedType;
|
|
971
|
-
readonly readonlyToken?:
|
|
971
|
+
readonly readonlyToken?: ReadonlyKeyword | PlusToken | MinusToken;
|
|
972
972
|
readonly typeParameter: TypeParameterDeclaration;
|
|
973
973
|
readonly nameType?: TypeNode;
|
|
974
974
|
readonly questionToken?: QuestionToken | PlusToken | MinusToken;
|
|
@@ -1465,7 +1465,7 @@ declare namespace ts {
|
|
|
1465
1465
|
}
|
|
1466
1466
|
export interface ForOfStatement extends IterationStatement {
|
|
1467
1467
|
readonly kind: SyntaxKind.ForOfStatement;
|
|
1468
|
-
readonly awaitModifier?:
|
|
1468
|
+
readonly awaitModifier?: AwaitKeyword;
|
|
1469
1469
|
readonly initializer: ForInitializer;
|
|
1470
1470
|
readonly expression: Expression;
|
|
1471
1471
|
}
|
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211121";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -356,26 +356,6 @@ var ts;
|
|
|
356
356
|
ts.emptyArray = [];
|
|
357
357
|
ts.emptyMap = new ts.Map();
|
|
358
358
|
ts.emptySet = new ts.Set();
|
|
359
|
-
function createMap() {
|
|
360
|
-
return new ts.Map();
|
|
361
|
-
}
|
|
362
|
-
ts.createMap = createMap;
|
|
363
|
-
/**
|
|
364
|
-
* Create a new map from a template object is provided, the map will copy entries from it.
|
|
365
|
-
* @deprecated Use `new Map(getEntries(template))` instead.
|
|
366
|
-
*/
|
|
367
|
-
function createMapFromTemplate(template) {
|
|
368
|
-
var map = new ts.Map();
|
|
369
|
-
// Copies keys/values from template. Note that for..in will not throw if
|
|
370
|
-
// template is undefined, and instead will just exit the loop.
|
|
371
|
-
for (var key in template) {
|
|
372
|
-
if (hasOwnProperty.call(template, key)) {
|
|
373
|
-
map.set(key, template[key]);
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
return map;
|
|
377
|
-
}
|
|
378
|
-
ts.createMapFromTemplate = createMapFromTemplate;
|
|
379
359
|
function length(array) {
|
|
380
360
|
return array ? array.length : 0;
|
|
381
361
|
}
|
|
@@ -2610,11 +2590,6 @@ var ts;
|
|
|
2610
2590
|
return value;
|
|
2611
2591
|
}
|
|
2612
2592
|
Debug.checkDefined = checkDefined;
|
|
2613
|
-
/**
|
|
2614
|
-
* @deprecated Use `checkDefined` to check whether a value is defined inline. Use `assertIsDefined` to check whether
|
|
2615
|
-
* a value is defined at the statement level.
|
|
2616
|
-
*/
|
|
2617
|
-
Debug.assertDefined = checkDefined;
|
|
2618
2593
|
function assertEachIsDefined(value, message, stackCrawlMark) {
|
|
2619
2594
|
for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
|
|
2620
2595
|
var v = value_1[_i];
|
|
@@ -2627,11 +2602,6 @@ var ts;
|
|
|
2627
2602
|
return value;
|
|
2628
2603
|
}
|
|
2629
2604
|
Debug.checkEachDefined = checkEachDefined;
|
|
2630
|
-
/**
|
|
2631
|
-
* @deprecated Use `checkEachDefined` to check whether the elements of an array are defined inline. Use `assertEachIsDefined` to check whether
|
|
2632
|
-
* the elements of an array are defined at the statement level.
|
|
2633
|
-
*/
|
|
2634
|
-
Debug.assertEachDefined = checkEachDefined;
|
|
2635
2605
|
function assertNever(member, message, stackCrawlMark) {
|
|
2636
2606
|
if (message === void 0) { message = "Illegal value:"; }
|
|
2637
2607
|
var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
|
|
@@ -14091,21 +14061,6 @@ var ts;
|
|
|
14091
14061
|
return undefined;
|
|
14092
14062
|
}
|
|
14093
14063
|
ts.getDeclarationOfKind = getDeclarationOfKind;
|
|
14094
|
-
/**
|
|
14095
|
-
* Create a new escaped identifier map.
|
|
14096
|
-
* @deprecated Use `new Map<__String, T>()` instead.
|
|
14097
|
-
*/
|
|
14098
|
-
function createUnderscoreEscapedMap() {
|
|
14099
|
-
return new ts.Map();
|
|
14100
|
-
}
|
|
14101
|
-
ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap;
|
|
14102
|
-
/**
|
|
14103
|
-
* @deprecated Use `!!map?.size` instead
|
|
14104
|
-
*/
|
|
14105
|
-
function hasEntries(map) {
|
|
14106
|
-
return !!map && !!map.size;
|
|
14107
|
-
}
|
|
14108
|
-
ts.hasEntries = hasEntries;
|
|
14109
14064
|
function createSymbolTable(symbols) {
|
|
14110
14065
|
var result = new ts.Map();
|
|
14111
14066
|
if (symbols) {
|
|
@@ -26698,7 +26653,7 @@ var ts;
|
|
|
26698
26653
|
sourceMapText = mapTextOrStripInternal;
|
|
26699
26654
|
}
|
|
26700
26655
|
var node = oldFileOfCurrentEmit ?
|
|
26701
|
-
parseOldFileOfCurrentEmit(ts.Debug.
|
|
26656
|
+
parseOldFileOfCurrentEmit(ts.Debug.checkDefined(bundleFileInfo)) :
|
|
26702
26657
|
parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
|
|
26703
26658
|
node.fileName = fileName;
|
|
26704
26659
|
node.sourceMapPath = sourceMapPath;
|
|
@@ -26845,13 +26800,13 @@ var ts;
|
|
|
26845
26800
|
};
|
|
26846
26801
|
node.javascriptPath = declarationTextOrJavascriptPath;
|
|
26847
26802
|
node.javascriptMapPath = javascriptMapPath;
|
|
26848
|
-
node.declarationPath = ts.Debug.
|
|
26803
|
+
node.declarationPath = ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath);
|
|
26849
26804
|
node.declarationMapPath = declarationMapPath;
|
|
26850
26805
|
node.buildInfoPath = declarationMapTextOrBuildInfoPath;
|
|
26851
26806
|
Object.defineProperties(node, {
|
|
26852
26807
|
javascriptText: { get: function () { return definedTextGetter_1(declarationTextOrJavascriptPath); } },
|
|
26853
26808
|
javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
|
|
26854
|
-
declarationText: { get: function () { return definedTextGetter_1(ts.Debug.
|
|
26809
|
+
declarationText: { get: function () { return definedTextGetter_1(ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
|
|
26855
26810
|
declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
|
|
26856
26811
|
buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
|
|
26857
26812
|
});
|
|
@@ -51860,8 +51815,8 @@ var ts;
|
|
|
51860
51815
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
51861
51816
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
51862
51817
|
var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 170 /* Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
|
|
51863
|
-
|
|
51864
|
-
|
|
51818
|
+
var thisParameter = tryGetThisParameterDeclaration(signature, context);
|
|
51819
|
+
if (thisParameter) {
|
|
51865
51820
|
parameters.unshift(thisParameter);
|
|
51866
51821
|
}
|
|
51867
51822
|
var returnTypeNode;
|
|
@@ -51910,6 +51865,21 @@ var ts;
|
|
|
51910
51865
|
}
|
|
51911
51866
|
return node;
|
|
51912
51867
|
}
|
|
51868
|
+
function tryGetThisParameterDeclaration(signature, context) {
|
|
51869
|
+
if (signature.thisParameter) {
|
|
51870
|
+
return symbolToParameterDeclaration(signature.thisParameter, context);
|
|
51871
|
+
}
|
|
51872
|
+
if (signature.declaration) {
|
|
51873
|
+
var thisTag = ts.getJSDocThisTag(signature.declaration);
|
|
51874
|
+
if (thisTag && thisTag.typeExpression) {
|
|
51875
|
+
return ts.factory.createParameterDeclaration(
|
|
51876
|
+
/* decorators */ undefined,
|
|
51877
|
+
/* modifiers */ undefined,
|
|
51878
|
+
/* dotDotDotToken */ undefined, "this",
|
|
51879
|
+
/* questionToken */ undefined, typeToTypeNodeHelper(getTypeFromTypeNode(thisTag.typeExpression), context));
|
|
51880
|
+
}
|
|
51881
|
+
}
|
|
51882
|
+
}
|
|
51913
51883
|
function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
|
|
51914
51884
|
var savedContextFlags = context.flags;
|
|
51915
51885
|
context.flags &= ~512 /* WriteTypeParametersInQualifiedName */; // Avoids potential infinite loop when building for a claimspace with a generic
|
|
@@ -52351,10 +52321,8 @@ var ts;
|
|
|
52351
52321
|
firstChar = symbolName.charCodeAt(0);
|
|
52352
52322
|
}
|
|
52353
52323
|
var expression = void 0;
|
|
52354
|
-
if (ts.isSingleOrDoubleQuote(firstChar)) {
|
|
52355
|
-
expression = ts.factory.createStringLiteral(symbolName
|
|
52356
|
-
.substring(1, symbolName.length - 1)
|
|
52357
|
-
.replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
|
|
52324
|
+
if (ts.isSingleOrDoubleQuote(firstChar) && !(symbol.flags & 8 /* EnumMember */)) {
|
|
52325
|
+
expression = ts.factory.createStringLiteral(ts.stripQuotes(symbolName).replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
|
|
52358
52326
|
}
|
|
52359
52327
|
else if (("" + +symbolName) === symbolName) {
|
|
52360
52328
|
expression = ts.factory.createNumericLiteral(+symbolName);
|
|
@@ -94347,7 +94315,7 @@ var ts;
|
|
|
94347
94315
|
function visitYieldExpression(node) {
|
|
94348
94316
|
if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) {
|
|
94349
94317
|
if (node.asteriskToken) {
|
|
94350
|
-
var expression = ts.visitNode(ts.Debug.
|
|
94318
|
+
var expression = ts.visitNode(ts.Debug.checkDefined(node.expression), visitor, ts.isExpression);
|
|
94351
94319
|
return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
|
|
94352
94320
|
/*asteriskToken*/ undefined, emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression)))), node), node);
|
|
94353
94321
|
}
|
|
@@ -95272,11 +95240,11 @@ var ts;
|
|
|
95272
95240
|
return existing.name;
|
|
95273
95241
|
}
|
|
95274
95242
|
if (!currentFileState.utilizedImplicitRuntimeImports) {
|
|
95275
|
-
currentFileState.utilizedImplicitRuntimeImports = ts.
|
|
95243
|
+
currentFileState.utilizedImplicitRuntimeImports = new ts.Map();
|
|
95276
95244
|
}
|
|
95277
95245
|
var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
|
|
95278
95246
|
if (!specifierSourceImports) {
|
|
95279
|
-
specifierSourceImports = ts.
|
|
95247
|
+
specifierSourceImports = new ts.Map();
|
|
95280
95248
|
currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
|
|
95281
95249
|
}
|
|
95282
95250
|
var generatedName = factory.createUniqueName("_" + name, 16 /* Optimistic */ | 32 /* FileLevel */ | 64 /* AllowNameSubstitution */);
|
|
@@ -113803,6 +113771,24 @@ var ts;
|
|
|
113803
113771
|
}
|
|
113804
113772
|
}
|
|
113805
113773
|
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
113774
|
+
/** @internal */
|
|
113775
|
+
ts.plainJSErrors = new ts.Set([
|
|
113776
|
+
ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
|
|
113777
|
+
ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
113778
|
+
ts.Diagnostics.Another_export_default_is_here.code,
|
|
113779
|
+
ts.Diagnostics.The_first_export_default_is_here.code,
|
|
113780
|
+
ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
|
|
113781
|
+
ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
|
|
113782
|
+
ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
|
|
113783
|
+
ts.Diagnostics.constructor_is_a_reserved_word.code,
|
|
113784
|
+
ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
|
|
113785
|
+
ts.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode.code,
|
|
113786
|
+
ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
|
|
113787
|
+
ts.Diagnostics.Invalid_use_of_0_in_strict_mode.code,
|
|
113788
|
+
ts.Diagnostics.A_label_is_not_allowed_here.code,
|
|
113789
|
+
ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
|
|
113790
|
+
ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
|
|
113791
|
+
]);
|
|
113806
113792
|
/**
|
|
113807
113793
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
113808
113794
|
*/
|
|
@@ -114463,6 +114449,7 @@ var ts;
|
|
|
114463
114449
|
newSourceFile.originalFileName = oldSourceFile.originalFileName;
|
|
114464
114450
|
newSourceFile.resolvedPath = oldSourceFile.resolvedPath;
|
|
114465
114451
|
newSourceFile.fileName = oldSourceFile.fileName;
|
|
114452
|
+
newSourceFile.impliedNodeFormat = oldSourceFile.impliedNodeFormat;
|
|
114466
114453
|
var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path);
|
|
114467
114454
|
if (packageName !== undefined) {
|
|
114468
114455
|
// If there are 2 different source files for the same package name and at least one of them changes,
|
|
@@ -114819,14 +114806,23 @@ var ts;
|
|
|
114819
114806
|
}
|
|
114820
114807
|
var typeChecker = getDiagnosticsProducingTypeChecker();
|
|
114821
114808
|
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
|
114822
|
-
var
|
|
114809
|
+
var isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
114810
|
+
var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
|
|
114811
|
+
var isPlainJs = isJs && !sourceFile.checkJsDirective && options.checkJs === undefined;
|
|
114823
114812
|
var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
|
|
114824
|
-
// By default, only type-check .ts, .tsx,
|
|
114813
|
+
// By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External
|
|
114814
|
+
// - plain JS: .js files with no // ts-check and checkJs: undefined
|
|
114815
|
+
// - check JS: .js files with either // ts-check or checkJs: true
|
|
114816
|
+
// - external: files that are added by plugins
|
|
114825
114817
|
var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
|
|
114826
|
-
|| sourceFile.scriptKind === 5 /* External */ || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
114818
|
+
|| sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
114827
114819
|
var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
|
|
114828
|
-
var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
|
|
114829
|
-
|
|
114820
|
+
var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
|
|
114821
|
+
if (isPlainJs) {
|
|
114822
|
+
bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
|
|
114823
|
+
}
|
|
114824
|
+
// skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
|
|
114825
|
+
return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
|
|
114830
114826
|
});
|
|
114831
114827
|
}
|
|
114832
114828
|
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
|
|
@@ -118735,7 +118731,7 @@ var ts;
|
|
|
118735
118731
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
118736
118732
|
if (resolution.refCount) {
|
|
118737
118733
|
resolution.refCount++;
|
|
118738
|
-
ts.Debug.
|
|
118734
|
+
ts.Debug.assertIsDefined(resolution.files);
|
|
118739
118735
|
}
|
|
118740
118736
|
else {
|
|
118741
118737
|
resolution.refCount = 1;
|
|
@@ -118803,7 +118799,7 @@ var ts;
|
|
|
118803
118799
|
}
|
|
118804
118800
|
}
|
|
118805
118801
|
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
118806
|
-
ts.unorderedRemoveItem(ts.Debug.
|
|
118802
|
+
ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
|
|
118807
118803
|
resolution.refCount--;
|
|
118808
118804
|
if (resolution.refCount) {
|
|
118809
118805
|
return;
|
|
@@ -118895,7 +118891,7 @@ var ts;
|
|
|
118895
118891
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
118896
118892
|
continue;
|
|
118897
118893
|
resolution.isInvalidated = invalidated = true;
|
|
118898
|
-
for (var _a = 0, _b = ts.Debug.
|
|
118894
|
+
for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
|
|
118899
118895
|
var containingFilePath = _b[_a];
|
|
118900
118896
|
(filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
118901
118897
|
// When its a file with inferred types resolution, invalidate type reference directive resolution
|
|
@@ -136171,14 +136167,17 @@ var ts;
|
|
|
136171
136167
|
if (node === sourceFile) {
|
|
136172
136168
|
return undefined;
|
|
136173
136169
|
}
|
|
136174
|
-
var symbol =
|
|
136170
|
+
var symbol = getSymbol(node, typeChecker);
|
|
136175
136171
|
if (!symbol)
|
|
136176
136172
|
return undefined;
|
|
136177
136173
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
136178
136174
|
var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
|
136179
136175
|
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
|
|
136180
136176
|
// If a function returns 'void' or some other type with no definition, just return the function definition.
|
|
136181
|
-
|
|
136177
|
+
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
|
|
136178
|
+
return typeDefinitions.length ? typeDefinitions
|
|
136179
|
+
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
|
|
136180
|
+
: undefined;
|
|
136182
136181
|
}
|
|
136183
136182
|
GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
|
|
136184
136183
|
function definitionFromType(type, checker, node) {
|
|
@@ -150071,9 +150070,9 @@ var ts;
|
|
|
150071
150070
|
if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
|
|
150072
150071
|
return undefined;
|
|
150073
150072
|
if (!ts.isSourceFile(ts.getThisContainer(fn, /*includeArrowFunctions*/ false))) { // 'this' is defined outside, convert to arrow function
|
|
150074
|
-
var fnKeyword = ts.Debug.
|
|
150073
|
+
var fnKeyword = ts.Debug.checkDefined(ts.findChildOfKind(fn, 98 /* FunctionKeyword */, sourceFile));
|
|
150075
150074
|
var name = fn.name;
|
|
150076
|
-
var body = ts.Debug.
|
|
150075
|
+
var body = ts.Debug.checkDefined(fn.body); // Should be defined because the function contained a 'this' expression
|
|
150077
150076
|
if (ts.isFunctionExpression(fn)) {
|
|
150078
150077
|
if (name && ts.FindAllReferences.Core.isSymbolReferencedInFile(name, checker, sourceFile, body)) {
|
|
150079
150078
|
// Function expression references itself. To fix we would have to extract it to a const.
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211121";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -151,26 +151,6 @@ var ts;
|
|
|
151
151
|
ts.emptyArray = [];
|
|
152
152
|
ts.emptyMap = new ts.Map();
|
|
153
153
|
ts.emptySet = new ts.Set();
|
|
154
|
-
function createMap() {
|
|
155
|
-
return new ts.Map();
|
|
156
|
-
}
|
|
157
|
-
ts.createMap = createMap;
|
|
158
|
-
/**
|
|
159
|
-
* Create a new map from a template object is provided, the map will copy entries from it.
|
|
160
|
-
* @deprecated Use `new Map(getEntries(template))` instead.
|
|
161
|
-
*/
|
|
162
|
-
function createMapFromTemplate(template) {
|
|
163
|
-
var map = new ts.Map();
|
|
164
|
-
// Copies keys/values from template. Note that for..in will not throw if
|
|
165
|
-
// template is undefined, and instead will just exit the loop.
|
|
166
|
-
for (var key in template) {
|
|
167
|
-
if (hasOwnProperty.call(template, key)) {
|
|
168
|
-
map.set(key, template[key]);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
return map;
|
|
172
|
-
}
|
|
173
|
-
ts.createMapFromTemplate = createMapFromTemplate;
|
|
174
154
|
function length(array) {
|
|
175
155
|
return array ? array.length : 0;
|
|
176
156
|
}
|
|
@@ -2405,11 +2385,6 @@ var ts;
|
|
|
2405
2385
|
return value;
|
|
2406
2386
|
}
|
|
2407
2387
|
Debug.checkDefined = checkDefined;
|
|
2408
|
-
/**
|
|
2409
|
-
* @deprecated Use `checkDefined` to check whether a value is defined inline. Use `assertIsDefined` to check whether
|
|
2410
|
-
* a value is defined at the statement level.
|
|
2411
|
-
*/
|
|
2412
|
-
Debug.assertDefined = checkDefined;
|
|
2413
2388
|
function assertEachIsDefined(value, message, stackCrawlMark) {
|
|
2414
2389
|
for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
|
|
2415
2390
|
var v = value_1[_i];
|
|
@@ -2422,11 +2397,6 @@ var ts;
|
|
|
2422
2397
|
return value;
|
|
2423
2398
|
}
|
|
2424
2399
|
Debug.checkEachDefined = checkEachDefined;
|
|
2425
|
-
/**
|
|
2426
|
-
* @deprecated Use `checkEachDefined` to check whether the elements of an array are defined inline. Use `assertEachIsDefined` to check whether
|
|
2427
|
-
* the elements of an array are defined at the statement level.
|
|
2428
|
-
*/
|
|
2429
|
-
Debug.assertEachDefined = checkEachDefined;
|
|
2430
2400
|
function assertNever(member, message, stackCrawlMark) {
|
|
2431
2401
|
if (message === void 0) { message = "Illegal value:"; }
|
|
2432
2402
|
var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
|
|
@@ -13886,21 +13856,6 @@ var ts;
|
|
|
13886
13856
|
return undefined;
|
|
13887
13857
|
}
|
|
13888
13858
|
ts.getDeclarationOfKind = getDeclarationOfKind;
|
|
13889
|
-
/**
|
|
13890
|
-
* Create a new escaped identifier map.
|
|
13891
|
-
* @deprecated Use `new Map<__String, T>()` instead.
|
|
13892
|
-
*/
|
|
13893
|
-
function createUnderscoreEscapedMap() {
|
|
13894
|
-
return new ts.Map();
|
|
13895
|
-
}
|
|
13896
|
-
ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap;
|
|
13897
|
-
/**
|
|
13898
|
-
* @deprecated Use `!!map?.size` instead
|
|
13899
|
-
*/
|
|
13900
|
-
function hasEntries(map) {
|
|
13901
|
-
return !!map && !!map.size;
|
|
13902
|
-
}
|
|
13903
|
-
ts.hasEntries = hasEntries;
|
|
13904
13859
|
function createSymbolTable(symbols) {
|
|
13905
13860
|
var result = new ts.Map();
|
|
13906
13861
|
if (symbols) {
|
|
@@ -26493,7 +26448,7 @@ var ts;
|
|
|
26493
26448
|
sourceMapText = mapTextOrStripInternal;
|
|
26494
26449
|
}
|
|
26495
26450
|
var node = oldFileOfCurrentEmit ?
|
|
26496
|
-
parseOldFileOfCurrentEmit(ts.Debug.
|
|
26451
|
+
parseOldFileOfCurrentEmit(ts.Debug.checkDefined(bundleFileInfo)) :
|
|
26497
26452
|
parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
|
|
26498
26453
|
node.fileName = fileName;
|
|
26499
26454
|
node.sourceMapPath = sourceMapPath;
|
|
@@ -26640,13 +26595,13 @@ var ts;
|
|
|
26640
26595
|
};
|
|
26641
26596
|
node.javascriptPath = declarationTextOrJavascriptPath;
|
|
26642
26597
|
node.javascriptMapPath = javascriptMapPath;
|
|
26643
|
-
node.declarationPath = ts.Debug.
|
|
26598
|
+
node.declarationPath = ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath);
|
|
26644
26599
|
node.declarationMapPath = declarationMapPath;
|
|
26645
26600
|
node.buildInfoPath = declarationMapTextOrBuildInfoPath;
|
|
26646
26601
|
Object.defineProperties(node, {
|
|
26647
26602
|
javascriptText: { get: function () { return definedTextGetter_1(declarationTextOrJavascriptPath); } },
|
|
26648
26603
|
javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
|
|
26649
|
-
declarationText: { get: function () { return definedTextGetter_1(ts.Debug.
|
|
26604
|
+
declarationText: { get: function () { return definedTextGetter_1(ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
|
|
26650
26605
|
declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
|
|
26651
26606
|
buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
|
|
26652
26607
|
});
|
|
@@ -51655,8 +51610,8 @@ var ts;
|
|
|
51655
51610
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
51656
51611
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
51657
51612
|
var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 170 /* Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
|
|
51658
|
-
|
|
51659
|
-
|
|
51613
|
+
var thisParameter = tryGetThisParameterDeclaration(signature, context);
|
|
51614
|
+
if (thisParameter) {
|
|
51660
51615
|
parameters.unshift(thisParameter);
|
|
51661
51616
|
}
|
|
51662
51617
|
var returnTypeNode;
|
|
@@ -51705,6 +51660,21 @@ var ts;
|
|
|
51705
51660
|
}
|
|
51706
51661
|
return node;
|
|
51707
51662
|
}
|
|
51663
|
+
function tryGetThisParameterDeclaration(signature, context) {
|
|
51664
|
+
if (signature.thisParameter) {
|
|
51665
|
+
return symbolToParameterDeclaration(signature.thisParameter, context);
|
|
51666
|
+
}
|
|
51667
|
+
if (signature.declaration) {
|
|
51668
|
+
var thisTag = ts.getJSDocThisTag(signature.declaration);
|
|
51669
|
+
if (thisTag && thisTag.typeExpression) {
|
|
51670
|
+
return ts.factory.createParameterDeclaration(
|
|
51671
|
+
/* decorators */ undefined,
|
|
51672
|
+
/* modifiers */ undefined,
|
|
51673
|
+
/* dotDotDotToken */ undefined, "this",
|
|
51674
|
+
/* questionToken */ undefined, typeToTypeNodeHelper(getTypeFromTypeNode(thisTag.typeExpression), context));
|
|
51675
|
+
}
|
|
51676
|
+
}
|
|
51677
|
+
}
|
|
51708
51678
|
function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
|
|
51709
51679
|
var savedContextFlags = context.flags;
|
|
51710
51680
|
context.flags &= ~512 /* WriteTypeParametersInQualifiedName */; // Avoids potential infinite loop when building for a claimspace with a generic
|
|
@@ -52146,10 +52116,8 @@ var ts;
|
|
|
52146
52116
|
firstChar = symbolName.charCodeAt(0);
|
|
52147
52117
|
}
|
|
52148
52118
|
var expression = void 0;
|
|
52149
|
-
if (ts.isSingleOrDoubleQuote(firstChar)) {
|
|
52150
|
-
expression = ts.factory.createStringLiteral(symbolName
|
|
52151
|
-
.substring(1, symbolName.length - 1)
|
|
52152
|
-
.replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
|
|
52119
|
+
if (ts.isSingleOrDoubleQuote(firstChar) && !(symbol.flags & 8 /* EnumMember */)) {
|
|
52120
|
+
expression = ts.factory.createStringLiteral(ts.stripQuotes(symbolName).replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
|
|
52153
52121
|
}
|
|
52154
52122
|
else if (("" + +symbolName) === symbolName) {
|
|
52155
52123
|
expression = ts.factory.createNumericLiteral(+symbolName);
|
|
@@ -94142,7 +94110,7 @@ var ts;
|
|
|
94142
94110
|
function visitYieldExpression(node) {
|
|
94143
94111
|
if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) {
|
|
94144
94112
|
if (node.asteriskToken) {
|
|
94145
|
-
var expression = ts.visitNode(ts.Debug.
|
|
94113
|
+
var expression = ts.visitNode(ts.Debug.checkDefined(node.expression), visitor, ts.isExpression);
|
|
94146
94114
|
return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
|
|
94147
94115
|
/*asteriskToken*/ undefined, emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression)))), node), node);
|
|
94148
94116
|
}
|
|
@@ -95067,11 +95035,11 @@ var ts;
|
|
|
95067
95035
|
return existing.name;
|
|
95068
95036
|
}
|
|
95069
95037
|
if (!currentFileState.utilizedImplicitRuntimeImports) {
|
|
95070
|
-
currentFileState.utilizedImplicitRuntimeImports = ts.
|
|
95038
|
+
currentFileState.utilizedImplicitRuntimeImports = new ts.Map();
|
|
95071
95039
|
}
|
|
95072
95040
|
var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
|
|
95073
95041
|
if (!specifierSourceImports) {
|
|
95074
|
-
specifierSourceImports = ts.
|
|
95042
|
+
specifierSourceImports = new ts.Map();
|
|
95075
95043
|
currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
|
|
95076
95044
|
}
|
|
95077
95045
|
var generatedName = factory.createUniqueName("_" + name, 16 /* Optimistic */ | 32 /* FileLevel */ | 64 /* AllowNameSubstitution */);
|
|
@@ -113598,6 +113566,24 @@ var ts;
|
|
|
113598
113566
|
}
|
|
113599
113567
|
}
|
|
113600
113568
|
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
113569
|
+
/** @internal */
|
|
113570
|
+
ts.plainJSErrors = new ts.Set([
|
|
113571
|
+
ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
|
|
113572
|
+
ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
113573
|
+
ts.Diagnostics.Another_export_default_is_here.code,
|
|
113574
|
+
ts.Diagnostics.The_first_export_default_is_here.code,
|
|
113575
|
+
ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
|
|
113576
|
+
ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
|
|
113577
|
+
ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
|
|
113578
|
+
ts.Diagnostics.constructor_is_a_reserved_word.code,
|
|
113579
|
+
ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
|
|
113580
|
+
ts.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode.code,
|
|
113581
|
+
ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
|
|
113582
|
+
ts.Diagnostics.Invalid_use_of_0_in_strict_mode.code,
|
|
113583
|
+
ts.Diagnostics.A_label_is_not_allowed_here.code,
|
|
113584
|
+
ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
|
|
113585
|
+
ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
|
|
113586
|
+
]);
|
|
113601
113587
|
/**
|
|
113602
113588
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
113603
113589
|
*/
|
|
@@ -114258,6 +114244,7 @@ var ts;
|
|
|
114258
114244
|
newSourceFile.originalFileName = oldSourceFile.originalFileName;
|
|
114259
114245
|
newSourceFile.resolvedPath = oldSourceFile.resolvedPath;
|
|
114260
114246
|
newSourceFile.fileName = oldSourceFile.fileName;
|
|
114247
|
+
newSourceFile.impliedNodeFormat = oldSourceFile.impliedNodeFormat;
|
|
114261
114248
|
var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path);
|
|
114262
114249
|
if (packageName !== undefined) {
|
|
114263
114250
|
// If there are 2 different source files for the same package name and at least one of them changes,
|
|
@@ -114614,14 +114601,23 @@ var ts;
|
|
|
114614
114601
|
}
|
|
114615
114602
|
var typeChecker = getDiagnosticsProducingTypeChecker();
|
|
114616
114603
|
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
|
114617
|
-
var
|
|
114604
|
+
var isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
114605
|
+
var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
|
|
114606
|
+
var isPlainJs = isJs && !sourceFile.checkJsDirective && options.checkJs === undefined;
|
|
114618
114607
|
var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
|
|
114619
|
-
// By default, only type-check .ts, .tsx,
|
|
114608
|
+
// By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External
|
|
114609
|
+
// - plain JS: .js files with no // ts-check and checkJs: undefined
|
|
114610
|
+
// - check JS: .js files with either // ts-check or checkJs: true
|
|
114611
|
+
// - external: files that are added by plugins
|
|
114620
114612
|
var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
|
|
114621
|
-
|| sourceFile.scriptKind === 5 /* External */ || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
114613
|
+
|| sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
114622
114614
|
var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
|
|
114623
|
-
var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
|
|
114624
|
-
|
|
114615
|
+
var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
|
|
114616
|
+
if (isPlainJs) {
|
|
114617
|
+
bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
|
|
114618
|
+
}
|
|
114619
|
+
// skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
|
|
114620
|
+
return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
|
|
114625
114621
|
});
|
|
114626
114622
|
}
|
|
114627
114623
|
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
|
|
@@ -118530,7 +118526,7 @@ var ts;
|
|
|
118530
118526
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
118531
118527
|
if (resolution.refCount) {
|
|
118532
118528
|
resolution.refCount++;
|
|
118533
|
-
ts.Debug.
|
|
118529
|
+
ts.Debug.assertIsDefined(resolution.files);
|
|
118534
118530
|
}
|
|
118535
118531
|
else {
|
|
118536
118532
|
resolution.refCount = 1;
|
|
@@ -118598,7 +118594,7 @@ var ts;
|
|
|
118598
118594
|
}
|
|
118599
118595
|
}
|
|
118600
118596
|
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
118601
|
-
ts.unorderedRemoveItem(ts.Debug.
|
|
118597
|
+
ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
|
|
118602
118598
|
resolution.refCount--;
|
|
118603
118599
|
if (resolution.refCount) {
|
|
118604
118600
|
return;
|
|
@@ -118690,7 +118686,7 @@ var ts;
|
|
|
118690
118686
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
118691
118687
|
continue;
|
|
118692
118688
|
resolution.isInvalidated = invalidated = true;
|
|
118693
|
-
for (var _a = 0, _b = ts.Debug.
|
|
118689
|
+
for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
|
|
118694
118690
|
var containingFilePath = _b[_a];
|
|
118695
118691
|
(filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
118696
118692
|
// When its a file with inferred types resolution, invalidate type reference directive resolution
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.6.0-dev.
|
|
5
|
+
"version": "4.6.0-dev.20211121",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|