typescript 4.7.0-dev.20220404 → 4.7.0-dev.20220405
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 -30
- package/lib/tsserver.js +71 -41
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +71 -41
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +71 -41
- package/lib/typescriptServices.d.ts +1 -1
- package/lib/typescriptServices.js +71 -41
- package/lib/typingsInstaller.js +50 -31
- package/package.json +1 -1
package/lib/tsc.js
CHANGED
|
@@ -69,7 +69,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
69
69
|
var ts;
|
|
70
70
|
(function (ts) {
|
|
71
71
|
ts.versionMajorMinor = "4.7";
|
|
72
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
72
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220405";
|
|
73
73
|
var NativeCollections;
|
|
74
74
|
(function (NativeCollections) {
|
|
75
75
|
var globals = typeof globalThis !== "undefined" ? globalThis :
|
|
@@ -13114,7 +13114,11 @@ var ts;
|
|
|
13114
13114
|
ts.getEffectiveContainerForJSDocTemplateTag = getEffectiveContainerForJSDocTemplateTag;
|
|
13115
13115
|
function getHostSignatureFromJSDoc(node) {
|
|
13116
13116
|
var host = getEffectiveJSDocHost(node);
|
|
13117
|
-
|
|
13117
|
+
if (host) {
|
|
13118
|
+
return ts.isPropertySignature(host) && host.type && ts.isFunctionLike(host.type) ? host.type :
|
|
13119
|
+
ts.isFunctionLike(host) ? host : undefined;
|
|
13120
|
+
}
|
|
13121
|
+
return undefined;
|
|
13118
13122
|
}
|
|
13119
13123
|
ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc;
|
|
13120
13124
|
function getEffectiveJSDocHost(node) {
|
|
@@ -26284,7 +26288,11 @@ var ts;
|
|
|
26284
26288
|
while (true) {
|
|
26285
26289
|
if (isListElement(kind, false)) {
|
|
26286
26290
|
var startPos = scanner.getStartPos();
|
|
26287
|
-
|
|
26291
|
+
var result = parseListElement(kind, parseElement);
|
|
26292
|
+
if (!result) {
|
|
26293
|
+
return undefined;
|
|
26294
|
+
}
|
|
26295
|
+
list.push(result);
|
|
26288
26296
|
commaStart = scanner.getTokenPos();
|
|
26289
26297
|
if (parseOptional(27)) {
|
|
26290
26298
|
continue;
|
|
@@ -26600,13 +26608,17 @@ var ts;
|
|
|
26600
26608
|
}
|
|
26601
26609
|
return name;
|
|
26602
26610
|
}
|
|
26603
|
-
function
|
|
26604
|
-
return
|
|
26611
|
+
function isParameterNameStart() {
|
|
26612
|
+
return isBindingIdentifier() || token() === 22 || token() === 18;
|
|
26605
26613
|
}
|
|
26606
|
-
function parseParameter() {
|
|
26607
|
-
return parseParameterWorker(
|
|
26614
|
+
function parseParameter(inOuterAwaitContext) {
|
|
26615
|
+
return parseParameterWorker(inOuterAwaitContext);
|
|
26608
26616
|
}
|
|
26609
|
-
function
|
|
26617
|
+
function parseParameterForSpeculation(inOuterAwaitContext) {
|
|
26618
|
+
return parseParameterWorker(inOuterAwaitContext, false);
|
|
26619
|
+
}
|
|
26620
|
+
function parseParameterWorker(inOuterAwaitContext, allowAmbiguity) {
|
|
26621
|
+
if (allowAmbiguity === void 0) { allowAmbiguity = true; }
|
|
26610
26622
|
var pos = getNodePos();
|
|
26611
26623
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
26612
26624
|
var decorators = inOuterAwaitContext ? doInAwaitContext(parseDecorators) : parseDecorators();
|
|
@@ -26620,7 +26632,11 @@ var ts;
|
|
|
26620
26632
|
var savedTopLevel = topLevel;
|
|
26621
26633
|
topLevel = false;
|
|
26622
26634
|
var modifiers = parseModifiers();
|
|
26623
|
-
var
|
|
26635
|
+
var dotDotDotToken = parseOptionalToken(25);
|
|
26636
|
+
if (!allowAmbiguity && !isParameterNameStart()) {
|
|
26637
|
+
return undefined;
|
|
26638
|
+
}
|
|
26639
|
+
var node = withJSDoc(finishNode(factory.createParameterDeclaration(decorators, modifiers, dotDotDotToken, parseNameOfParameter(modifiers), parseOptionalToken(57), parseTypeAnnotation(), parseInitializer()), pos), hasJSDoc);
|
|
26624
26640
|
topLevel = savedTopLevel;
|
|
26625
26641
|
return node;
|
|
26626
26642
|
}
|
|
@@ -26644,14 +26660,14 @@ var ts;
|
|
|
26644
26660
|
}
|
|
26645
26661
|
return false;
|
|
26646
26662
|
}
|
|
26647
|
-
function parseParametersWorker(flags) {
|
|
26663
|
+
function parseParametersWorker(flags, allowAmbiguity) {
|
|
26648
26664
|
var savedYieldContext = inYieldContext();
|
|
26649
26665
|
var savedAwaitContext = inAwaitContext();
|
|
26650
26666
|
setYieldContext(!!(flags & 1));
|
|
26651
26667
|
setAwaitContext(!!(flags & 2));
|
|
26652
26668
|
var parameters = flags & 32 ?
|
|
26653
26669
|
parseDelimitedList(17, parseJSDocParameter) :
|
|
26654
|
-
parseDelimitedList(16,
|
|
26670
|
+
parseDelimitedList(16, function () { return allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext); });
|
|
26655
26671
|
setYieldContext(savedYieldContext);
|
|
26656
26672
|
setAwaitContext(savedAwaitContext);
|
|
26657
26673
|
return parameters;
|
|
@@ -26660,7 +26676,7 @@ var ts;
|
|
|
26660
26676
|
if (!parseExpected(20)) {
|
|
26661
26677
|
return createMissingList();
|
|
26662
26678
|
}
|
|
26663
|
-
var parameters = parseParametersWorker(flags);
|
|
26679
|
+
var parameters = parseParametersWorker(flags, true);
|
|
26664
26680
|
parseExpected(21);
|
|
26665
26681
|
return parameters;
|
|
26666
26682
|
}
|
|
@@ -26715,7 +26731,7 @@ var ts;
|
|
|
26715
26731
|
return token() === 58 || token() === 27 || token() === 23;
|
|
26716
26732
|
}
|
|
26717
26733
|
function parseIndexSignatureDeclaration(pos, hasJSDoc, decorators, modifiers) {
|
|
26718
|
-
var parameters = parseBracketedList(16, parseParameter, 22, 23);
|
|
26734
|
+
var parameters = parseBracketedList(16, function () { return parseParameter(false); }, 22, 23);
|
|
26719
26735
|
var type = parseTypeAnnotation();
|
|
26720
26736
|
parseTypeMemberSemicolon();
|
|
26721
26737
|
var node = factory.createIndexSignature(decorators, modifiers, parameters, type);
|
|
@@ -27589,7 +27605,16 @@ var ts;
|
|
|
27589
27605
|
parameters = createMissingList();
|
|
27590
27606
|
}
|
|
27591
27607
|
else {
|
|
27592
|
-
|
|
27608
|
+
if (!allowAmbiguity) {
|
|
27609
|
+
var maybeParameters = parseParametersWorker(isAsync, allowAmbiguity);
|
|
27610
|
+
if (!maybeParameters) {
|
|
27611
|
+
return undefined;
|
|
27612
|
+
}
|
|
27613
|
+
parameters = maybeParameters;
|
|
27614
|
+
}
|
|
27615
|
+
else {
|
|
27616
|
+
parameters = parseParametersWorker(isAsync, allowAmbiguity);
|
|
27617
|
+
}
|
|
27593
27618
|
if (!parseExpected(21) && !allowAmbiguity) {
|
|
27594
27619
|
return undefined;
|
|
27595
27620
|
}
|
|
@@ -51327,7 +51352,11 @@ var ts;
|
|
|
51327
51352
|
return !root.isDistributive && isSingletonTupleType(root.node.checkType) && isSingletonTupleType(root.node.extendsType);
|
|
51328
51353
|
}
|
|
51329
51354
|
function isSingletonTupleType(node) {
|
|
51330
|
-
return ts.isTupleTypeNode(node) &&
|
|
51355
|
+
return ts.isTupleTypeNode(node) &&
|
|
51356
|
+
ts.length(node.elements) === 1 &&
|
|
51357
|
+
!ts.isOptionalTypeNode(node.elements[0]) &&
|
|
51358
|
+
!ts.isRestTypeNode(node.elements[0]) &&
|
|
51359
|
+
!(ts.isNamedTupleMember(node.elements[0]) && (node.elements[0].questionToken || node.elements[0].dotDotDotToken));
|
|
51331
51360
|
}
|
|
51332
51361
|
function unwrapNondistributiveConditionalTuple(root, type) {
|
|
51333
51362
|
return isTypicalNondistributiveConditional(root) && isTupleType(type) ? getTypeArguments(type)[0] : type;
|
|
@@ -55251,6 +55280,9 @@ var ts;
|
|
|
55251
55280
|
function createMarkerType(symbol, source, target) {
|
|
55252
55281
|
var mapper = makeUnaryTypeMapper(source, target);
|
|
55253
55282
|
var type = getDeclaredTypeOfSymbol(symbol);
|
|
55283
|
+
if (isErrorType(type)) {
|
|
55284
|
+
return type;
|
|
55285
|
+
}
|
|
55254
55286
|
var result = symbol.flags & 524288 ?
|
|
55255
55287
|
getTypeAliasInstantiation(symbol, instantiateTypes(getSymbolLinks(symbol).typeParameters, mapper)) :
|
|
55256
55288
|
createTypeReference(type, instantiateTypes(type.typeParameters, mapper));
|
|
@@ -97213,21 +97245,6 @@ var ts;
|
|
|
97213
97245
|
return resolvedRef;
|
|
97214
97246
|
}
|
|
97215
97247
|
function verifyCompilerOptions() {
|
|
97216
|
-
var isNightly = ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
|
|
97217
|
-
if (!isNightly) {
|
|
97218
|
-
if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
|
|
97219
|
-
createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "node12");
|
|
97220
|
-
}
|
|
97221
|
-
else if (ts.getEmitModuleKind(options) === ts.ModuleKind.NodeNext) {
|
|
97222
|
-
createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "nodenext");
|
|
97223
|
-
}
|
|
97224
|
-
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12) {
|
|
97225
|
-
createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "node12");
|
|
97226
|
-
}
|
|
97227
|
-
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
97228
|
-
createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "nodenext");
|
|
97229
|
-
}
|
|
97230
|
-
}
|
|
97231
97248
|
if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
|
|
97232
97249
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
|
|
97233
97250
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220405";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -16797,7 +16797,11 @@ var ts;
|
|
|
16797
16797
|
ts.getEffectiveContainerForJSDocTemplateTag = getEffectiveContainerForJSDocTemplateTag;
|
|
16798
16798
|
function getHostSignatureFromJSDoc(node) {
|
|
16799
16799
|
var host = getEffectiveJSDocHost(node);
|
|
16800
|
-
|
|
16800
|
+
if (host) {
|
|
16801
|
+
return ts.isPropertySignature(host) && host.type && ts.isFunctionLike(host.type) ? host.type :
|
|
16802
|
+
ts.isFunctionLike(host) ? host : undefined;
|
|
16803
|
+
}
|
|
16804
|
+
return undefined;
|
|
16801
16805
|
}
|
|
16802
16806
|
ts.getHostSignatureFromJSDoc = getHostSignatureFromJSDoc;
|
|
16803
16807
|
function getEffectiveJSDocHost(node) {
|
|
@@ -32563,7 +32567,6 @@ var ts;
|
|
|
32563
32567
|
default: return [undefined]; // TODO: GH#18217 `default: Debug.assertNever(context);`
|
|
32564
32568
|
}
|
|
32565
32569
|
}
|
|
32566
|
-
// Parses a comma-delimited list of elements
|
|
32567
32570
|
function parseDelimitedList(kind, parseElement, considerSemicolonAsDelimiter) {
|
|
32568
32571
|
var saveParsingContext = parsingContext;
|
|
32569
32572
|
parsingContext |= 1 << kind;
|
|
@@ -32573,7 +32576,11 @@ var ts;
|
|
|
32573
32576
|
while (true) {
|
|
32574
32577
|
if (isListElement(kind, /*inErrorRecovery*/ false)) {
|
|
32575
32578
|
var startPos = scanner.getStartPos();
|
|
32576
|
-
|
|
32579
|
+
var result = parseListElement(kind, parseElement);
|
|
32580
|
+
if (!result) {
|
|
32581
|
+
return undefined;
|
|
32582
|
+
}
|
|
32583
|
+
list.push(result);
|
|
32577
32584
|
commaStart = scanner.getTokenPos();
|
|
32578
32585
|
if (parseOptional(27 /* CommaToken */)) {
|
|
32579
32586
|
// No need to check for a zero length node since we know we parsed a comma
|
|
@@ -32978,13 +32985,20 @@ var ts;
|
|
|
32978
32985
|
}
|
|
32979
32986
|
return name;
|
|
32980
32987
|
}
|
|
32981
|
-
function
|
|
32982
|
-
|
|
32988
|
+
function isParameterNameStart() {
|
|
32989
|
+
// Be permissive about await and yield by calling isBindingIdentifier instead of isIdentifier; disallowing
|
|
32990
|
+
// them during a speculative parse leads to many more follow-on errors than allowing the function to parse then later
|
|
32991
|
+
// complaining about the use of the keywords.
|
|
32992
|
+
return isBindingIdentifier() || token() === 22 /* OpenBracketToken */ || token() === 18 /* OpenBraceToken */;
|
|
32983
32993
|
}
|
|
32984
|
-
function parseParameter() {
|
|
32985
|
-
return parseParameterWorker(
|
|
32994
|
+
function parseParameter(inOuterAwaitContext) {
|
|
32995
|
+
return parseParameterWorker(inOuterAwaitContext);
|
|
32986
32996
|
}
|
|
32987
|
-
function
|
|
32997
|
+
function parseParameterForSpeculation(inOuterAwaitContext) {
|
|
32998
|
+
return parseParameterWorker(inOuterAwaitContext, /*allowAmbiguity*/ false);
|
|
32999
|
+
}
|
|
33000
|
+
function parseParameterWorker(inOuterAwaitContext, allowAmbiguity) {
|
|
33001
|
+
if (allowAmbiguity === void 0) { allowAmbiguity = true; }
|
|
32988
33002
|
var pos = getNodePos();
|
|
32989
33003
|
var hasJSDoc = hasPrecedingJSDocComment();
|
|
32990
33004
|
// FormalParameter [Yield,Await]:
|
|
@@ -33005,7 +33019,11 @@ var ts;
|
|
|
33005
33019
|
var savedTopLevel = topLevel;
|
|
33006
33020
|
topLevel = false;
|
|
33007
33021
|
var modifiers = parseModifiers();
|
|
33008
|
-
var
|
|
33022
|
+
var dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
|
|
33023
|
+
if (!allowAmbiguity && !isParameterNameStart()) {
|
|
33024
|
+
return undefined;
|
|
33025
|
+
}
|
|
33026
|
+
var node = withJSDoc(finishNode(factory.createParameterDeclaration(decorators, modifiers, dotDotDotToken, parseNameOfParameter(modifiers), parseOptionalToken(57 /* QuestionToken */), parseTypeAnnotation(), parseInitializer()), pos), hasJSDoc);
|
|
33009
33027
|
topLevel = savedTopLevel;
|
|
33010
33028
|
return node;
|
|
33011
33029
|
}
|
|
@@ -33030,7 +33048,7 @@ var ts;
|
|
|
33030
33048
|
}
|
|
33031
33049
|
return false;
|
|
33032
33050
|
}
|
|
33033
|
-
function parseParametersWorker(flags) {
|
|
33051
|
+
function parseParametersWorker(flags, allowAmbiguity) {
|
|
33034
33052
|
// FormalParameters [Yield,Await]: (modified)
|
|
33035
33053
|
// [empty]
|
|
33036
33054
|
// FormalParameterList[?Yield,Await]
|
|
@@ -33050,7 +33068,7 @@ var ts;
|
|
|
33050
33068
|
setAwaitContext(!!(flags & 2 /* Await */));
|
|
33051
33069
|
var parameters = flags & 32 /* JSDoc */ ?
|
|
33052
33070
|
parseDelimitedList(17 /* JSDocParameters */, parseJSDocParameter) :
|
|
33053
|
-
parseDelimitedList(16 /* Parameters */,
|
|
33071
|
+
parseDelimitedList(16 /* Parameters */, function () { return allowAmbiguity ? parseParameter(savedAwaitContext) : parseParameterForSpeculation(savedAwaitContext); });
|
|
33054
33072
|
setYieldContext(savedYieldContext);
|
|
33055
33073
|
setAwaitContext(savedAwaitContext);
|
|
33056
33074
|
return parameters;
|
|
@@ -33072,7 +33090,7 @@ var ts;
|
|
|
33072
33090
|
if (!parseExpected(20 /* OpenParenToken */)) {
|
|
33073
33091
|
return createMissingList();
|
|
33074
33092
|
}
|
|
33075
|
-
var parameters = parseParametersWorker(flags);
|
|
33093
|
+
var parameters = parseParametersWorker(flags, /*allowAmbiguity*/ true);
|
|
33076
33094
|
parseExpected(21 /* CloseParenToken */);
|
|
33077
33095
|
return parameters;
|
|
33078
33096
|
}
|
|
@@ -33154,7 +33172,7 @@ var ts;
|
|
|
33154
33172
|
return token() === 58 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
|
|
33155
33173
|
}
|
|
33156
33174
|
function parseIndexSignatureDeclaration(pos, hasJSDoc, decorators, modifiers) {
|
|
33157
|
-
var parameters = parseBracketedList(16 /* Parameters */, parseParameter, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
|
|
33175
|
+
var parameters = parseBracketedList(16 /* Parameters */, function () { return parseParameter(/*inOuterAwaitContext*/ false); }, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
|
|
33158
33176
|
var type = parseTypeAnnotation();
|
|
33159
33177
|
parseTypeMemberSemicolon();
|
|
33160
33178
|
var node = factory.createIndexSignature(decorators, modifiers, parameters, type);
|
|
@@ -34204,7 +34222,16 @@ var ts;
|
|
|
34204
34222
|
parameters = createMissingList();
|
|
34205
34223
|
}
|
|
34206
34224
|
else {
|
|
34207
|
-
|
|
34225
|
+
if (!allowAmbiguity) {
|
|
34226
|
+
var maybeParameters = parseParametersWorker(isAsync, allowAmbiguity);
|
|
34227
|
+
if (!maybeParameters) {
|
|
34228
|
+
return undefined;
|
|
34229
|
+
}
|
|
34230
|
+
parameters = maybeParameters;
|
|
34231
|
+
}
|
|
34232
|
+
else {
|
|
34233
|
+
parameters = parseParametersWorker(isAsync, allowAmbiguity);
|
|
34234
|
+
}
|
|
34208
34235
|
if (!parseExpected(21 /* CloseParenToken */) && !allowAmbiguity) {
|
|
34209
34236
|
return undefined;
|
|
34210
34237
|
}
|
|
@@ -61764,7 +61791,11 @@ var ts;
|
|
|
61764
61791
|
return !root.isDistributive && isSingletonTupleType(root.node.checkType) && isSingletonTupleType(root.node.extendsType);
|
|
61765
61792
|
}
|
|
61766
61793
|
function isSingletonTupleType(node) {
|
|
61767
|
-
return ts.isTupleTypeNode(node) &&
|
|
61794
|
+
return ts.isTupleTypeNode(node) &&
|
|
61795
|
+
ts.length(node.elements) === 1 &&
|
|
61796
|
+
!ts.isOptionalTypeNode(node.elements[0]) &&
|
|
61797
|
+
!ts.isRestTypeNode(node.elements[0]) &&
|
|
61798
|
+
!(ts.isNamedTupleMember(node.elements[0]) && (node.elements[0].questionToken || node.elements[0].dotDotDotToken));
|
|
61768
61799
|
}
|
|
61769
61800
|
/**
|
|
61770
61801
|
* We syntactually check for common nondistributive conditional shapes and unwrap them into
|
|
@@ -66284,6 +66315,9 @@ var ts;
|
|
|
66284
66315
|
function createMarkerType(symbol, source, target) {
|
|
66285
66316
|
var mapper = makeUnaryTypeMapper(source, target);
|
|
66286
66317
|
var type = getDeclaredTypeOfSymbol(symbol);
|
|
66318
|
+
if (isErrorType(type)) {
|
|
66319
|
+
return type;
|
|
66320
|
+
}
|
|
66287
66321
|
var result = symbol.flags & 524288 /* TypeAlias */ ?
|
|
66288
66322
|
getTypeAliasInstantiation(symbol, instantiateTypes(getSymbolLinks(symbol).typeParameters, mapper)) :
|
|
66289
66323
|
createTypeReference(type, instantiateTypes(type.typeParameters, mapper));
|
|
@@ -117679,21 +117713,6 @@ var ts;
|
|
|
117679
117713
|
return resolvedRef;
|
|
117680
117714
|
}
|
|
117681
117715
|
function verifyCompilerOptions() {
|
|
117682
|
-
var isNightly = ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
|
|
117683
|
-
if (!isNightly) {
|
|
117684
|
-
if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
|
|
117685
|
-
createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "node12");
|
|
117686
|
-
}
|
|
117687
|
-
else if (ts.getEmitModuleKind(options) === ts.ModuleKind.NodeNext) {
|
|
117688
|
-
createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "nodenext");
|
|
117689
|
-
}
|
|
117690
|
-
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12) {
|
|
117691
|
-
createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "node12");
|
|
117692
|
-
}
|
|
117693
|
-
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
117694
|
-
createOptionValueDiagnostic("moduleResolution", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "moduleResolution", "nodenext");
|
|
117695
|
-
}
|
|
117696
|
-
}
|
|
117697
117716
|
if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
|
|
117698
117717
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
|
|
117699
117718
|
}
|
|
@@ -142284,10 +142303,13 @@ var ts;
|
|
|
142284
142303
|
var contextualType = info.contextualType, argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan;
|
|
142285
142304
|
// for optional function condition.
|
|
142286
142305
|
var nonNullableContextualType = contextualType.getNonNullableType();
|
|
142287
|
-
var
|
|
142288
|
-
if (
|
|
142306
|
+
var symbol = nonNullableContextualType.symbol;
|
|
142307
|
+
if (symbol === undefined)
|
|
142308
|
+
return undefined;
|
|
142309
|
+
var signature = ts.lastOrUndefined(nonNullableContextualType.getCallSignatures());
|
|
142310
|
+
if (signature === undefined)
|
|
142289
142311
|
return undefined;
|
|
142290
|
-
var invocation = { kind: 2 /* Contextual */, signature:
|
|
142312
|
+
var invocation = { kind: 2 /* Contextual */, signature: signature, node: startingToken, symbol: chooseBetterSymbol(symbol) };
|
|
142291
142313
|
return { isTypeParameterList: false, invocation: invocation, argumentsSpan: argumentsSpan, argumentIndex: argumentIndex, argumentCount: argumentCount };
|
|
142292
142314
|
}
|
|
142293
142315
|
function getContextualSignatureLocationInfo(startingToken, sourceFile, position, checker) {
|
|
@@ -146457,9 +146479,9 @@ var ts;
|
|
|
146457
146479
|
// for block indentation, we should look for a line which contains something that's not
|
|
146458
146480
|
// whitespace.
|
|
146459
146481
|
var currentToken = ts.getTokenAtPosition(sourceFile, position);
|
|
146460
|
-
//
|
|
146461
|
-
//
|
|
146462
|
-
// the following indentation should treat { as
|
|
146482
|
+
// For object literals, we want indentation to work just like with blocks.
|
|
146483
|
+
// If the `{` starts in any position (even in the middle of a line), then
|
|
146484
|
+
// the following indentation should treat `{` as the start of that line (including leading whitespace).
|
|
146463
146485
|
// ```
|
|
146464
146486
|
// const a: { x: undefined, y: undefined } = {} // leading 4 whitespaces and { starts in the middle of line
|
|
146465
146487
|
// ->
|
|
@@ -146477,7 +146499,8 @@ var ts;
|
|
|
146477
146499
|
// y: undefined,
|
|
146478
146500
|
// }
|
|
146479
146501
|
// ```
|
|
146480
|
-
|
|
146502
|
+
var isObjectLiteral = currentToken.kind === 18 /* OpenBraceToken */ && currentToken.parent.kind === 205 /* ObjectLiteralExpression */;
|
|
146503
|
+
if (options.indentStyle === ts.IndentStyle.Block || isObjectLiteral) {
|
|
146481
146504
|
return getBlockIndent(sourceFile, position, options);
|
|
146482
146505
|
}
|
|
146483
146506
|
if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 221 /* BinaryExpression */) {
|
|
@@ -146490,7 +146513,9 @@ var ts;
|
|
|
146490
146513
|
var containerList = getListByPosition(position, precedingToken.parent, sourceFile);
|
|
146491
146514
|
// use list position if the preceding token is before any list items
|
|
146492
146515
|
if (containerList && !ts.rangeContainsRange(containerList, precedingToken)) {
|
|
146493
|
-
|
|
146516
|
+
var useTheSameBaseIndentation = [213 /* FunctionExpression */, 214 /* ArrowFunction */].indexOf(currentToken.parent.kind) !== -1;
|
|
146517
|
+
var indentSize = useTheSameBaseIndentation ? 0 : options.indentSize;
|
|
146518
|
+
return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; // TODO: GH#18217
|
|
146494
146519
|
}
|
|
146495
146520
|
return getSmartIndent(sourceFile, position, precedingToken, lineAtPosition, assumeNewLineBeforeCloseBrace, options);
|
|
146496
146521
|
}
|
|
@@ -156064,7 +156089,11 @@ var ts;
|
|
|
156064
156089
|
var program = context.program;
|
|
156065
156090
|
var checker = program.getTypeChecker();
|
|
156066
156091
|
var scriptTarget = ts.getEmitScriptTarget(program.getCompilerOptions());
|
|
156067
|
-
var flags = 1 /* NoTruncation */
|
|
156092
|
+
var flags = 1 /* NoTruncation */
|
|
156093
|
+
| 1073741824 /* NoUndefinedOptionalParameterType */
|
|
156094
|
+
| 256 /* SuppressAnyReturnType */
|
|
156095
|
+
| 524288 /* AllowEmptyTuple */
|
|
156096
|
+
| (quotePreference === 0 /* Single */ ? 268435456 /* UseSingleQuotesForStringLiteralType */ : 0 /* None */);
|
|
156068
156097
|
var signatureDeclaration = checker.signatureToSignatureDeclaration(signature, kind, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context));
|
|
156069
156098
|
if (!signatureDeclaration) {
|
|
156070
156099
|
return undefined;
|
|
@@ -158798,7 +158827,8 @@ var ts;
|
|
|
158798
158827
|
return undefined;
|
|
158799
158828
|
}
|
|
158800
158829
|
function isScope(node) {
|
|
158801
|
-
return ts.
|
|
158830
|
+
return ts.isArrowFunction(node) ? ts.isFunctionBody(node.body) :
|
|
158831
|
+
ts.isFunctionLikeDeclaration(node) || ts.isSourceFile(node) || ts.isModuleBlock(node) || ts.isClassLike(node);
|
|
158802
158832
|
}
|
|
158803
158833
|
/**
|
|
158804
158834
|
* Computes possible places we could extract the function into. For example,
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -1983,7 +1983,7 @@ declare namespace ts {
|
|
|
1983
1983
|
Label = 12,
|
|
1984
1984
|
Condition = 96
|
|
1985
1985
|
}
|
|
1986
|
-
export type FlowNode = FlowStart | FlowLabel | FlowAssignment |
|
|
1986
|
+
export type FlowNode = FlowStart | FlowLabel | FlowAssignment | FlowCondition | FlowSwitchClause | FlowArrayMutation | FlowCall | FlowReduceLabel;
|
|
1987
1987
|
export interface FlowNodeBase {
|
|
1988
1988
|
flags: FlowFlags;
|
|
1989
1989
|
id?: number;
|