typescript 4.9.0-dev.20221017 → 4.9.0-dev.20221019
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/es/diagnosticMessages.generated.json +6 -0
- package/lib/it/diagnosticMessages.generated.json +6 -0
- package/lib/ko/diagnosticMessages.generated.json +6 -0
- package/lib/pt-br/diagnosticMessages.generated.json +6 -0
- package/lib/tsc.js +18 -27
- package/lib/tsserver.js +39 -52
- package/lib/tsserverlibrary.js +39 -52
- package/lib/typescript.js +39 -52
- package/lib/typescriptServices.js +39 -52
- package/lib/typingsInstaller.js +26 -45
- package/lib/zh-cn/diagnosticMessages.generated.json +6 -0
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -108,7 +108,7 @@ var ts;
|
|
|
108
108
|
// The following is baselined as a literal template type without intervention
|
|
109
109
|
/** The version of the TypeScript compiler release */
|
|
110
110
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
111
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
111
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221019");
|
|
112
112
|
/* @internal */
|
|
113
113
|
var Comparison;
|
|
114
114
|
(function (Comparison) {
|
|
@@ -21719,13 +21719,11 @@ var ts;
|
|
|
21719
21719
|
* Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator.
|
|
21720
21720
|
*/
|
|
21721
21721
|
function createBaseNodeFactory() {
|
|
21722
|
-
// tslint:disable variable-name
|
|
21723
21722
|
var NodeConstructor;
|
|
21724
21723
|
var TokenConstructor;
|
|
21725
21724
|
var IdentifierConstructor;
|
|
21726
21725
|
var PrivateIdentifierConstructor;
|
|
21727
21726
|
var SourceFileConstructor;
|
|
21728
|
-
// tslint:enable variable-name
|
|
21729
21727
|
return {
|
|
21730
21728
|
createBaseSourceFileNode: createBaseSourceFileNode,
|
|
21731
21729
|
createBaseIdentifierNode: createBaseIdentifierNode,
|
|
@@ -27657,11 +27655,9 @@ var ts;
|
|
|
27657
27655
|
rawTextScanner.setText("`" + rawText + "`");
|
|
27658
27656
|
break;
|
|
27659
27657
|
case 15 /* SyntaxKind.TemplateHead */:
|
|
27660
|
-
// tslint:disable-next-line no-invalid-template-strings
|
|
27661
27658
|
rawTextScanner.setText("`" + rawText + "${");
|
|
27662
27659
|
break;
|
|
27663
27660
|
case 16 /* SyntaxKind.TemplateMiddle */:
|
|
27664
|
-
// tslint:disable-next-line no-invalid-template-strings
|
|
27665
27661
|
rawTextScanner.setText("}" + rawText + "${");
|
|
27666
27662
|
break;
|
|
27667
27663
|
case 17 /* SyntaxKind.TemplateTail */:
|
|
@@ -28020,7 +28016,6 @@ var ts;
|
|
|
28020
28016
|
return node;
|
|
28021
28017
|
}
|
|
28022
28018
|
ts.createInputFiles = createInputFiles;
|
|
28023
|
-
// tslint:disable-next-line variable-name
|
|
28024
28019
|
var SourceMapSource;
|
|
28025
28020
|
/**
|
|
28026
28021
|
* Create an external source map source file reference
|
|
@@ -32154,13 +32149,11 @@ var ts;
|
|
|
32154
32149
|
var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true);
|
|
32155
32150
|
var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */;
|
|
32156
32151
|
// capture constructors in 'initializeState' to avoid null checks
|
|
32157
|
-
// tslint:disable variable-name
|
|
32158
32152
|
var NodeConstructor;
|
|
32159
32153
|
var TokenConstructor;
|
|
32160
32154
|
var IdentifierConstructor;
|
|
32161
32155
|
var PrivateIdentifierConstructor;
|
|
32162
32156
|
var SourceFileConstructor;
|
|
32163
|
-
// tslint:enable variable-name
|
|
32164
32157
|
function countNode(node) {
|
|
32165
32158
|
nodeCount++;
|
|
32166
32159
|
return node;
|
|
@@ -72130,7 +72123,7 @@ var ts;
|
|
|
72130
72123
|
type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
|
|
72131
72124
|
}
|
|
72132
72125
|
else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
|
|
72133
|
-
type =
|
|
72126
|
+
type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
|
|
72134
72127
|
}
|
|
72135
72128
|
else {
|
|
72136
72129
|
if (strictNullChecks) {
|
|
@@ -72411,7 +72404,7 @@ var ts;
|
|
|
72411
72404
|
!!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
|
|
72412
72405
|
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
72413
72406
|
}
|
|
72414
|
-
function
|
|
72407
|
+
function narrowTypeByInKeyword(type, nameType, assumeTrue) {
|
|
72415
72408
|
var name = getPropertyNameFromType(nameType);
|
|
72416
72409
|
var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
|
|
72417
72410
|
if (isKnownProperty) {
|
|
@@ -72492,7 +72485,7 @@ var ts;
|
|
|
72492
72485
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
|
|
72493
72486
|
}
|
|
72494
72487
|
if (isMatchingReference(reference, target)) {
|
|
72495
|
-
return
|
|
72488
|
+
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
72496
72489
|
}
|
|
72497
72490
|
}
|
|
72498
72491
|
break;
|
|
@@ -72681,7 +72674,7 @@ var ts;
|
|
|
72681
72674
|
neverType;
|
|
72682
72675
|
});
|
|
72683
72676
|
}
|
|
72684
|
-
function
|
|
72677
|
+
function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
|
|
72685
72678
|
var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
|
|
72686
72679
|
if (!witnesses) {
|
|
72687
72680
|
return type;
|
|
@@ -83048,7 +83041,7 @@ var ts;
|
|
|
83048
83041
|
// We only need `Awaited<T>` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
83049
83042
|
// or is promise-like.
|
|
83050
83043
|
if (baseConstraint ?
|
|
83051
|
-
baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) ||
|
|
83044
|
+
baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
|
|
83052
83045
|
maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) {
|
|
83053
83046
|
return true;
|
|
83054
83047
|
}
|
|
@@ -86863,12 +86856,11 @@ var ts;
|
|
|
86863
86856
|
}
|
|
86864
86857
|
}
|
|
86865
86858
|
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
|
|
86866
|
-
var _a;
|
|
86867
86859
|
switch (node.kind) {
|
|
86868
86860
|
case 240 /* SyntaxKind.VariableStatement */:
|
|
86869
86861
|
// error each individual name in variable statement instead of marking the entire variable statement
|
|
86870
|
-
for (var _i = 0,
|
|
86871
|
-
var decl =
|
|
86862
|
+
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
|
|
86863
|
+
var decl = _a[_i];
|
|
86872
86864
|
checkModuleAugmentationElement(decl, isGlobalAugmentation);
|
|
86873
86865
|
}
|
|
86874
86866
|
break;
|
|
@@ -86884,8 +86876,8 @@ var ts;
|
|
|
86884
86876
|
case 257 /* SyntaxKind.VariableDeclaration */:
|
|
86885
86877
|
var name = node.name;
|
|
86886
86878
|
if (ts.isBindingPattern(name)) {
|
|
86887
|
-
for (var
|
|
86888
|
-
var el =
|
|
86879
|
+
for (var _b = 0, _c = name.elements; _b < _c.length; _b++) {
|
|
86880
|
+
var el = _c[_b];
|
|
86889
86881
|
// mark individual names in binding pattern
|
|
86890
86882
|
checkModuleAugmentationElement(el, isGlobalAugmentation);
|
|
86891
86883
|
}
|
|
@@ -86901,18 +86893,6 @@ var ts;
|
|
|
86901
86893
|
if (isGlobalAugmentation) {
|
|
86902
86894
|
return;
|
|
86903
86895
|
}
|
|
86904
|
-
var symbol = getSymbolOfNode(node);
|
|
86905
|
-
if (symbol) {
|
|
86906
|
-
// module augmentations cannot introduce new names on the top level scope of the module
|
|
86907
|
-
// this is done it two steps
|
|
86908
|
-
// 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error
|
|
86909
|
-
// 2. main check - report error if value declaration of the parent symbol is module augmentation)
|
|
86910
|
-
var reportError = !(symbol.flags & 33554432 /* SymbolFlags.Transient */);
|
|
86911
|
-
if (!reportError) {
|
|
86912
|
-
// symbol should not originate in augmentation
|
|
86913
|
-
reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]);
|
|
86914
|
-
}
|
|
86915
|
-
}
|
|
86916
86896
|
break;
|
|
86917
86897
|
}
|
|
86918
86898
|
}
|
|
@@ -107407,7 +107387,7 @@ var ts;
|
|
|
107407
107387
|
return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis);
|
|
107408
107388
|
case ts.ModuleKind.CommonJS:
|
|
107409
107389
|
default:
|
|
107410
|
-
return createImportCallExpressionCommonJS(argument
|
|
107390
|
+
return createImportCallExpressionCommonJS(argument);
|
|
107411
107391
|
}
|
|
107412
107392
|
}
|
|
107413
107393
|
function createImportCallExpressionUMD(arg, containsLexicalThis) {
|
|
@@ -107430,7 +107410,7 @@ var ts;
|
|
|
107430
107410
|
return factory.createConditionalExpression(
|
|
107431
107411
|
/*condition*/ factory.createIdentifier("__syncRequire"),
|
|
107432
107412
|
/*questionToken*/ undefined,
|
|
107433
|
-
/*whenTrue*/ createImportCallExpressionCommonJS(arg
|
|
107413
|
+
/*whenTrue*/ createImportCallExpressionCommonJS(arg),
|
|
107434
107414
|
/*colonToken*/ undefined,
|
|
107435
107415
|
/*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis));
|
|
107436
107416
|
}
|
|
@@ -107439,7 +107419,7 @@ var ts;
|
|
|
107439
107419
|
return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(
|
|
107440
107420
|
/*condition*/ factory.createIdentifier("__syncRequire"),
|
|
107441
107421
|
/*questionToken*/ undefined,
|
|
107442
|
-
/*whenTrue*/ createImportCallExpressionCommonJS(temp,
|
|
107422
|
+
/*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true),
|
|
107443
107423
|
/*colonToken*/ undefined,
|
|
107444
107424
|
/*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis)));
|
|
107445
107425
|
}
|
|
@@ -107489,14 +107469,20 @@ var ts;
|
|
|
107489
107469
|
}
|
|
107490
107470
|
return promise;
|
|
107491
107471
|
}
|
|
107492
|
-
function createImportCallExpressionCommonJS(arg,
|
|
107493
|
-
// import(
|
|
107472
|
+
function createImportCallExpressionCommonJS(arg, isInlineable) {
|
|
107473
|
+
// import(x)
|
|
107494
107474
|
// emit as
|
|
107495
|
-
//
|
|
107475
|
+
// var _a;
|
|
107476
|
+
// (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/
|
|
107496
107477
|
// We have to wrap require in then callback so that require is done in asynchronously
|
|
107497
107478
|
// if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
|
|
107498
|
-
|
|
107499
|
-
var
|
|
107479
|
+
// If the arg is not inlineable, we have to evaluate it in the current scope with a temp var
|
|
107480
|
+
var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined;
|
|
107481
|
+
var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"),
|
|
107482
|
+
/*typeArguments*/ undefined,
|
|
107483
|
+
/*argumentsArray*/ []);
|
|
107484
|
+
var requireCall = factory.createCallExpression(factory.createIdentifier("require"),
|
|
107485
|
+
/*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []);
|
|
107500
107486
|
if (ts.getESModuleInterop(compilerOptions)) {
|
|
107501
107487
|
requireCall = emitHelpers().createImportStarHelper(requireCall);
|
|
107502
107488
|
}
|
|
@@ -107517,14 +107503,9 @@ var ts;
|
|
|
107517
107503
|
/*typeParameters*/ undefined,
|
|
107518
107504
|
/*parameters*/ [],
|
|
107519
107505
|
/*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)]));
|
|
107520
|
-
// if there is a lexical 'this' in the import call arguments, ensure we indicate
|
|
107521
|
-
// that this new function expression indicates it captures 'this' so that the
|
|
107522
|
-
// es2015 transformer will properly substitute 'this' with '_this'.
|
|
107523
|
-
if (containsLexicalThis) {
|
|
107524
|
-
ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */);
|
|
107525
|
-
}
|
|
107526
107506
|
}
|
|
107527
|
-
|
|
107507
|
+
var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
|
|
107508
|
+
return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]);
|
|
107528
107509
|
}
|
|
107529
107510
|
function getHelperExpressionForExport(node, innerExpr) {
|
|
107530
107511
|
if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) {
|
|
@@ -135899,7 +135880,7 @@ var ts;
|
|
|
135899
135880
|
if (preferences.includeCompletionsWithClassMemberSnippets &&
|
|
135900
135881
|
preferences.includeCompletionsWithInsertText &&
|
|
135901
135882
|
completionKind === 3 /* CompletionKind.MemberLike */ &&
|
|
135902
|
-
isClassLikeMemberCompletion(symbol, location)) {
|
|
135883
|
+
isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
135903
135884
|
var importAdder = void 0;
|
|
135904
135885
|
(_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan);
|
|
135905
135886
|
sortText = Completions.SortText.ClassMemberSnippets; // sortText has to be lower priority than the sortText for keywords. See #47852.
|
|
@@ -135971,7 +135952,7 @@ var ts;
|
|
|
135971
135952
|
data: data,
|
|
135972
135953
|
};
|
|
135973
135954
|
}
|
|
135974
|
-
function isClassLikeMemberCompletion(symbol, location) {
|
|
135955
|
+
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
135975
135956
|
// TODO: support JS files.
|
|
135976
135957
|
if (ts.isInJSFile(location)) {
|
|
135977
135958
|
return false;
|
|
@@ -136005,6 +135986,7 @@ var ts;
|
|
|
136005
135986
|
location.parent.parent &&
|
|
136006
135987
|
ts.isClassElement(location.parent) &&
|
|
136007
135988
|
location === location.parent.name &&
|
|
135989
|
+
location.parent.getLastToken(sourceFile) === location.parent.name &&
|
|
136008
135990
|
ts.isClassLike(location.parent.parent)) ||
|
|
136009
135991
|
(location.parent &&
|
|
136010
135992
|
ts.isSyntaxList(location) &&
|
|
@@ -144017,19 +143999,24 @@ var ts;
|
|
|
144017
143999
|
return getCommentOwnerInfoWorker(commentOwner.initializer, options);
|
|
144018
144000
|
case 260 /* SyntaxKind.ClassDeclaration */:
|
|
144019
144001
|
case 261 /* SyntaxKind.InterfaceDeclaration */:
|
|
144020
|
-
case 168 /* SyntaxKind.PropertySignature */:
|
|
144021
144002
|
case 263 /* SyntaxKind.EnumDeclaration */:
|
|
144022
144003
|
case 302 /* SyntaxKind.EnumMember */:
|
|
144023
144004
|
case 262 /* SyntaxKind.TypeAliasDeclaration */:
|
|
144024
144005
|
return { commentOwner: commentOwner };
|
|
144006
|
+
case 168 /* SyntaxKind.PropertySignature */: {
|
|
144007
|
+
var host_1 = commentOwner;
|
|
144008
|
+
return host_1.type && ts.isFunctionTypeNode(host_1.type)
|
|
144009
|
+
? { commentOwner: commentOwner, parameters: host_1.type.parameters, hasReturn: hasReturn(host_1.type, options) }
|
|
144010
|
+
: { commentOwner: commentOwner };
|
|
144011
|
+
}
|
|
144025
144012
|
case 240 /* SyntaxKind.VariableStatement */: {
|
|
144026
144013
|
var varStatement = commentOwner;
|
|
144027
144014
|
var varDeclarations = varStatement.declarationList.declarations;
|
|
144028
|
-
var
|
|
144015
|
+
var host_2 = varDeclarations.length === 1 && varDeclarations[0].initializer
|
|
144029
144016
|
? getRightHandSideOfAssignment(varDeclarations[0].initializer)
|
|
144030
144017
|
: undefined;
|
|
144031
|
-
return
|
|
144032
|
-
? { commentOwner: commentOwner, parameters:
|
|
144018
|
+
return host_2
|
|
144019
|
+
? { commentOwner: commentOwner, parameters: host_2.parameters, hasReturn: hasReturn(host_2, options) }
|
|
144033
144020
|
: { commentOwner: commentOwner };
|
|
144034
144021
|
}
|
|
144035
144022
|
case 308 /* SyntaxKind.SourceFile */:
|
|
@@ -144059,7 +144046,7 @@ var ts;
|
|
|
144059
144046
|
}
|
|
144060
144047
|
function hasReturn(node, options) {
|
|
144061
144048
|
return !!(options === null || options === void 0 ? void 0 : options.generateReturnInDocTemplate) &&
|
|
144062
|
-
(ts.isArrowFunction(node) && ts.isExpression(node.body)
|
|
144049
|
+
(ts.isFunctionTypeNode(node) || ts.isArrowFunction(node) && ts.isExpression(node.body)
|
|
144063
144050
|
|| ts.isFunctionLikeDeclaration(node) && node.body && ts.isBlock(node.body) && !!ts.forEachReturnStatement(node.body, function (n) { return n; }));
|
|
144064
144051
|
}
|
|
144065
144052
|
function getRightHandSideOfAssignment(rightHandSide) {
|
package/lib/typescript.js
CHANGED
|
@@ -99,7 +99,7 @@ var ts;
|
|
|
99
99
|
// The following is baselined as a literal template type without intervention
|
|
100
100
|
/** The version of the TypeScript compiler release */
|
|
101
101
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
102
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.
|
|
102
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-dev.20221019");
|
|
103
103
|
/* @internal */
|
|
104
104
|
var Comparison;
|
|
105
105
|
(function (Comparison) {
|
|
@@ -21710,13 +21710,11 @@ var ts;
|
|
|
21710
21710
|
* Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator.
|
|
21711
21711
|
*/
|
|
21712
21712
|
function createBaseNodeFactory() {
|
|
21713
|
-
// tslint:disable variable-name
|
|
21714
21713
|
var NodeConstructor;
|
|
21715
21714
|
var TokenConstructor;
|
|
21716
21715
|
var IdentifierConstructor;
|
|
21717
21716
|
var PrivateIdentifierConstructor;
|
|
21718
21717
|
var SourceFileConstructor;
|
|
21719
|
-
// tslint:enable variable-name
|
|
21720
21718
|
return {
|
|
21721
21719
|
createBaseSourceFileNode: createBaseSourceFileNode,
|
|
21722
21720
|
createBaseIdentifierNode: createBaseIdentifierNode,
|
|
@@ -27648,11 +27646,9 @@ var ts;
|
|
|
27648
27646
|
rawTextScanner.setText("`" + rawText + "`");
|
|
27649
27647
|
break;
|
|
27650
27648
|
case 15 /* SyntaxKind.TemplateHead */:
|
|
27651
|
-
// tslint:disable-next-line no-invalid-template-strings
|
|
27652
27649
|
rawTextScanner.setText("`" + rawText + "${");
|
|
27653
27650
|
break;
|
|
27654
27651
|
case 16 /* SyntaxKind.TemplateMiddle */:
|
|
27655
|
-
// tslint:disable-next-line no-invalid-template-strings
|
|
27656
27652
|
rawTextScanner.setText("}" + rawText + "${");
|
|
27657
27653
|
break;
|
|
27658
27654
|
case 17 /* SyntaxKind.TemplateTail */:
|
|
@@ -28011,7 +28007,6 @@ var ts;
|
|
|
28011
28007
|
return node;
|
|
28012
28008
|
}
|
|
28013
28009
|
ts.createInputFiles = createInputFiles;
|
|
28014
|
-
// tslint:disable-next-line variable-name
|
|
28015
28010
|
var SourceMapSource;
|
|
28016
28011
|
/**
|
|
28017
28012
|
* Create an external source map source file reference
|
|
@@ -32145,13 +32140,11 @@ var ts;
|
|
|
32145
32140
|
var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true);
|
|
32146
32141
|
var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */;
|
|
32147
32142
|
// capture constructors in 'initializeState' to avoid null checks
|
|
32148
|
-
// tslint:disable variable-name
|
|
32149
32143
|
var NodeConstructor;
|
|
32150
32144
|
var TokenConstructor;
|
|
32151
32145
|
var IdentifierConstructor;
|
|
32152
32146
|
var PrivateIdentifierConstructor;
|
|
32153
32147
|
var SourceFileConstructor;
|
|
32154
|
-
// tslint:enable variable-name
|
|
32155
32148
|
function countNode(node) {
|
|
32156
32149
|
nodeCount++;
|
|
32157
32150
|
return node;
|
|
@@ -72121,7 +72114,7 @@ var ts;
|
|
|
72121
72114
|
type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
|
|
72122
72115
|
}
|
|
72123
72116
|
else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
|
|
72124
|
-
type =
|
|
72117
|
+
type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
|
|
72125
72118
|
}
|
|
72126
72119
|
else {
|
|
72127
72120
|
if (strictNullChecks) {
|
|
@@ -72402,7 +72395,7 @@ var ts;
|
|
|
72402
72395
|
!!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue :
|
|
72403
72396
|
!!getApplicableIndexInfoForName(type, propName) || !assumeTrue;
|
|
72404
72397
|
}
|
|
72405
|
-
function
|
|
72398
|
+
function narrowTypeByInKeyword(type, nameType, assumeTrue) {
|
|
72406
72399
|
var name = getPropertyNameFromType(nameType);
|
|
72407
72400
|
var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); });
|
|
72408
72401
|
if (isKnownProperty) {
|
|
@@ -72483,7 +72476,7 @@ var ts;
|
|
|
72483
72476
|
return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */);
|
|
72484
72477
|
}
|
|
72485
72478
|
if (isMatchingReference(reference, target)) {
|
|
72486
|
-
return
|
|
72479
|
+
return narrowTypeByInKeyword(type, leftType, assumeTrue);
|
|
72487
72480
|
}
|
|
72488
72481
|
}
|
|
72489
72482
|
break;
|
|
@@ -72672,7 +72665,7 @@ var ts;
|
|
|
72672
72665
|
neverType;
|
|
72673
72666
|
});
|
|
72674
72667
|
}
|
|
72675
|
-
function
|
|
72668
|
+
function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) {
|
|
72676
72669
|
var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement);
|
|
72677
72670
|
if (!witnesses) {
|
|
72678
72671
|
return type;
|
|
@@ -83039,7 +83032,7 @@ var ts;
|
|
|
83039
83032
|
// We only need `Awaited<T>` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`,
|
|
83040
83033
|
// or is promise-like.
|
|
83041
83034
|
if (baseConstraint ?
|
|
83042
|
-
baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) ||
|
|
83035
|
+
baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) :
|
|
83043
83036
|
maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) {
|
|
83044
83037
|
return true;
|
|
83045
83038
|
}
|
|
@@ -86854,12 +86847,11 @@ var ts;
|
|
|
86854
86847
|
}
|
|
86855
86848
|
}
|
|
86856
86849
|
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
|
|
86857
|
-
var _a;
|
|
86858
86850
|
switch (node.kind) {
|
|
86859
86851
|
case 240 /* SyntaxKind.VariableStatement */:
|
|
86860
86852
|
// error each individual name in variable statement instead of marking the entire variable statement
|
|
86861
|
-
for (var _i = 0,
|
|
86862
|
-
var decl =
|
|
86853
|
+
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
|
|
86854
|
+
var decl = _a[_i];
|
|
86863
86855
|
checkModuleAugmentationElement(decl, isGlobalAugmentation);
|
|
86864
86856
|
}
|
|
86865
86857
|
break;
|
|
@@ -86875,8 +86867,8 @@ var ts;
|
|
|
86875
86867
|
case 257 /* SyntaxKind.VariableDeclaration */:
|
|
86876
86868
|
var name = node.name;
|
|
86877
86869
|
if (ts.isBindingPattern(name)) {
|
|
86878
|
-
for (var
|
|
86879
|
-
var el =
|
|
86870
|
+
for (var _b = 0, _c = name.elements; _b < _c.length; _b++) {
|
|
86871
|
+
var el = _c[_b];
|
|
86880
86872
|
// mark individual names in binding pattern
|
|
86881
86873
|
checkModuleAugmentationElement(el, isGlobalAugmentation);
|
|
86882
86874
|
}
|
|
@@ -86892,18 +86884,6 @@ var ts;
|
|
|
86892
86884
|
if (isGlobalAugmentation) {
|
|
86893
86885
|
return;
|
|
86894
86886
|
}
|
|
86895
|
-
var symbol = getSymbolOfNode(node);
|
|
86896
|
-
if (symbol) {
|
|
86897
|
-
// module augmentations cannot introduce new names on the top level scope of the module
|
|
86898
|
-
// this is done it two steps
|
|
86899
|
-
// 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error
|
|
86900
|
-
// 2. main check - report error if value declaration of the parent symbol is module augmentation)
|
|
86901
|
-
var reportError = !(symbol.flags & 33554432 /* SymbolFlags.Transient */);
|
|
86902
|
-
if (!reportError) {
|
|
86903
|
-
// symbol should not originate in augmentation
|
|
86904
|
-
reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]);
|
|
86905
|
-
}
|
|
86906
|
-
}
|
|
86907
86887
|
break;
|
|
86908
86888
|
}
|
|
86909
86889
|
}
|
|
@@ -107398,7 +107378,7 @@ var ts;
|
|
|
107398
107378
|
return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis);
|
|
107399
107379
|
case ts.ModuleKind.CommonJS:
|
|
107400
107380
|
default:
|
|
107401
|
-
return createImportCallExpressionCommonJS(argument
|
|
107381
|
+
return createImportCallExpressionCommonJS(argument);
|
|
107402
107382
|
}
|
|
107403
107383
|
}
|
|
107404
107384
|
function createImportCallExpressionUMD(arg, containsLexicalThis) {
|
|
@@ -107421,7 +107401,7 @@ var ts;
|
|
|
107421
107401
|
return factory.createConditionalExpression(
|
|
107422
107402
|
/*condition*/ factory.createIdentifier("__syncRequire"),
|
|
107423
107403
|
/*questionToken*/ undefined,
|
|
107424
|
-
/*whenTrue*/ createImportCallExpressionCommonJS(arg
|
|
107404
|
+
/*whenTrue*/ createImportCallExpressionCommonJS(arg),
|
|
107425
107405
|
/*colonToken*/ undefined,
|
|
107426
107406
|
/*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis));
|
|
107427
107407
|
}
|
|
@@ -107430,7 +107410,7 @@ var ts;
|
|
|
107430
107410
|
return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(
|
|
107431
107411
|
/*condition*/ factory.createIdentifier("__syncRequire"),
|
|
107432
107412
|
/*questionToken*/ undefined,
|
|
107433
|
-
/*whenTrue*/ createImportCallExpressionCommonJS(temp,
|
|
107413
|
+
/*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true),
|
|
107434
107414
|
/*colonToken*/ undefined,
|
|
107435
107415
|
/*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis)));
|
|
107436
107416
|
}
|
|
@@ -107480,14 +107460,20 @@ var ts;
|
|
|
107480
107460
|
}
|
|
107481
107461
|
return promise;
|
|
107482
107462
|
}
|
|
107483
|
-
function createImportCallExpressionCommonJS(arg,
|
|
107484
|
-
// import(
|
|
107463
|
+
function createImportCallExpressionCommonJS(arg, isInlineable) {
|
|
107464
|
+
// import(x)
|
|
107485
107465
|
// emit as
|
|
107486
|
-
//
|
|
107466
|
+
// var _a;
|
|
107467
|
+
// (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/
|
|
107487
107468
|
// We have to wrap require in then callback so that require is done in asynchronously
|
|
107488
107469
|
// if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately
|
|
107489
|
-
|
|
107490
|
-
var
|
|
107470
|
+
// If the arg is not inlineable, we have to evaluate it in the current scope with a temp var
|
|
107471
|
+
var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined;
|
|
107472
|
+
var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"),
|
|
107473
|
+
/*typeArguments*/ undefined,
|
|
107474
|
+
/*argumentsArray*/ []);
|
|
107475
|
+
var requireCall = factory.createCallExpression(factory.createIdentifier("require"),
|
|
107476
|
+
/*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []);
|
|
107491
107477
|
if (ts.getESModuleInterop(compilerOptions)) {
|
|
107492
107478
|
requireCall = emitHelpers().createImportStarHelper(requireCall);
|
|
107493
107479
|
}
|
|
@@ -107508,14 +107494,9 @@ var ts;
|
|
|
107508
107494
|
/*typeParameters*/ undefined,
|
|
107509
107495
|
/*parameters*/ [],
|
|
107510
107496
|
/*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)]));
|
|
107511
|
-
// if there is a lexical 'this' in the import call arguments, ensure we indicate
|
|
107512
|
-
// that this new function expression indicates it captures 'this' so that the
|
|
107513
|
-
// es2015 transformer will properly substitute 'this' with '_this'.
|
|
107514
|
-
if (containsLexicalThis) {
|
|
107515
|
-
ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */);
|
|
107516
|
-
}
|
|
107517
107497
|
}
|
|
107518
|
-
|
|
107498
|
+
var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]);
|
|
107499
|
+
return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]);
|
|
107519
107500
|
}
|
|
107520
107501
|
function getHelperExpressionForExport(node, innerExpr) {
|
|
107521
107502
|
if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) {
|
|
@@ -135890,7 +135871,7 @@ var ts;
|
|
|
135890
135871
|
if (preferences.includeCompletionsWithClassMemberSnippets &&
|
|
135891
135872
|
preferences.includeCompletionsWithInsertText &&
|
|
135892
135873
|
completionKind === 3 /* CompletionKind.MemberLike */ &&
|
|
135893
|
-
isClassLikeMemberCompletion(symbol, location)) {
|
|
135874
|
+
isClassLikeMemberCompletion(symbol, location, sourceFile)) {
|
|
135894
135875
|
var importAdder = void 0;
|
|
135895
135876
|
(_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan);
|
|
135896
135877
|
sortText = Completions.SortText.ClassMemberSnippets; // sortText has to be lower priority than the sortText for keywords. See #47852.
|
|
@@ -135962,7 +135943,7 @@ var ts;
|
|
|
135962
135943
|
data: data,
|
|
135963
135944
|
};
|
|
135964
135945
|
}
|
|
135965
|
-
function isClassLikeMemberCompletion(symbol, location) {
|
|
135946
|
+
function isClassLikeMemberCompletion(symbol, location, sourceFile) {
|
|
135966
135947
|
// TODO: support JS files.
|
|
135967
135948
|
if (ts.isInJSFile(location)) {
|
|
135968
135949
|
return false;
|
|
@@ -135996,6 +135977,7 @@ var ts;
|
|
|
135996
135977
|
location.parent.parent &&
|
|
135997
135978
|
ts.isClassElement(location.parent) &&
|
|
135998
135979
|
location === location.parent.name &&
|
|
135980
|
+
location.parent.getLastToken(sourceFile) === location.parent.name &&
|
|
135999
135981
|
ts.isClassLike(location.parent.parent)) ||
|
|
136000
135982
|
(location.parent &&
|
|
136001
135983
|
ts.isSyntaxList(location) &&
|
|
@@ -144008,19 +143990,24 @@ var ts;
|
|
|
144008
143990
|
return getCommentOwnerInfoWorker(commentOwner.initializer, options);
|
|
144009
143991
|
case 260 /* SyntaxKind.ClassDeclaration */:
|
|
144010
143992
|
case 261 /* SyntaxKind.InterfaceDeclaration */:
|
|
144011
|
-
case 168 /* SyntaxKind.PropertySignature */:
|
|
144012
143993
|
case 263 /* SyntaxKind.EnumDeclaration */:
|
|
144013
143994
|
case 302 /* SyntaxKind.EnumMember */:
|
|
144014
143995
|
case 262 /* SyntaxKind.TypeAliasDeclaration */:
|
|
144015
143996
|
return { commentOwner: commentOwner };
|
|
143997
|
+
case 168 /* SyntaxKind.PropertySignature */: {
|
|
143998
|
+
var host_1 = commentOwner;
|
|
143999
|
+
return host_1.type && ts.isFunctionTypeNode(host_1.type)
|
|
144000
|
+
? { commentOwner: commentOwner, parameters: host_1.type.parameters, hasReturn: hasReturn(host_1.type, options) }
|
|
144001
|
+
: { commentOwner: commentOwner };
|
|
144002
|
+
}
|
|
144016
144003
|
case 240 /* SyntaxKind.VariableStatement */: {
|
|
144017
144004
|
var varStatement = commentOwner;
|
|
144018
144005
|
var varDeclarations = varStatement.declarationList.declarations;
|
|
144019
|
-
var
|
|
144006
|
+
var host_2 = varDeclarations.length === 1 && varDeclarations[0].initializer
|
|
144020
144007
|
? getRightHandSideOfAssignment(varDeclarations[0].initializer)
|
|
144021
144008
|
: undefined;
|
|
144022
|
-
return
|
|
144023
|
-
? { commentOwner: commentOwner, parameters:
|
|
144009
|
+
return host_2
|
|
144010
|
+
? { commentOwner: commentOwner, parameters: host_2.parameters, hasReturn: hasReturn(host_2, options) }
|
|
144024
144011
|
: { commentOwner: commentOwner };
|
|
144025
144012
|
}
|
|
144026
144013
|
case 308 /* SyntaxKind.SourceFile */:
|
|
@@ -144050,7 +144037,7 @@ var ts;
|
|
|
144050
144037
|
}
|
|
144051
144038
|
function hasReturn(node, options) {
|
|
144052
144039
|
return !!(options === null || options === void 0 ? void 0 : options.generateReturnInDocTemplate) &&
|
|
144053
|
-
(ts.isArrowFunction(node) && ts.isExpression(node.body)
|
|
144040
|
+
(ts.isFunctionTypeNode(node) || ts.isArrowFunction(node) && ts.isExpression(node.body)
|
|
144054
144041
|
|| ts.isFunctionLikeDeclaration(node) && node.body && ts.isBlock(node.body) && !!ts.forEachReturnStatement(node.body, function (n) { return n; }));
|
|
144055
144042
|
}
|
|
144056
144043
|
function getRightHandSideOfAssignment(rightHandSide) {
|