typescript 4.3.1-rc → 4.3.2
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 +47 -43
- package/lib/tsserver.js +84 -51
- package/lib/tsserverlibrary.js +84 -51
- package/lib/typescript.js +84 -51
- package/lib/typescriptServices.js +84 -51
- package/lib/typingsInstaller.js +51 -44
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -65,7 +65,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
65
65
|
var ts;
|
|
66
66
|
(function (ts) {
|
|
67
67
|
ts.versionMajorMinor = "4.3";
|
|
68
|
-
ts.version = "4.3.
|
|
68
|
+
ts.version = "4.3.2";
|
|
69
69
|
var NativeCollections;
|
|
70
70
|
(function (NativeCollections) {
|
|
71
71
|
function tryGetNativeMap() {
|
|
@@ -4987,7 +4987,7 @@ var ts;
|
|
|
4987
4987
|
Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."),
|
|
4988
4988
|
_0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."),
|
|
4989
4989
|
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."),
|
|
4990
|
-
|
|
4990
|
+
The_parser_expected_to_find_a_to_match_the_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."),
|
|
4991
4991
|
Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."),
|
|
4992
4992
|
Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."),
|
|
4993
4993
|
An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."),
|
|
@@ -24209,20 +24209,17 @@ var ts;
|
|
|
24209
24209
|
return inContext(32768);
|
|
24210
24210
|
}
|
|
24211
24211
|
function parseErrorAtCurrentToken(message, arg0) {
|
|
24212
|
-
|
|
24212
|
+
parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
|
|
24213
24213
|
}
|
|
24214
24214
|
function parseErrorAtPosition(start, length, message, arg0) {
|
|
24215
24215
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
24216
|
-
var result;
|
|
24217
24216
|
if (!lastError || start !== lastError.start) {
|
|
24218
|
-
|
|
24219
|
-
parseDiagnostics.push(result);
|
|
24217
|
+
parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0));
|
|
24220
24218
|
}
|
|
24221
24219
|
parseErrorBeforeNextFinishedNode = true;
|
|
24222
|
-
return result;
|
|
24223
24220
|
}
|
|
24224
24221
|
function parseErrorAt(start, end, message, arg0) {
|
|
24225
|
-
|
|
24222
|
+
parseErrorAtPosition(start, end - start, message, arg0);
|
|
24226
24223
|
}
|
|
24227
24224
|
function parseErrorAtRange(range, message, arg0) {
|
|
24228
24225
|
parseErrorAt(range.pos, range.end, message, arg0);
|
|
@@ -24345,16 +24342,6 @@ var ts;
|
|
|
24345
24342
|
parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
|
|
24346
24343
|
return false;
|
|
24347
24344
|
}
|
|
24348
|
-
function parseExpectedMatchingBrackets(openKind, closeKind, openPosition) {
|
|
24349
|
-
if (token() === closeKind) {
|
|
24350
|
-
nextToken();
|
|
24351
|
-
return;
|
|
24352
|
-
}
|
|
24353
|
-
var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind));
|
|
24354
|
-
if (lastError) {
|
|
24355
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openPosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, ts.tokenToString(openKind), ts.tokenToString(closeKind)));
|
|
24356
|
-
}
|
|
24357
|
-
}
|
|
24358
24345
|
function parseOptional(t) {
|
|
24359
24346
|
if (token() === t) {
|
|
24360
24347
|
nextToken();
|
|
@@ -26976,11 +26963,10 @@ var ts;
|
|
|
26976
26963
|
}
|
|
26977
26964
|
function parseArrayLiteralExpression() {
|
|
26978
26965
|
var pos = getNodePos();
|
|
26979
|
-
var openBracketPosition = scanner.getTokenPos();
|
|
26980
26966
|
parseExpected(22);
|
|
26981
26967
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
26982
26968
|
var elements = parseDelimitedList(15, parseArgumentOrArrayLiteralElement);
|
|
26983
|
-
|
|
26969
|
+
parseExpected(23);
|
|
26984
26970
|
return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
|
|
26985
26971
|
}
|
|
26986
26972
|
function parseObjectLiteralElement() {
|
|
@@ -27031,7 +27017,12 @@ var ts;
|
|
|
27031
27017
|
parseExpected(18);
|
|
27032
27018
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
27033
27019
|
var properties = parseDelimitedList(12, parseObjectLiteralElement, true);
|
|
27034
|
-
|
|
27020
|
+
if (!parseExpected(19)) {
|
|
27021
|
+
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
27022
|
+
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
27023
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
27024
|
+
}
|
|
27025
|
+
}
|
|
27035
27026
|
return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
|
|
27036
27027
|
}
|
|
27037
27028
|
function parseFunctionExpression() {
|
|
@@ -27099,7 +27090,12 @@ var ts;
|
|
|
27099
27090
|
if (parseExpected(18, diagnosticMessage) || ignoreMissingOpenBrace) {
|
|
27100
27091
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
27101
27092
|
var statements = parseList(1, parseStatement);
|
|
27102
|
-
|
|
27093
|
+
if (!parseExpected(19)) {
|
|
27094
|
+
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
27095
|
+
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
27096
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
27097
|
+
}
|
|
27098
|
+
}
|
|
27103
27099
|
var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
|
|
27104
27100
|
if (token() === 62) {
|
|
27105
27101
|
parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
|
|
@@ -27142,10 +27138,9 @@ var ts;
|
|
|
27142
27138
|
var pos = getNodePos();
|
|
27143
27139
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
27144
27140
|
parseExpected(98);
|
|
27145
|
-
var openParenPosition = scanner.getTokenPos();
|
|
27146
27141
|
parseExpected(20);
|
|
27147
27142
|
var expression = allowInAnd(parseExpression);
|
|
27148
|
-
|
|
27143
|
+
parseExpected(21);
|
|
27149
27144
|
var thenStatement = parseStatement();
|
|
27150
27145
|
var elseStatement = parseOptional(90) ? parseStatement() : undefined;
|
|
27151
27146
|
return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
|
|
@@ -27156,10 +27151,9 @@ var ts;
|
|
|
27156
27151
|
parseExpected(89);
|
|
27157
27152
|
var statement = parseStatement();
|
|
27158
27153
|
parseExpected(114);
|
|
27159
|
-
var openParenPosition = scanner.getTokenPos();
|
|
27160
27154
|
parseExpected(20);
|
|
27161
27155
|
var expression = allowInAnd(parseExpression);
|
|
27162
|
-
|
|
27156
|
+
parseExpected(21);
|
|
27163
27157
|
parseOptional(26);
|
|
27164
27158
|
return withJSDoc(finishNode(factory.createDoStatement(statement, expression), pos), hasJSDoc);
|
|
27165
27159
|
}
|
|
@@ -27167,10 +27161,9 @@ var ts;
|
|
|
27167
27161
|
var pos = getNodePos();
|
|
27168
27162
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
27169
27163
|
parseExpected(114);
|
|
27170
|
-
var openParenPosition = scanner.getTokenPos();
|
|
27171
27164
|
parseExpected(20);
|
|
27172
27165
|
var expression = allowInAnd(parseExpression);
|
|
27173
|
-
|
|
27166
|
+
parseExpected(21);
|
|
27174
27167
|
var statement = parseStatement();
|
|
27175
27168
|
return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
|
|
27176
27169
|
}
|
|
@@ -27237,10 +27230,9 @@ var ts;
|
|
|
27237
27230
|
var pos = getNodePos();
|
|
27238
27231
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
27239
27232
|
parseExpected(115);
|
|
27240
|
-
var openParenPosition = scanner.getTokenPos();
|
|
27241
27233
|
parseExpected(20);
|
|
27242
27234
|
var expression = allowInAnd(parseExpression);
|
|
27243
|
-
|
|
27235
|
+
parseExpected(21);
|
|
27244
27236
|
var statement = doInsideOfContext(16777216, parseStatement);
|
|
27245
27237
|
return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
|
|
27246
27238
|
}
|
|
@@ -28988,7 +28980,8 @@ var ts;
|
|
|
28988
28980
|
hasChildren = true;
|
|
28989
28981
|
if (child.kind === 333) {
|
|
28990
28982
|
if (childTypeTag) {
|
|
28991
|
-
|
|
28983
|
+
parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
28984
|
+
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
28992
28985
|
if (lastError) {
|
|
28993
28986
|
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
|
|
28994
28987
|
}
|
|
@@ -46288,6 +46281,10 @@ var ts;
|
|
|
46288
46281
|
var indexSymbol = symbol && getIndexSymbol(symbol);
|
|
46289
46282
|
return indexSymbol && getIndexDeclarationOfIndexSymbol(indexSymbol, kind);
|
|
46290
46283
|
}
|
|
46284
|
+
function getIndexDeclarationOfSymbolTable(symbolTable, kind) {
|
|
46285
|
+
var indexSymbol = symbolTable && getIndexSymbolFromSymbolTable(symbolTable);
|
|
46286
|
+
return indexSymbol && getIndexDeclarationOfIndexSymbol(indexSymbol, kind);
|
|
46287
|
+
}
|
|
46291
46288
|
function getIndexDeclarationOfIndexSymbol(indexSymbol, kind) {
|
|
46292
46289
|
var syntaxKind = kind === 1 ? 144 : 147;
|
|
46293
46290
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
@@ -52621,13 +52618,13 @@ var ts;
|
|
|
52621
52618
|
return type.flags & 32768 ? type : getUnionType([type, undefinedType]);
|
|
52622
52619
|
}
|
|
52623
52620
|
function getGlobalNonNullableTypeInstantiation(type) {
|
|
52621
|
+
var reducedType = getTypeWithFacts(type, 2097152);
|
|
52624
52622
|
if (!deferredGlobalNonNullableTypeAlias) {
|
|
52625
52623
|
deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288, undefined) || unknownSymbol;
|
|
52626
52624
|
}
|
|
52627
|
-
|
|
52628
|
-
|
|
52629
|
-
|
|
52630
|
-
return getTypeWithFacts(type, 2097152);
|
|
52625
|
+
return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
|
|
52626
|
+
getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
|
|
52627
|
+
reducedType;
|
|
52631
52628
|
}
|
|
52632
52629
|
function getNonNullableType(type) {
|
|
52633
52630
|
return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
|
|
@@ -55764,7 +55761,7 @@ var ts;
|
|
|
55764
55761
|
!isGenericIndexType(getTypeOfExpression(parent.argumentExpression));
|
|
55765
55762
|
}
|
|
55766
55763
|
function isGenericTypeWithUnionConstraint(type) {
|
|
55767
|
-
return !!(type.flags & 465829888 && getBaseConstraintOrType(type).flags & 1048576);
|
|
55764
|
+
return !!(type.flags & 465829888 && getBaseConstraintOrType(type).flags & (98304 | 1048576));
|
|
55768
55765
|
}
|
|
55769
55766
|
function containsGenericType(type) {
|
|
55770
55767
|
return !!(type.flags & 465829888 || type.flags & 3145728 && ts.some(type.types, containsGenericType));
|
|
@@ -65466,21 +65463,24 @@ var ts;
|
|
|
65466
65463
|
checkBlock(node.finallyBlock);
|
|
65467
65464
|
}
|
|
65468
65465
|
}
|
|
65469
|
-
function checkIndexConstraints(type) {
|
|
65470
|
-
var
|
|
65471
|
-
var
|
|
65466
|
+
function checkIndexConstraints(type, isStatic) {
|
|
65467
|
+
var _a, _b, _c, _d;
|
|
65468
|
+
var declaredNumberIndexer = getIndexDeclarationOfSymbolTable(isStatic ? (_a = type.symbol) === null || _a === void 0 ? void 0 : _a.exports : (_b = type.symbol) === null || _b === void 0 ? void 0 : _b.members, 1);
|
|
65469
|
+
var declaredStringIndexer = getIndexDeclarationOfSymbolTable(isStatic ? (_c = type.symbol) === null || _c === void 0 ? void 0 : _c.exports : (_d = type.symbol) === null || _d === void 0 ? void 0 : _d.members, 0);
|
|
65472
65470
|
var stringIndexType = getIndexTypeOfType(type, 0);
|
|
65473
65471
|
var numberIndexType = getIndexTypeOfType(type, 1);
|
|
65474
65472
|
if (stringIndexType || numberIndexType) {
|
|
65475
65473
|
ts.forEach(getPropertiesOfObjectType(type), function (prop) {
|
|
65474
|
+
if (isStatic && prop.flags & 4194304)
|
|
65475
|
+
return;
|
|
65476
65476
|
var propType = getTypeOfSymbol(prop);
|
|
65477
65477
|
checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0);
|
|
65478
65478
|
checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1);
|
|
65479
65479
|
});
|
|
65480
65480
|
var classDeclaration = type.symbol.valueDeclaration;
|
|
65481
65481
|
if (ts.getObjectFlags(type) & 1 && classDeclaration && ts.isClassLike(classDeclaration)) {
|
|
65482
|
-
for (var _i = 0,
|
|
65483
|
-
var member =
|
|
65482
|
+
for (var _i = 0, _e = classDeclaration.members; _i < _e.length; _i++) {
|
|
65483
|
+
var member = _e[_i];
|
|
65484
65484
|
if (!ts.hasSyntacticModifier(member, 32) && !hasBindableName(member)) {
|
|
65485
65485
|
var symbol = getSymbolOfNode(member);
|
|
65486
65486
|
var propType = getTypeOfSymbol(symbol);
|
|
@@ -65774,7 +65774,7 @@ var ts;
|
|
|
65774
65774
|
}
|
|
65775
65775
|
if (produceDiagnostics) {
|
|
65776
65776
|
checkIndexConstraints(type);
|
|
65777
|
-
checkIndexConstraints(staticType);
|
|
65777
|
+
checkIndexConstraints(staticType, true);
|
|
65778
65778
|
checkTypeForDuplicateIndexSignatures(node);
|
|
65779
65779
|
checkPropertyInitialization(node);
|
|
65780
65780
|
}
|
|
@@ -73991,16 +73991,20 @@ var ts;
|
|
|
73991
73991
|
return ts.visitEachChild(node, visitor, context);
|
|
73992
73992
|
}
|
|
73993
73993
|
var staticProperties = ts.getProperties(node, false, true);
|
|
73994
|
+
var pendingPrivateStateAssignment;
|
|
73994
73995
|
if (shouldTransformPrivateElements && ts.some(node.members, function (m) { return ts.hasStaticModifier(m) && !!m.name && ts.isPrivateIdentifier(m.name); })) {
|
|
73995
73996
|
var temp = factory.createTempVariable(hoistVariableDeclaration, true);
|
|
73996
73997
|
getPrivateIdentifierEnvironment().classConstructor = factory.cloneNode(temp);
|
|
73997
|
-
|
|
73998
|
+
pendingPrivateStateAssignment = factory.createAssignment(temp, factory.getInternalName(node));
|
|
73998
73999
|
}
|
|
73999
74000
|
var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
|
|
74000
74001
|
var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 103);
|
|
74001
74002
|
var statements = [
|
|
74002
74003
|
factory.updateClassDeclaration(node, undefined, node.modifiers, node.name, undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass))
|
|
74003
74004
|
];
|
|
74005
|
+
if (pendingPrivateStateAssignment) {
|
|
74006
|
+
getPendingExpressions().unshift(pendingPrivateStateAssignment);
|
|
74007
|
+
}
|
|
74004
74008
|
if (ts.some(pendingExpressions)) {
|
|
74005
74009
|
statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)));
|
|
74006
74010
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -96,7 +96,7 @@ var ts;
|
|
|
96
96
|
// The following is baselined as a literal template type without intervention
|
|
97
97
|
/** The version of the TypeScript compiler release */
|
|
98
98
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
99
|
-
ts.version = "4.3.
|
|
99
|
+
ts.version = "4.3.2";
|
|
100
100
|
/* @internal */
|
|
101
101
|
var Comparison;
|
|
102
102
|
(function (Comparison) {
|
|
@@ -7689,7 +7689,7 @@ var ts;
|
|
|
7689
7689
|
Identifier_expected: diag(1003, ts.DiagnosticCategory.Error, "Identifier_expected_1003", "Identifier expected."),
|
|
7690
7690
|
_0_expected: diag(1005, ts.DiagnosticCategory.Error, "_0_expected_1005", "'{0}' expected."),
|
|
7691
7691
|
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."),
|
|
7692
|
-
|
|
7692
|
+
The_parser_expected_to_find_a_to_match_the_token_here: diag(1007, ts.DiagnosticCategory.Error, "The_parser_expected_to_find_a_to_match_the_token_here_1007", "The parser expected to find a '}' to match the '{' token here."),
|
|
7693
7693
|
Trailing_comma_not_allowed: diag(1009, ts.DiagnosticCategory.Error, "Trailing_comma_not_allowed_1009", "Trailing comma not allowed."),
|
|
7694
7694
|
Asterisk_Slash_expected: diag(1010, ts.DiagnosticCategory.Error, "Asterisk_Slash_expected_1010", "'*/' expected."),
|
|
7695
7695
|
An_element_access_expression_should_take_an_argument: diag(1011, ts.DiagnosticCategory.Error, "An_element_access_expression_should_take_an_argument_1011", "An element access expression should take an argument."),
|
|
@@ -30030,23 +30030,20 @@ var ts;
|
|
|
30030
30030
|
return inContext(32768 /* AwaitContext */);
|
|
30031
30031
|
}
|
|
30032
30032
|
function parseErrorAtCurrentToken(message, arg0) {
|
|
30033
|
-
|
|
30033
|
+
parseErrorAt(scanner.getTokenPos(), scanner.getTextPos(), message, arg0);
|
|
30034
30034
|
}
|
|
30035
30035
|
function parseErrorAtPosition(start, length, message, arg0) {
|
|
30036
30036
|
// Don't report another error if it would just be at the same position as the last error.
|
|
30037
30037
|
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
30038
|
-
var result;
|
|
30039
30038
|
if (!lastError || start !== lastError.start) {
|
|
30040
|
-
|
|
30041
|
-
parseDiagnostics.push(result);
|
|
30039
|
+
parseDiagnostics.push(ts.createDetachedDiagnostic(fileName, start, length, message, arg0));
|
|
30042
30040
|
}
|
|
30043
30041
|
// Mark that we've encountered an error. We'll set an appropriate bit on the next
|
|
30044
30042
|
// node we finish so that it can't be reused incrementally.
|
|
30045
30043
|
parseErrorBeforeNextFinishedNode = true;
|
|
30046
|
-
return result;
|
|
30047
30044
|
}
|
|
30048
30045
|
function parseErrorAt(start, end, message, arg0) {
|
|
30049
|
-
|
|
30046
|
+
parseErrorAtPosition(start, end - start, message, arg0);
|
|
30050
30047
|
}
|
|
30051
30048
|
function parseErrorAtRange(range, message, arg0) {
|
|
30052
30049
|
parseErrorAt(range.pos, range.end, message, arg0);
|
|
@@ -30203,16 +30200,6 @@ var ts;
|
|
|
30203
30200
|
parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
|
|
30204
30201
|
return false;
|
|
30205
30202
|
}
|
|
30206
|
-
function parseExpectedMatchingBrackets(openKind, closeKind, openPosition) {
|
|
30207
|
-
if (token() === closeKind) {
|
|
30208
|
-
nextToken();
|
|
30209
|
-
return;
|
|
30210
|
-
}
|
|
30211
|
-
var lastError = parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(closeKind));
|
|
30212
|
-
if (lastError) {
|
|
30213
|
-
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openPosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_1_to_match_the_0_token_here, ts.tokenToString(openKind), ts.tokenToString(closeKind)));
|
|
30214
|
-
}
|
|
30215
|
-
}
|
|
30216
30203
|
function parseOptional(t) {
|
|
30217
30204
|
if (token() === t) {
|
|
30218
30205
|
nextToken();
|
|
@@ -33580,11 +33567,10 @@ var ts;
|
|
|
33580
33567
|
}
|
|
33581
33568
|
function parseArrayLiteralExpression() {
|
|
33582
33569
|
var pos = getNodePos();
|
|
33583
|
-
var openBracketPosition = scanner.getTokenPos();
|
|
33584
33570
|
parseExpected(22 /* OpenBracketToken */);
|
|
33585
33571
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
33586
33572
|
var elements = parseDelimitedList(15 /* ArrayLiteralMembers */, parseArgumentOrArrayLiteralElement);
|
|
33587
|
-
|
|
33573
|
+
parseExpected(23 /* CloseBracketToken */);
|
|
33588
33574
|
return finishNode(factory.createArrayLiteralExpression(elements, multiLine), pos);
|
|
33589
33575
|
}
|
|
33590
33576
|
function parseObjectLiteralElement() {
|
|
@@ -33644,7 +33630,12 @@ var ts;
|
|
|
33644
33630
|
parseExpected(18 /* OpenBraceToken */);
|
|
33645
33631
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
33646
33632
|
var properties = parseDelimitedList(12 /* ObjectLiteralMembers */, parseObjectLiteralElement, /*considerSemicolonAsDelimiter*/ true);
|
|
33647
|
-
|
|
33633
|
+
if (!parseExpected(19 /* CloseBraceToken */)) {
|
|
33634
|
+
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
33635
|
+
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
33636
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
33637
|
+
}
|
|
33638
|
+
}
|
|
33648
33639
|
return finishNode(factory.createObjectLiteralExpression(properties, multiLine), pos);
|
|
33649
33640
|
}
|
|
33650
33641
|
function parseFunctionExpression() {
|
|
@@ -33718,7 +33709,12 @@ var ts;
|
|
|
33718
33709
|
if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {
|
|
33719
33710
|
var multiLine = scanner.hasPrecedingLineBreak();
|
|
33720
33711
|
var statements = parseList(1 /* BlockStatements */, parseStatement);
|
|
33721
|
-
|
|
33712
|
+
if (!parseExpected(19 /* CloseBraceToken */)) {
|
|
33713
|
+
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
33714
|
+
if (lastError && lastError.code === ts.Diagnostics._0_expected.code) {
|
|
33715
|
+
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, openBracePosition, 1, ts.Diagnostics.The_parser_expected_to_find_a_to_match_the_token_here));
|
|
33716
|
+
}
|
|
33717
|
+
}
|
|
33722
33718
|
var result = withJSDoc(finishNode(factory.createBlock(statements, multiLine), pos), hasJSDoc);
|
|
33723
33719
|
if (token() === 62 /* EqualsToken */) {
|
|
33724
33720
|
parseErrorAtCurrentToken(ts.Diagnostics.Declaration_or_statement_expected_This_follows_a_block_of_statements_so_if_you_intended_to_write_a_destructuring_assignment_you_might_need_to_wrap_the_the_whole_assignment_in_parentheses);
|
|
@@ -33763,10 +33759,9 @@ var ts;
|
|
|
33763
33759
|
var pos = getNodePos();
|
|
33764
33760
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
33765
33761
|
parseExpected(98 /* IfKeyword */);
|
|
33766
|
-
var openParenPosition = scanner.getTokenPos();
|
|
33767
33762
|
parseExpected(20 /* OpenParenToken */);
|
|
33768
33763
|
var expression = allowInAnd(parseExpression);
|
|
33769
|
-
|
|
33764
|
+
parseExpected(21 /* CloseParenToken */);
|
|
33770
33765
|
var thenStatement = parseStatement();
|
|
33771
33766
|
var elseStatement = parseOptional(90 /* ElseKeyword */) ? parseStatement() : undefined;
|
|
33772
33767
|
return withJSDoc(finishNode(factory.createIfStatement(expression, thenStatement, elseStatement), pos), hasJSDoc);
|
|
@@ -33777,10 +33772,9 @@ var ts;
|
|
|
33777
33772
|
parseExpected(89 /* DoKeyword */);
|
|
33778
33773
|
var statement = parseStatement();
|
|
33779
33774
|
parseExpected(114 /* WhileKeyword */);
|
|
33780
|
-
var openParenPosition = scanner.getTokenPos();
|
|
33781
33775
|
parseExpected(20 /* OpenParenToken */);
|
|
33782
33776
|
var expression = allowInAnd(parseExpression);
|
|
33783
|
-
|
|
33777
|
+
parseExpected(21 /* CloseParenToken */);
|
|
33784
33778
|
// From: https://mail.mozilla.org/pipermail/es-discuss/2011-August/016188.html
|
|
33785
33779
|
// 157 min --- All allen at wirfs-brock.com CONF --- "do{;}while(false)false" prohibited in
|
|
33786
33780
|
// spec but allowed in consensus reality. Approved -- this is the de-facto standard whereby
|
|
@@ -33792,10 +33786,9 @@ var ts;
|
|
|
33792
33786
|
var pos = getNodePos();
|
|
33793
33787
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
33794
33788
|
parseExpected(114 /* WhileKeyword */);
|
|
33795
|
-
var openParenPosition = scanner.getTokenPos();
|
|
33796
33789
|
parseExpected(20 /* OpenParenToken */);
|
|
33797
33790
|
var expression = allowInAnd(parseExpression);
|
|
33798
|
-
|
|
33791
|
+
parseExpected(21 /* CloseParenToken */);
|
|
33799
33792
|
var statement = parseStatement();
|
|
33800
33793
|
return withJSDoc(finishNode(factory.createWhileStatement(expression, statement), pos), hasJSDoc);
|
|
33801
33794
|
}
|
|
@@ -33862,10 +33855,9 @@ var ts;
|
|
|
33862
33855
|
var pos = getNodePos();
|
|
33863
33856
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
33864
33857
|
parseExpected(115 /* WithKeyword */);
|
|
33865
|
-
var openParenPosition = scanner.getTokenPos();
|
|
33866
33858
|
parseExpected(20 /* OpenParenToken */);
|
|
33867
33859
|
var expression = allowInAnd(parseExpression);
|
|
33868
|
-
|
|
33860
|
+
parseExpected(21 /* CloseParenToken */);
|
|
33869
33861
|
var statement = doInsideOfContext(16777216 /* InWithStatement */, parseStatement);
|
|
33870
33862
|
return withJSDoc(finishNode(factory.createWithStatement(expression, statement), pos), hasJSDoc);
|
|
33871
33863
|
}
|
|
@@ -35856,7 +35848,8 @@ var ts;
|
|
|
35856
35848
|
hasChildren = true;
|
|
35857
35849
|
if (child.kind === 333 /* JSDocTypeTag */) {
|
|
35858
35850
|
if (childTypeTag) {
|
|
35859
|
-
|
|
35851
|
+
parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags);
|
|
35852
|
+
var lastError = ts.lastOrUndefined(parseDiagnostics);
|
|
35860
35853
|
if (lastError) {
|
|
35861
35854
|
ts.addRelatedInfo(lastError, ts.createDetachedDiagnostic(fileName, 0, 0, ts.Diagnostics.The_tag_was_first_specified_here));
|
|
35862
35855
|
}
|
|
@@ -56017,6 +56010,10 @@ var ts;
|
|
|
56017
56010
|
var indexSymbol = symbol && getIndexSymbol(symbol);
|
|
56018
56011
|
return indexSymbol && getIndexDeclarationOfIndexSymbol(indexSymbol, kind);
|
|
56019
56012
|
}
|
|
56013
|
+
function getIndexDeclarationOfSymbolTable(symbolTable, kind) {
|
|
56014
|
+
var indexSymbol = symbolTable && getIndexSymbolFromSymbolTable(symbolTable);
|
|
56015
|
+
return indexSymbol && getIndexDeclarationOfIndexSymbol(indexSymbol, kind);
|
|
56016
|
+
}
|
|
56020
56017
|
function getIndexDeclarationOfIndexSymbol(indexSymbol, kind) {
|
|
56021
56018
|
var syntaxKind = kind === 1 /* Number */ ? 144 /* NumberKeyword */ : 147 /* StringKeyword */;
|
|
56022
56019
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
@@ -63225,14 +63222,17 @@ var ts;
|
|
|
63225
63222
|
return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, undefinedType]);
|
|
63226
63223
|
}
|
|
63227
63224
|
function getGlobalNonNullableTypeInstantiation(type) {
|
|
63225
|
+
// First reduce away any constituents that are assignable to 'undefined' or 'null'. This not only eliminates
|
|
63226
|
+
// 'undefined' and 'null', but also higher-order types such as a type parameter 'U extends undefined | null'
|
|
63227
|
+
// that isn't eliminated by a NonNullable<T> instantiation.
|
|
63228
|
+
var reducedType = getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */);
|
|
63228
63229
|
if (!deferredGlobalNonNullableTypeAlias) {
|
|
63229
63230
|
deferredGlobalNonNullableTypeAlias = getGlobalSymbol("NonNullable", 524288 /* TypeAlias */, /*diagnostic*/ undefined) || unknownSymbol;
|
|
63230
63231
|
}
|
|
63231
|
-
//
|
|
63232
|
-
|
|
63233
|
-
|
|
63234
|
-
|
|
63235
|
-
return getTypeWithFacts(type, 2097152 /* NEUndefinedOrNull */); // Type alias unavailable, fall back to non-higher-order behavior
|
|
63232
|
+
// If the NonNullable<T> type is available, return an instantiation. Otherwise just return the reduced type.
|
|
63233
|
+
return deferredGlobalNonNullableTypeAlias !== unknownSymbol ?
|
|
63234
|
+
getTypeAliasInstantiation(deferredGlobalNonNullableTypeAlias, [reducedType]) :
|
|
63235
|
+
reducedType;
|
|
63236
63236
|
}
|
|
63237
63237
|
function getNonNullableType(type) {
|
|
63238
63238
|
return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
|
|
@@ -66820,7 +66820,7 @@ var ts;
|
|
|
66820
66820
|
!isGenericIndexType(getTypeOfExpression(parent.argumentExpression));
|
|
66821
66821
|
}
|
|
66822
66822
|
function isGenericTypeWithUnionConstraint(type) {
|
|
66823
|
-
return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & 1048576 /* Union */);
|
|
66823
|
+
return !!(type.flags & 465829888 /* Instantiable */ && getBaseConstraintOrType(type).flags & (98304 /* Nullable */ | 1048576 /* Union */));
|
|
66824
66824
|
}
|
|
66825
66825
|
function containsGenericType(type) {
|
|
66826
66826
|
return !!(type.flags & 465829888 /* Instantiable */ || type.flags & 3145728 /* UnionOrIntersection */ && ts.some(type.types, containsGenericType));
|
|
@@ -78294,21 +78294,24 @@ var ts;
|
|
|
78294
78294
|
checkBlock(node.finallyBlock);
|
|
78295
78295
|
}
|
|
78296
78296
|
}
|
|
78297
|
-
function checkIndexConstraints(type) {
|
|
78298
|
-
var
|
|
78299
|
-
var
|
|
78297
|
+
function checkIndexConstraints(type, isStatic) {
|
|
78298
|
+
var _a, _b, _c, _d;
|
|
78299
|
+
var declaredNumberIndexer = getIndexDeclarationOfSymbolTable(isStatic ? (_a = type.symbol) === null || _a === void 0 ? void 0 : _a.exports : (_b = type.symbol) === null || _b === void 0 ? void 0 : _b.members, 1 /* Number */);
|
|
78300
|
+
var declaredStringIndexer = getIndexDeclarationOfSymbolTable(isStatic ? (_c = type.symbol) === null || _c === void 0 ? void 0 : _c.exports : (_d = type.symbol) === null || _d === void 0 ? void 0 : _d.members, 0 /* String */);
|
|
78300
78301
|
var stringIndexType = getIndexTypeOfType(type, 0 /* String */);
|
|
78301
78302
|
var numberIndexType = getIndexTypeOfType(type, 1 /* Number */);
|
|
78302
78303
|
if (stringIndexType || numberIndexType) {
|
|
78303
78304
|
ts.forEach(getPropertiesOfObjectType(type), function (prop) {
|
|
78305
|
+
if (isStatic && prop.flags & 4194304 /* Prototype */)
|
|
78306
|
+
return;
|
|
78304
78307
|
var propType = getTypeOfSymbol(prop);
|
|
78305
78308
|
checkIndexConstraintForProperty(prop, propType, type, declaredStringIndexer, stringIndexType, 0 /* String */);
|
|
78306
78309
|
checkIndexConstraintForProperty(prop, propType, type, declaredNumberIndexer, numberIndexType, 1 /* Number */);
|
|
78307
78310
|
});
|
|
78308
78311
|
var classDeclaration = type.symbol.valueDeclaration;
|
|
78309
78312
|
if (ts.getObjectFlags(type) & 1 /* Class */ && classDeclaration && ts.isClassLike(classDeclaration)) {
|
|
78310
|
-
for (var _i = 0,
|
|
78311
|
-
var member =
|
|
78313
|
+
for (var _i = 0, _e = classDeclaration.members; _i < _e.length; _i++) {
|
|
78314
|
+
var member = _e[_i];
|
|
78312
78315
|
// Only process instance properties with computed names here.
|
|
78313
78316
|
// Static properties cannot be in conflict with indexers,
|
|
78314
78317
|
// and properties with literal names were already checked.
|
|
@@ -78638,7 +78641,7 @@ var ts;
|
|
|
78638
78641
|
}
|
|
78639
78642
|
if (produceDiagnostics) {
|
|
78640
78643
|
checkIndexConstraints(type);
|
|
78641
|
-
checkIndexConstraints(staticType);
|
|
78644
|
+
checkIndexConstraints(staticType, /*isStatic*/ true);
|
|
78642
78645
|
checkTypeForDuplicateIndexSignatures(node);
|
|
78643
78646
|
checkPropertyInitialization(node);
|
|
78644
78647
|
}
|
|
@@ -88697,10 +88700,11 @@ var ts;
|
|
|
88697
88700
|
return ts.visitEachChild(node, visitor, context);
|
|
88698
88701
|
}
|
|
88699
88702
|
var staticProperties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ true);
|
|
88703
|
+
var pendingPrivateStateAssignment;
|
|
88700
88704
|
if (shouldTransformPrivateElements && ts.some(node.members, function (m) { return ts.hasStaticModifier(m) && !!m.name && ts.isPrivateIdentifier(m.name); })) {
|
|
88701
88705
|
var temp = factory.createTempVariable(hoistVariableDeclaration, /* reservedInNestedScopes */ true);
|
|
88702
88706
|
getPrivateIdentifierEnvironment().classConstructor = factory.cloneNode(temp);
|
|
88703
|
-
|
|
88707
|
+
pendingPrivateStateAssignment = factory.createAssignment(temp, factory.getInternalName(node));
|
|
88704
88708
|
}
|
|
88705
88709
|
var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
|
|
88706
88710
|
var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 103 /* NullKeyword */);
|
|
@@ -88709,6 +88713,9 @@ var ts;
|
|
|
88709
88713
|
/*decorators*/ undefined, node.modifiers, node.name,
|
|
88710
88714
|
/*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass))
|
|
88711
88715
|
];
|
|
88716
|
+
if (pendingPrivateStateAssignment) {
|
|
88717
|
+
getPendingExpressions().unshift(pendingPrivateStateAssignment);
|
|
88718
|
+
}
|
|
88712
88719
|
// Write any pending expressions from elided or moved computed property names
|
|
88713
88720
|
if (ts.some(pendingExpressions)) {
|
|
88714
88721
|
statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)));
|
|
@@ -123168,6 +123175,8 @@ var ts;
|
|
|
123168
123175
|
return jsdocCompletionInfo(ts.JsDoc.getJSDocTagCompletions());
|
|
123169
123176
|
case 3 /* JsDocParameterName */:
|
|
123170
123177
|
return jsdocCompletionInfo(ts.JsDoc.getJSDocParameterNameCompletions(completionData.tag));
|
|
123178
|
+
case 4 /* Keywords */:
|
|
123179
|
+
return specificKeywordCompletionInfo(completionData.keywords);
|
|
123171
123180
|
default:
|
|
123172
123181
|
return ts.Debug.assertNever(completionData);
|
|
123173
123182
|
}
|
|
@@ -123176,6 +123185,19 @@ var ts;
|
|
|
123176
123185
|
function jsdocCompletionInfo(entries) {
|
|
123177
123186
|
return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries };
|
|
123178
123187
|
}
|
|
123188
|
+
function specificKeywordCompletionInfo(keywords) {
|
|
123189
|
+
return {
|
|
123190
|
+
isGlobalCompletion: false,
|
|
123191
|
+
isMemberCompletion: false,
|
|
123192
|
+
isNewIdentifierLocation: false,
|
|
123193
|
+
entries: keywords.map(function (k) { return ({
|
|
123194
|
+
name: ts.tokenToString(k),
|
|
123195
|
+
kind: "keyword" /* keyword */,
|
|
123196
|
+
kindModifiers: "" /* none */,
|
|
123197
|
+
sortText: SortText.GlobalsOrKeywords,
|
|
123198
|
+
}); }),
|
|
123199
|
+
};
|
|
123200
|
+
}
|
|
123179
123201
|
function getOptionalReplacementSpan(location) {
|
|
123180
123202
|
// StringLiteralLike locations are handled separately in stringCompletions.ts
|
|
123181
123203
|
return (location === null || location === void 0 ? void 0 : location.kind) === 78 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
|
|
@@ -123600,6 +123622,8 @@ var ts;
|
|
|
123600
123622
|
return ts.JsDoc.getJSDocTagCompletionDetails(name);
|
|
123601
123623
|
case 3 /* JsDocParameterName */:
|
|
123602
123624
|
return ts.JsDoc.getJSDocParameterNameCompletionDetails(name);
|
|
123625
|
+
case 4 /* Keywords */:
|
|
123626
|
+
return request.keywords.indexOf(ts.stringToToken(name)) > -1 ? createSimpleDetails(name, "keyword" /* keyword */, ts.SymbolDisplayPartKind.keyword) : undefined;
|
|
123603
123627
|
default:
|
|
123604
123628
|
return ts.Debug.assertNever(request);
|
|
123605
123629
|
}
|
|
@@ -123658,6 +123682,7 @@ var ts;
|
|
|
123658
123682
|
CompletionDataKind[CompletionDataKind["JsDocTagName"] = 1] = "JsDocTagName";
|
|
123659
123683
|
CompletionDataKind[CompletionDataKind["JsDocTag"] = 2] = "JsDocTag";
|
|
123660
123684
|
CompletionDataKind[CompletionDataKind["JsDocParameterName"] = 3] = "JsDocParameterName";
|
|
123685
|
+
CompletionDataKind[CompletionDataKind["Keywords"] = 4] = "Keywords";
|
|
123661
123686
|
})(CompletionDataKind || (CompletionDataKind = {}));
|
|
123662
123687
|
var CompletionKind;
|
|
123663
123688
|
(function (CompletionKind) {
|
|
@@ -123818,13 +123843,17 @@ var ts;
|
|
|
123818
123843
|
var importCompletionNode;
|
|
123819
123844
|
var location = ts.getTouchingPropertyName(sourceFile, position);
|
|
123820
123845
|
if (contextToken) {
|
|
123846
|
+
var importCompletionCandidate = getImportCompletionNode(contextToken);
|
|
123847
|
+
if (importCompletionCandidate === 153 /* FromKeyword */) {
|
|
123848
|
+
return { kind: 4 /* Keywords */, keywords: [153 /* FromKeyword */] };
|
|
123849
|
+
}
|
|
123821
123850
|
// Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier`
|
|
123822
123851
|
// added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature
|
|
123823
123852
|
// is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients
|
|
123824
123853
|
// to opt in with the `includeCompletionsForImportStatements` user preference.
|
|
123825
|
-
|
|
123826
|
-
|
|
123827
|
-
|
|
123854
|
+
if (importCompletionCandidate && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) {
|
|
123855
|
+
importCompletionNode = importCompletionCandidate;
|
|
123856
|
+
}
|
|
123828
123857
|
// Bail out if this is a known invalid completion location
|
|
123829
123858
|
if (!importCompletionNode && isCompletionListBlocker(contextToken)) {
|
|
123830
123859
|
log("Returning an empty list because completion was requested in an invalid position.");
|
|
@@ -125578,16 +125607,20 @@ var ts;
|
|
|
125578
125607
|
}
|
|
125579
125608
|
function getImportCompletionNode(contextToken) {
|
|
125580
125609
|
var candidate = getCandidate();
|
|
125581
|
-
return candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined;
|
|
125610
|
+
return candidate === 153 /* FromKeyword */ || candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) ? candidate : undefined;
|
|
125582
125611
|
function getCandidate() {
|
|
125583
125612
|
var parent = contextToken.parent;
|
|
125584
125613
|
if (ts.isImportEqualsDeclaration(parent)) {
|
|
125585
125614
|
return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined;
|
|
125586
125615
|
}
|
|
125587
125616
|
if (ts.isNamedImports(parent) || ts.isNamespaceImport(parent)) {
|
|
125588
|
-
|
|
125589
|
-
|
|
125590
|
-
|
|
125617
|
+
if (isModuleSpecifierMissingOrEmpty(parent.parent.parent.moduleSpecifier) && (ts.isNamespaceImport(parent) || parent.elements.length < 2) && !parent.parent.name) {
|
|
125618
|
+
// At `import { ... } |` or `import * as Foo |`, the only possible completion is `from`
|
|
125619
|
+
return contextToken.kind === 19 /* CloseBraceToken */ || contextToken.kind === 78 /* Identifier */
|
|
125620
|
+
? 153 /* FromKeyword */
|
|
125621
|
+
: parent.parent.parent;
|
|
125622
|
+
}
|
|
125623
|
+
return undefined;
|
|
125591
125624
|
}
|
|
125592
125625
|
if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) {
|
|
125593
125626
|
// A lone import keyword with nothing following it does not parse as a statement at all
|