typescript 4.6.0-dev.20220104 → 4.6.0-dev.20220105
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 +67 -44
- package/lib/tsserver.js +172 -99
- package/lib/tsserverlibrary.d.ts +4 -3
- package/lib/tsserverlibrary.js +172 -99
- package/lib/typescript.d.ts +4 -3
- package/lib/typescript.js +171 -98
- package/lib/typescriptServices.d.ts +4 -3
- package/lib/typescriptServices.js +171 -98
- package/lib/typingsInstaller.js +114 -69
- package/package.json +1 -1
package/lib/typingsInstaller.js
CHANGED
|
@@ -89,7 +89,7 @@ var ts;
|
|
|
89
89
|
// The following is baselined as a literal template type without intervention
|
|
90
90
|
/** The version of the TypeScript compiler release */
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
92
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
92
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220105";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -22231,7 +22231,7 @@ var ts;
|
|
|
22231
22231
|
result.push(createModifier(144 /* ReadonlyKeyword */));
|
|
22232
22232
|
if (flags & 256 /* Async */)
|
|
22233
22233
|
result.push(createModifier(131 /* AsyncKeyword */));
|
|
22234
|
-
return result;
|
|
22234
|
+
return result.length ? result : undefined;
|
|
22235
22235
|
}
|
|
22236
22236
|
//
|
|
22237
22237
|
// Names
|
|
@@ -26188,32 +26188,36 @@ var ts;
|
|
|
26188
26188
|
}
|
|
26189
26189
|
function updateModifiers(node, modifiers) {
|
|
26190
26190
|
var _a;
|
|
26191
|
+
var modifierArray;
|
|
26191
26192
|
if (typeof modifiers === "number") {
|
|
26192
|
-
|
|
26193
|
-
}
|
|
26194
|
-
|
|
26195
|
-
|
|
26196
|
-
|
|
26197
|
-
|
|
26198
|
-
|
|
26199
|
-
|
|
26200
|
-
|
|
26201
|
-
|
|
26202
|
-
|
|
26203
|
-
|
|
26204
|
-
|
|
26205
|
-
|
|
26206
|
-
|
|
26207
|
-
|
|
26208
|
-
|
|
26209
|
-
|
|
26210
|
-
|
|
26211
|
-
|
|
26212
|
-
|
|
26213
|
-
|
|
26214
|
-
|
|
26215
|
-
|
|
26216
|
-
|
|
26193
|
+
modifierArray = createModifiersFromModifierFlags(modifiers);
|
|
26194
|
+
}
|
|
26195
|
+
else {
|
|
26196
|
+
modifierArray = modifiers;
|
|
26197
|
+
}
|
|
26198
|
+
return ts.isParameter(node) ? updateParameterDeclaration(node, node.decorators, modifierArray, node.dotDotDotToken, node.name, node.questionToken, node.type, node.initializer) :
|
|
26199
|
+
ts.isPropertySignature(node) ? updatePropertySignature(node, modifierArray, node.name, node.questionToken, node.type) :
|
|
26200
|
+
ts.isPropertyDeclaration(node) ? updatePropertyDeclaration(node, node.decorators, modifierArray, node.name, (_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, node.type, node.initializer) :
|
|
26201
|
+
ts.isMethodSignature(node) ? updateMethodSignature(node, modifierArray, node.name, node.questionToken, node.typeParameters, node.parameters, node.type) :
|
|
26202
|
+
ts.isMethodDeclaration(node) ? updateMethodDeclaration(node, node.decorators, modifierArray, node.asteriskToken, node.name, node.questionToken, node.typeParameters, node.parameters, node.type, node.body) :
|
|
26203
|
+
ts.isConstructorDeclaration(node) ? updateConstructorDeclaration(node, node.decorators, modifierArray, node.parameters, node.body) :
|
|
26204
|
+
ts.isGetAccessorDeclaration(node) ? updateGetAccessorDeclaration(node, node.decorators, modifierArray, node.name, node.parameters, node.type, node.body) :
|
|
26205
|
+
ts.isSetAccessorDeclaration(node) ? updateSetAccessorDeclaration(node, node.decorators, modifierArray, node.name, node.parameters, node.body) :
|
|
26206
|
+
ts.isIndexSignatureDeclaration(node) ? updateIndexSignature(node, node.decorators, modifierArray, node.parameters, node.type) :
|
|
26207
|
+
ts.isFunctionExpression(node) ? updateFunctionExpression(node, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) :
|
|
26208
|
+
ts.isArrowFunction(node) ? updateArrowFunction(node, modifierArray, node.typeParameters, node.parameters, node.type, node.equalsGreaterThanToken, node.body) :
|
|
26209
|
+
ts.isClassExpression(node) ? updateClassExpression(node, node.decorators, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) :
|
|
26210
|
+
ts.isVariableStatement(node) ? updateVariableStatement(node, modifierArray, node.declarationList) :
|
|
26211
|
+
ts.isFunctionDeclaration(node) ? updateFunctionDeclaration(node, node.decorators, modifierArray, node.asteriskToken, node.name, node.typeParameters, node.parameters, node.type, node.body) :
|
|
26212
|
+
ts.isClassDeclaration(node) ? updateClassDeclaration(node, node.decorators, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) :
|
|
26213
|
+
ts.isInterfaceDeclaration(node) ? updateInterfaceDeclaration(node, node.decorators, modifierArray, node.name, node.typeParameters, node.heritageClauses, node.members) :
|
|
26214
|
+
ts.isTypeAliasDeclaration(node) ? updateTypeAliasDeclaration(node, node.decorators, modifierArray, node.name, node.typeParameters, node.type) :
|
|
26215
|
+
ts.isEnumDeclaration(node) ? updateEnumDeclaration(node, node.decorators, modifierArray, node.name, node.members) :
|
|
26216
|
+
ts.isModuleDeclaration(node) ? updateModuleDeclaration(node, node.decorators, modifierArray, node.name, node.body) :
|
|
26217
|
+
ts.isImportEqualsDeclaration(node) ? updateImportEqualsDeclaration(node, node.decorators, modifierArray, node.isTypeOnly, node.name, node.moduleReference) :
|
|
26218
|
+
ts.isImportDeclaration(node) ? updateImportDeclaration(node, node.decorators, modifierArray, node.importClause, node.moduleSpecifier, node.assertClause) :
|
|
26219
|
+
ts.isExportAssignment(node) ? updateExportAssignment(node, node.decorators, modifierArray, node.expression) :
|
|
26220
|
+
ts.isExportDeclaration(node) ? updateExportDeclaration(node, node.decorators, modifierArray, node.isTypeOnly, node.exportClause, node.moduleSpecifier, node.assertClause) :
|
|
26217
26221
|
ts.Debug.assertNever(node);
|
|
26218
26222
|
}
|
|
26219
26223
|
function asNodeArray(array) {
|
|
@@ -67426,7 +67430,8 @@ var ts;
|
|
|
67426
67430
|
return access.kind === 205 /* PropertyAccessExpression */ ? access.name.escapedText :
|
|
67427
67431
|
access.kind === 206 /* ElementAccessExpression */ && ts.isStringOrNumericLiteralLike(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
|
|
67428
67432
|
access.kind === 202 /* BindingElement */ && (propertyName = getDestructuringPropertyName(access)) ? ts.escapeLeadingUnderscores(propertyName) :
|
|
67429
|
-
|
|
67433
|
+
access.kind === 163 /* Parameter */ ? ("" + access.parent.parameters.indexOf(access)) :
|
|
67434
|
+
undefined;
|
|
67430
67435
|
}
|
|
67431
67436
|
function containsMatchingReference(source, target) {
|
|
67432
67437
|
while (ts.isAccessExpression(source)) {
|
|
@@ -68766,13 +68771,14 @@ var ts;
|
|
|
68766
68771
|
return result;
|
|
68767
68772
|
}
|
|
68768
68773
|
function getCandidateDiscriminantPropertyAccess(expr) {
|
|
68769
|
-
if (ts.isBindingPattern(reference)) {
|
|
68770
|
-
// When the reference is a binding pattern, we are narrowing a pesudo-reference in
|
|
68771
|
-
// An identifier for a destructuring variable declared in the same binding pattern
|
|
68774
|
+
if (ts.isBindingPattern(reference) || ts.isFunctionExpressionOrArrowFunction(reference)) {
|
|
68775
|
+
// When the reference is a binding pattern or function or arrow expression, we are narrowing a pesudo-reference in
|
|
68776
|
+
// getNarrowedTypeOfSymbol. An identifier for a destructuring variable declared in the same binding pattern or
|
|
68777
|
+
// parameter declared in the same parameter list is a candidate.
|
|
68772
68778
|
if (ts.isIdentifier(expr)) {
|
|
68773
68779
|
var symbol = getResolvedSymbol(expr);
|
|
68774
68780
|
var declaration = symbol.valueDeclaration;
|
|
68775
|
-
if (declaration && ts.isBindingElement(declaration) &&
|
|
68781
|
+
if (declaration && (ts.isBindingElement(declaration) || ts.isParameter(declaration)) && reference === declaration.parent && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
68776
68782
|
return declaration;
|
|
68777
68783
|
}
|
|
68778
68784
|
}
|
|
@@ -69574,42 +69580,78 @@ var ts;
|
|
|
69574
69580
|
}
|
|
69575
69581
|
}
|
|
69576
69582
|
function getNarrowedTypeOfSymbol(symbol, location) {
|
|
69577
|
-
// If we have a non-rest binding element with no initializer declared as a const variable or a const-like
|
|
69578
|
-
// parameter (a parameter for which there are no assignments in the function body), and if the parent type
|
|
69579
|
-
// for the destructuring is a union type, one or more of the binding elements may represent discriminant
|
|
69580
|
-
// properties, and we want the effects of conditional checks on such discriminants to affect the types of
|
|
69581
|
-
// other binding elements from the same destructuring. Consider:
|
|
69582
|
-
//
|
|
69583
|
-
// type Action =
|
|
69584
|
-
// | { kind: 'A', payload: number }
|
|
69585
|
-
// | { kind: 'B', payload: string };
|
|
69586
|
-
//
|
|
69587
|
-
// function f1({ kind, payload }: Action) {
|
|
69588
|
-
// if (kind === 'A') {
|
|
69589
|
-
// payload.toFixed();
|
|
69590
|
-
// }
|
|
69591
|
-
// if (kind === 'B') {
|
|
69592
|
-
// payload.toUpperCase();
|
|
69593
|
-
// }
|
|
69594
|
-
// }
|
|
69595
|
-
//
|
|
69596
|
-
// Above, we want the conditional checks on 'kind' to affect the type of 'payload'. To facilitate this, we use
|
|
69597
|
-
// the binding pattern AST instance for '{ kind, payload }' as a pseudo-reference and narrow this reference
|
|
69598
|
-
// as if it occurred in the specified location. We then recompute the narrowed binding element type by
|
|
69599
|
-
// destructuring from the narrowed parent type.
|
|
69600
69583
|
var declaration = symbol.valueDeclaration;
|
|
69601
|
-
if (declaration
|
|
69602
|
-
|
|
69603
|
-
|
|
69604
|
-
|
|
69605
|
-
|
|
69606
|
-
|
|
69607
|
-
|
|
69608
|
-
|
|
69609
|
-
|
|
69610
|
-
|
|
69611
|
-
|
|
69612
|
-
|
|
69584
|
+
if (declaration) {
|
|
69585
|
+
// If we have a non-rest binding element with no initializer declared as a const variable or a const-like
|
|
69586
|
+
// parameter (a parameter for which there are no assignments in the function body), and if the parent type
|
|
69587
|
+
// for the destructuring is a union type, one or more of the binding elements may represent discriminant
|
|
69588
|
+
// properties, and we want the effects of conditional checks on such discriminants to affect the types of
|
|
69589
|
+
// other binding elements from the same destructuring. Consider:
|
|
69590
|
+
//
|
|
69591
|
+
// type Action =
|
|
69592
|
+
// | { kind: 'A', payload: number }
|
|
69593
|
+
// | { kind: 'B', payload: string };
|
|
69594
|
+
//
|
|
69595
|
+
// function f({ kind, payload }: Action) {
|
|
69596
|
+
// if (kind === 'A') {
|
|
69597
|
+
// payload.toFixed();
|
|
69598
|
+
// }
|
|
69599
|
+
// if (kind === 'B') {
|
|
69600
|
+
// payload.toUpperCase();
|
|
69601
|
+
// }
|
|
69602
|
+
// }
|
|
69603
|
+
//
|
|
69604
|
+
// Above, we want the conditional checks on 'kind' to affect the type of 'payload'. To facilitate this, we use
|
|
69605
|
+
// the binding pattern AST instance for '{ kind, payload }' as a pseudo-reference and narrow this reference
|
|
69606
|
+
// as if it occurred in the specified location. We then recompute the narrowed binding element type by
|
|
69607
|
+
// destructuring from the narrowed parent type.
|
|
69608
|
+
if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) {
|
|
69609
|
+
var parent = declaration.parent.parent;
|
|
69610
|
+
if (parent.kind === 253 /* VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* Const */ || parent.kind === 163 /* Parameter */) {
|
|
69611
|
+
var links = getNodeLinks(location);
|
|
69612
|
+
if (!(links.flags & 268435456 /* InCheckIdentifier */)) {
|
|
69613
|
+
links.flags |= 268435456 /* InCheckIdentifier */;
|
|
69614
|
+
var parentType = getTypeForBindingElementParent(parent);
|
|
69615
|
+
links.flags &= ~268435456 /* InCheckIdentifier */;
|
|
69616
|
+
if (parentType && parentType.flags & 1048576 /* Union */ && !(parent.kind === 163 /* Parameter */ && isSymbolAssigned(symbol))) {
|
|
69617
|
+
var pattern = declaration.parent;
|
|
69618
|
+
var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode);
|
|
69619
|
+
return getBindingElementTypeFromParentType(declaration, narrowedType);
|
|
69620
|
+
}
|
|
69621
|
+
}
|
|
69622
|
+
}
|
|
69623
|
+
}
|
|
69624
|
+
// If we have a const-like parameter with no type annotation or initializer, and if the parameter is contextually
|
|
69625
|
+
// typed by a signature with a single rest parameter of a union of tuple types, one or more of the parameters may
|
|
69626
|
+
// represent discriminant tuple elements, and we want the effects of conditional checks on such discriminants to
|
|
69627
|
+
// affect the types of other parameters in the same parameter list. Consider:
|
|
69628
|
+
//
|
|
69629
|
+
// type Action = [kind: 'A', payload: number] | [kind: 'B', payload: string];
|
|
69630
|
+
//
|
|
69631
|
+
// const f: (...args: Action) => void = (kind, payload) => {
|
|
69632
|
+
// if (kind === 'A') {
|
|
69633
|
+
// payload.toFixed();
|
|
69634
|
+
// }
|
|
69635
|
+
// if (kind === 'B') {
|
|
69636
|
+
// payload.toUpperCase();
|
|
69637
|
+
// }
|
|
69638
|
+
// }
|
|
69639
|
+
//
|
|
69640
|
+
// Above, we want the conditional checks on 'kind' to affect the type of 'payload'. To facilitate this, we use
|
|
69641
|
+
// the arrow function AST node for '(kind, payload) => ...' as a pseudo-reference and narrow this reference as
|
|
69642
|
+
// if it occurred in the specified location. We then recompute the narrowed parameter type by indexing into the
|
|
69643
|
+
// narrowed tuple type.
|
|
69644
|
+
if (ts.isParameter(declaration) && !declaration.type && !declaration.initializer && !declaration.dotDotDotToken) {
|
|
69645
|
+
var func = declaration.parent;
|
|
69646
|
+
if (func.parameters.length >= 2 && isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
|
|
69647
|
+
var contextualSignature = getContextualSignature(func);
|
|
69648
|
+
if (contextualSignature && contextualSignature.parameters.length === 1 && signatureHasRestParameter(contextualSignature)) {
|
|
69649
|
+
var restType = getTypeOfSymbol(contextualSignature.parameters[0]);
|
|
69650
|
+
if (restType.flags & 1048576 /* Union */ && everyType(restType, isTupleType) && !isSymbolAssigned(symbol)) {
|
|
69651
|
+
var narrowedType = getFlowTypeOfReference(func, restType, restType, /*flowContainer*/ undefined, location.flowNode);
|
|
69652
|
+
var index = func.parameters.indexOf(declaration) - (ts.getThisParameter(func) ? 1 : 0);
|
|
69653
|
+
return getIndexedAccessType(narrowedType, getNumberLiteralType(index));
|
|
69654
|
+
}
|
|
69613
69655
|
}
|
|
69614
69656
|
}
|
|
69615
69657
|
}
|
|
@@ -109007,7 +109049,7 @@ var ts;
|
|
|
109007
109049
|
emitPlaceholder(hint, node, snippet);
|
|
109008
109050
|
break;
|
|
109009
109051
|
case 0 /* TabStop */:
|
|
109010
|
-
emitTabStop(snippet);
|
|
109052
|
+
emitTabStop(hint, node, snippet);
|
|
109011
109053
|
break;
|
|
109012
109054
|
}
|
|
109013
109055
|
}
|
|
@@ -109017,7 +109059,10 @@ var ts;
|
|
|
109017
109059
|
nonEscapingWrite("}"); // `}`
|
|
109018
109060
|
// `${2:...}`
|
|
109019
109061
|
}
|
|
109020
|
-
function emitTabStop(snippet) {
|
|
109062
|
+
function emitTabStop(hint, node, snippet) {
|
|
109063
|
+
// A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text.
|
|
109064
|
+
ts.Debug.assert(node.kind === 235 /* EmptyStatement */, "A tab stop cannot be attached to a node of kind " + ts.Debug.formatSyntaxKind(node.kind) + ".");
|
|
109065
|
+
ts.Debug.assert(hint !== 5 /* EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement.");
|
|
109021
109066
|
nonEscapingWrite("$" + snippet.order);
|
|
109022
109067
|
}
|
|
109023
109068
|
//
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "4.6.0-dev.
|
|
5
|
+
"version": "4.6.0-dev.20220105",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|