typescript 4.7.0-dev.20220309 → 4.7.0-dev.20220310
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 +138 -69
- package/lib/tsserver.js +185 -84
- package/lib/tsserverlibrary.d.ts +3 -1
- package/lib/tsserverlibrary.js +185 -84
- package/lib/typescript.d.ts +3 -1
- package/lib/typescript.js +185 -84
- package/lib/typescriptServices.d.ts +3 -1
- package/lib/typescriptServices.js +185 -84
- package/lib/typingsInstaller.js +185 -84
- 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.20220310";
|
|
93
93
|
/* @internal */
|
|
94
94
|
var Comparison;
|
|
95
95
|
(function (Comparison) {
|
|
@@ -4153,6 +4153,7 @@ var ts;
|
|
|
4153
4153
|
SyntaxKind[SyntaxKind["JSDocFunctionType"] = 316] = "JSDocFunctionType";
|
|
4154
4154
|
SyntaxKind[SyntaxKind["JSDocVariadicType"] = 317] = "JSDocVariadicType";
|
|
4155
4155
|
SyntaxKind[SyntaxKind["JSDocNamepathType"] = 318] = "JSDocNamepathType";
|
|
4156
|
+
/** @deprecated Use SyntaxKind.JSDoc */
|
|
4156
4157
|
SyntaxKind[SyntaxKind["JSDocComment"] = 319] = "JSDocComment";
|
|
4157
4158
|
SyntaxKind[SyntaxKind["JSDocText"] = 320] = "JSDocText";
|
|
4158
4159
|
SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 321] = "JSDocTypeLiteral";
|
|
@@ -4226,6 +4227,7 @@ var ts;
|
|
|
4226
4227
|
SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 346] = "LastJSDocTagNode";
|
|
4227
4228
|
/* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword";
|
|
4228
4229
|
/* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 159] = "LastContextualKeyword";
|
|
4230
|
+
SyntaxKind[SyntaxKind["JSDoc"] = 319] = "JSDoc";
|
|
4229
4231
|
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
|
|
4230
4232
|
var NodeFlags;
|
|
4231
4233
|
(function (NodeFlags) {
|
|
@@ -12822,7 +12824,7 @@ var ts;
|
|
|
12822
12824
|
return ts.emptyArray;
|
|
12823
12825
|
}
|
|
12824
12826
|
if (ts.isJSDocTypeAlias(node)) {
|
|
12825
|
-
ts.Debug.assert(node.parent.kind === 319 /*
|
|
12827
|
+
ts.Debug.assert(node.parent.kind === 319 /* JSDoc */);
|
|
12826
12828
|
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
|
|
12827
12829
|
}
|
|
12828
12830
|
if (node.typeParameters) {
|
|
@@ -13769,7 +13771,7 @@ var ts;
|
|
|
13769
13771
|
ts.isJSDocNode = isJSDocNode;
|
|
13770
13772
|
/** True if node is of a kind that may contain comment text. */
|
|
13771
13773
|
function isJSDocCommentContainingNode(node) {
|
|
13772
|
-
return node.kind === 319 /*
|
|
13774
|
+
return node.kind === 319 /* JSDoc */
|
|
13773
13775
|
|| node.kind === 318 /* JSDocNamepathType */
|
|
13774
13776
|
|| node.kind === 320 /* JSDocText */
|
|
13775
13777
|
|| isJSDocLinkLike(node)
|
|
@@ -15334,10 +15336,23 @@ var ts;
|
|
|
15334
15336
|
&& node.parent.parent.kind === 236 /* VariableStatement */;
|
|
15335
15337
|
}
|
|
15336
15338
|
ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
|
|
15339
|
+
function isCommonJsExportedExpression(node) {
|
|
15340
|
+
if (!isInJSFile(node))
|
|
15341
|
+
return false;
|
|
15342
|
+
return (ts.isObjectLiteralExpression(node.parent) && ts.isBinaryExpression(node.parent.parent) && getAssignmentDeclarationKind(node.parent.parent) === 2 /* ModuleExports */) ||
|
|
15343
|
+
isCommonJsExportPropertyAssignment(node.parent);
|
|
15344
|
+
}
|
|
15345
|
+
ts.isCommonJsExportedExpression = isCommonJsExportedExpression;
|
|
15346
|
+
function isCommonJsExportPropertyAssignment(node) {
|
|
15347
|
+
if (!isInJSFile(node))
|
|
15348
|
+
return false;
|
|
15349
|
+
return (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 1 /* ExportsProperty */);
|
|
15350
|
+
}
|
|
15351
|
+
ts.isCommonJsExportPropertyAssignment = isCommonJsExportPropertyAssignment;
|
|
15337
15352
|
function isValidESSymbolDeclaration(node) {
|
|
15338
|
-
return ts.isVariableDeclaration(node) ? isVarConst(node) && ts.isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) :
|
|
15353
|
+
return (ts.isVariableDeclaration(node) ? isVarConst(node) && ts.isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) :
|
|
15339
15354
|
ts.isPropertyDeclaration(node) ? hasEffectiveReadonlyModifier(node) && hasStaticModifier(node) :
|
|
15340
|
-
ts.isPropertySignature(node) && hasEffectiveReadonlyModifier(node);
|
|
15355
|
+
ts.isPropertySignature(node) && hasEffectiveReadonlyModifier(node)) || isCommonJsExportPropertyAssignment(node);
|
|
15341
15356
|
}
|
|
15342
15357
|
ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
|
|
15343
15358
|
function introducesArgumentsExoticObject(node) {
|
|
@@ -18231,7 +18246,7 @@ var ts;
|
|
|
18231
18246
|
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
|
|
18232
18247
|
/** template tags are only available when a typedef isn't already using them */
|
|
18233
18248
|
function isNonTypeAliasTemplate(tag) {
|
|
18234
|
-
return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 319 /*
|
|
18249
|
+
return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 319 /* JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias));
|
|
18235
18250
|
}
|
|
18236
18251
|
/**
|
|
18237
18252
|
* Gets the effective type annotation of the value parameter of a set accessor. If the node
|
|
@@ -25208,7 +25223,7 @@ var ts;
|
|
|
25208
25223
|
}
|
|
25209
25224
|
// @api
|
|
25210
25225
|
function createJSDocComment(comment, tags) {
|
|
25211
|
-
var node = createBaseNode(319 /*
|
|
25226
|
+
var node = createBaseNode(319 /* JSDoc */);
|
|
25212
25227
|
node.comment = comment;
|
|
25213
25228
|
node.tags = asNodeArray(tags);
|
|
25214
25229
|
return node;
|
|
@@ -28717,7 +28732,7 @@ var ts;
|
|
|
28717
28732
|
}
|
|
28718
28733
|
ts.isJSDocNamepathType = isJSDocNamepathType;
|
|
28719
28734
|
function isJSDoc(node) {
|
|
28720
|
-
return node.kind === 319 /*
|
|
28735
|
+
return node.kind === 319 /* JSDoc */;
|
|
28721
28736
|
}
|
|
28722
28737
|
ts.isJSDoc = isJSDoc;
|
|
28723
28738
|
function isJSDocTypeLiteral(node) {
|
|
@@ -30342,7 +30357,7 @@ var ts;
|
|
|
30342
30357
|
case 316 /* JSDocFunctionType */:
|
|
30343
30358
|
return visitNodes(cbNode, cbNodes, node.parameters) ||
|
|
30344
30359
|
visitNode(cbNode, node.type);
|
|
30345
|
-
case 319 /*
|
|
30360
|
+
case 319 /* JSDoc */:
|
|
30346
30361
|
return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))
|
|
30347
30362
|
|| visitNodes(cbNode, cbNodes, node.tags);
|
|
30348
30363
|
case 345 /* JSDocSeeTag */:
|
|
@@ -47656,6 +47671,8 @@ var ts;
|
|
|
47656
47671
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
47657
47672
|
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
47658
47673
|
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
47674
|
+
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
47675
|
+
var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }); // replace all type parameters with the unique literal type (disregarding constraints)
|
|
47659
47676
|
var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
47660
47677
|
var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
47661
47678
|
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
|
|
@@ -48594,7 +48611,7 @@ var ts;
|
|
|
48594
48611
|
// - parameters are only in the scope of function body
|
|
48595
48612
|
// This restriction does not apply to JSDoc comment types because they are parented
|
|
48596
48613
|
// at a higher level than type parameters would normally be
|
|
48597
|
-
if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 319 /*
|
|
48614
|
+
if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 319 /* JSDoc */) {
|
|
48598
48615
|
useResult = result.flags & 262144 /* TypeParameter */
|
|
48599
48616
|
// type parameters are visible in parameter list, return type and type parameter list
|
|
48600
48617
|
? lastLocation === location.type ||
|
|
@@ -51560,10 +51577,16 @@ var ts;
|
|
|
51560
51577
|
var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
|
|
51561
51578
|
var questionToken = type.declaration.questionToken ? ts.factory.createToken(type.declaration.questionToken.kind) : undefined;
|
|
51562
51579
|
var appropriateConstraintTypeNode;
|
|
51580
|
+
var newTypeVariable;
|
|
51563
51581
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
51564
51582
|
// We have a { [P in keyof T]: X }
|
|
51565
51583
|
// We do this to ensure we retain the toplevel keyof-ness of the type which may be lost due to keyof distribution during `getConstraintTypeFromMappedType`
|
|
51566
|
-
|
|
51584
|
+
if (!(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
51585
|
+
var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
51586
|
+
var name = typeParameterToName(newParam, context);
|
|
51587
|
+
newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
51588
|
+
}
|
|
51589
|
+
appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context));
|
|
51567
51590
|
}
|
|
51568
51591
|
else {
|
|
51569
51592
|
appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context);
|
|
@@ -51573,7 +51596,14 @@ var ts;
|
|
|
51573
51596
|
var templateTypeNode = typeToTypeNodeHelper(removeMissingType(getTemplateTypeFromMappedType(type), !!(getMappedTypeModifiers(type) & 4 /* IncludeOptional */)), context);
|
|
51574
51597
|
var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, /*members*/ undefined);
|
|
51575
51598
|
context.approximateLength += 10;
|
|
51576
|
-
|
|
51599
|
+
var result = ts.setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
|
|
51600
|
+
if (isMappedTypeWithKeyofConstraintDeclaration(type) && !(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
51601
|
+
// homomorphic mapped type with a non-homomorphic naive inlining
|
|
51602
|
+
// wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting
|
|
51603
|
+
// type stays homomorphic
|
|
51604
|
+
return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(ts.factory.cloneNode(newTypeVariable.typeName))), result, ts.factory.createKeywordTypeNode(143 /* NeverKeyword */));
|
|
51605
|
+
}
|
|
51606
|
+
return result;
|
|
51577
51607
|
}
|
|
51578
51608
|
function createAnonymousTypeNode(type) {
|
|
51579
51609
|
var _a;
|
|
@@ -53194,7 +53224,7 @@ var ts;
|
|
|
53194
53224
|
// If it's a class/interface/function: emit a class/interface/function with a `default` modifier
|
|
53195
53225
|
// These forms can merge, eg (`export default 12; export default interface A {}`)
|
|
53196
53226
|
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) {
|
|
53197
|
-
var _a, _b;
|
|
53227
|
+
var _a, _b, _c, _d;
|
|
53198
53228
|
var symbolName = ts.unescapeLeadingUnderscores(symbol.escapedName);
|
|
53199
53229
|
var isDefault = symbol.escapedName === "default" /* Default */;
|
|
53200
53230
|
if (isPrivate && !(context.flags & 131072 /* AllowAnonymousIdentifier */) && ts.isStringANonContextualKeyword(symbolName) && !isDefault) {
|
|
@@ -53245,17 +53275,21 @@ var ts;
|
|
|
53245
53275
|
else {
|
|
53246
53276
|
// A Class + Property merge is made for a `module.exports.Member = class {}`, and it doesn't serialize well as either a class _or_ a property symbol - in fact, _it behaves like an alias!_
|
|
53247
53277
|
// `var` is `FunctionScopedVariable`, `const` and `let` are `BlockScopedVariable`, and `module.exports.thing =` is `Property`
|
|
53248
|
-
var flags = !(symbol.flags & 2 /* BlockScopedVariable */)
|
|
53249
|
-
:
|
|
53278
|
+
var flags = !(symbol.flags & 2 /* BlockScopedVariable */)
|
|
53279
|
+
? ((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.valueDeclaration) && ts.isSourceFile((_b = symbol.parent) === null || _b === void 0 ? void 0 : _b.valueDeclaration)
|
|
53280
|
+
? 2 /* Const */
|
|
53281
|
+
: undefined
|
|
53282
|
+
: isConstVariable(symbol)
|
|
53283
|
+
? 2 /* Const */
|
|
53250
53284
|
: 1 /* Let */;
|
|
53251
53285
|
var name = (needsPostExportDefault || !(symbol.flags & 4 /* Property */)) ? localName : getUnusedName(localName, symbol);
|
|
53252
53286
|
var textRange = symbol.declarations && ts.find(symbol.declarations, function (d) { return ts.isVariableDeclaration(d); });
|
|
53253
53287
|
if (textRange && ts.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) {
|
|
53254
53288
|
textRange = textRange.parent.parent;
|
|
53255
53289
|
}
|
|
53256
|
-
var propertyAccessRequire = (
|
|
53290
|
+
var propertyAccessRequire = (_c = symbol.declarations) === null || _c === void 0 ? void 0 : _c.find(ts.isPropertyAccessExpression);
|
|
53257
53291
|
if (propertyAccessRequire && ts.isBinaryExpression(propertyAccessRequire.parent) && ts.isIdentifier(propertyAccessRequire.parent.right)
|
|
53258
|
-
&& ((
|
|
53292
|
+
&& ((_d = type.symbol) === null || _d === void 0 ? void 0 : _d.valueDeclaration) && ts.isSourceFile(type.symbol.valueDeclaration)) {
|
|
53259
53293
|
var alias = localName === propertyAccessRequire.parent.right.escapedText ? undefined : propertyAccessRequire.parent.right;
|
|
53260
53294
|
addResult(ts.factory.createExportDeclaration(
|
|
53261
53295
|
/*decorators*/ undefined,
|
|
@@ -53335,8 +53369,8 @@ var ts;
|
|
|
53335
53369
|
// synthesize export * from "moduleReference"
|
|
53336
53370
|
// Straightforward - only one thing to do - make an export declaration
|
|
53337
53371
|
if (symbol.declarations) {
|
|
53338
|
-
for (var _i = 0,
|
|
53339
|
-
var node =
|
|
53372
|
+
for (var _i = 0, _e = symbol.declarations; _i < _e.length; _i++) {
|
|
53373
|
+
var node = _e[_i];
|
|
53340
53374
|
var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
53341
53375
|
if (!resolvedModule)
|
|
53342
53376
|
continue;
|
|
@@ -55142,7 +55176,10 @@ var ts;
|
|
|
55142
55176
|
if (containsSameNamedThisProperty(expression.left, expression.right)) {
|
|
55143
55177
|
return anyType;
|
|
55144
55178
|
}
|
|
55145
|
-
var
|
|
55179
|
+
var isDirectExport = kind === 1 /* ExportsProperty */ && (ts.isPropertyAccessExpression(expression.left) || ts.isElementAccessExpression(expression.left)) && (ts.isModuleExportsAccessExpression(expression.left.expression) || (ts.isIdentifier(expression.left.expression) && ts.isExportsIdentifier(expression.left.expression)));
|
|
55180
|
+
var type = resolvedSymbol ? getTypeOfSymbol(resolvedSymbol)
|
|
55181
|
+
: isDirectExport ? getRegularTypeOfLiteralType(checkExpressionCached(expression.right))
|
|
55182
|
+
: getWidenedLiteralType(checkExpressionCached(expression.right));
|
|
55146
55183
|
if (type.flags & 524288 /* Object */ &&
|
|
55147
55184
|
kind === 2 /* ModuleExports */ &&
|
|
55148
55185
|
symbol.escapedName === "export=" /* ExportEquals */) {
|
|
@@ -55886,7 +55923,7 @@ var ts;
|
|
|
55886
55923
|
node = paramSymbol.valueDeclaration;
|
|
55887
55924
|
}
|
|
55888
55925
|
break;
|
|
55889
|
-
case 319 /*
|
|
55926
|
+
case 319 /* JSDoc */: {
|
|
55890
55927
|
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
|
|
55891
55928
|
return node.tags
|
|
55892
55929
|
? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; }))
|
|
@@ -58147,10 +58184,10 @@ var ts;
|
|
|
58147
58184
|
else if (type !== firstType) {
|
|
58148
58185
|
checkFlags |= 64 /* HasNonUniformType */;
|
|
58149
58186
|
}
|
|
58150
|
-
if (isLiteralType(type) || isPatternLiteralType(type)) {
|
|
58187
|
+
if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
|
|
58151
58188
|
checkFlags |= 128 /* HasLiteralType */;
|
|
58152
58189
|
}
|
|
58153
|
-
if (type.flags & 131072 /* Never */) {
|
|
58190
|
+
if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
|
|
58154
58191
|
checkFlags |= 131072 /* HasNeverType */;
|
|
58155
58192
|
}
|
|
58156
58193
|
propTypes.push(type);
|
|
@@ -59335,7 +59372,7 @@ var ts;
|
|
|
59335
59372
|
function getConditionalFlowTypeOfType(type, node) {
|
|
59336
59373
|
var constraints;
|
|
59337
59374
|
var covariant = true;
|
|
59338
|
-
while (node && !ts.isStatement(node) && node.kind !== 319 /*
|
|
59375
|
+
while (node && !ts.isStatement(node) && node.kind !== 319 /* JSDoc */) {
|
|
59339
59376
|
var parent = node.parent;
|
|
59340
59377
|
// only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but
|
|
59341
59378
|
// often get used in indexed accesses where they behave sortof invariantly, but our checking is lax
|
|
@@ -60691,10 +60728,24 @@ var ts;
|
|
|
60691
60728
|
return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1 /* Literal */,
|
|
60692
60729
|
/*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, origin);
|
|
60693
60730
|
}
|
|
60731
|
+
/**
|
|
60732
|
+
* A union type which is reducible upon instantiation (meaning some members are removed under certain instantiations)
|
|
60733
|
+
* must be kept generic, as that instantiation information needs to flow through the type system. By replacing all
|
|
60734
|
+
* type parameters in the union with a special never type that is treated as a literal in `getReducedType`, we can cause the `getReducedType` logic
|
|
60735
|
+
* to reduce the resulting type if possible (since only intersections with conflicting literal-typed properties are reducible).
|
|
60736
|
+
*/
|
|
60737
|
+
function isPossiblyReducibleByInstantiation(type) {
|
|
60738
|
+
return ts.some(type.types, function (t) {
|
|
60739
|
+
var uniqueFilled = getUniqueLiteralFilledInstantiation(t);
|
|
60740
|
+
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
60741
|
+
});
|
|
60742
|
+
}
|
|
60694
60743
|
function getIndexType(type, stringsOnly, noIndexSignatures) {
|
|
60695
60744
|
if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
|
|
60696
60745
|
type = getReducedType(type);
|
|
60697
|
-
return type.flags & 1048576 /* Union */ ?
|
|
60746
|
+
return type.flags & 1048576 /* Union */ ? isPossiblyReducibleByInstantiation(type)
|
|
60747
|
+
? getIndexTypeForGenericType(type, stringsOnly)
|
|
60748
|
+
: getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
|
|
60698
60749
|
type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
|
|
60699
60750
|
type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
|
|
60700
60751
|
ts.getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) :
|
|
@@ -61322,6 +61373,10 @@ var ts;
|
|
|
61322
61373
|
}
|
|
61323
61374
|
return type;
|
|
61324
61375
|
}
|
|
61376
|
+
function maybeCloneTypeParameter(p) {
|
|
61377
|
+
var constraint = getConstraintOfTypeParameter(p);
|
|
61378
|
+
return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p;
|
|
61379
|
+
}
|
|
61325
61380
|
function isTypicalNondistributiveConditional(root) {
|
|
61326
61381
|
return !root.isDistributive && isSingletonTupleType(root.node.checkType) && isSingletonTupleType(root.node.extendsType);
|
|
61327
61382
|
}
|
|
@@ -61340,37 +61395,65 @@ var ts;
|
|
|
61340
61395
|
var result;
|
|
61341
61396
|
var extraTypes;
|
|
61342
61397
|
var tailCount = 0;
|
|
61343
|
-
|
|
61344
|
-
// types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
|
|
61345
|
-
// purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
|
|
61346
|
-
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
61347
|
-
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
61348
|
-
while (true) {
|
|
61398
|
+
var _loop_18 = function () {
|
|
61349
61399
|
if (tailCount === 1000) {
|
|
61350
61400
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
61351
61401
|
result = errorType;
|
|
61352
|
-
break;
|
|
61402
|
+
return "break";
|
|
61353
61403
|
}
|
|
61354
61404
|
var isUnwrapped = isTypicalNondistributiveConditional(root);
|
|
61355
61405
|
var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
|
|
61356
61406
|
var checkTypeInstantiable = isGenericType(checkType);
|
|
61357
61407
|
var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
|
|
61358
61408
|
if (checkType === wildcardType || extendsType === wildcardType) {
|
|
61359
|
-
return wildcardType;
|
|
61409
|
+
return { value: wildcardType };
|
|
61360
61410
|
}
|
|
61361
61411
|
var combinedMapper = void 0;
|
|
61362
61412
|
if (root.inferTypeParameters) {
|
|
61363
|
-
|
|
61364
|
-
|
|
61413
|
+
// When we're looking at making an inference for an infer type, when we get its constraint, it'll automagically be
|
|
61414
|
+
// instantiated with the context, so it doesn't need the mapper for the inference contex - however the constraint
|
|
61415
|
+
// may refer to another _root_, _uncloned_ `infer` type parameter [1], or to something mapped by `mapper` [2].
|
|
61416
|
+
// [1] Eg, if we have `Foo<T, U extends T>` and `Foo<number, infer B>` - `B` is constrained to `T`, which, in turn, has been instantiated
|
|
61417
|
+
// as `number`
|
|
61418
|
+
// Conversely, if we have `Foo<infer A, infer B>`, `B` is still constrained to `T` and `T` is instantiated as `A`
|
|
61419
|
+
// [2] Eg, if we have `Foo<T, U extends T>` and `Foo<Q, infer B>` where `Q` is mapped by `mapper` into `number` - `B` is constrained to `T`
|
|
61420
|
+
// which is in turn instantiated as `Q`, which is in turn instantiated as `number`.
|
|
61421
|
+
// So we need to:
|
|
61422
|
+
// * Clone the type parameters so their constraints can be instantiated in the context of `mapper` (otherwise theyd only get inference context information)
|
|
61423
|
+
// * Set the clones to both map the conditional's enclosing `mapper` and the original params
|
|
61424
|
+
// * instantiate the extends type with the clones
|
|
61425
|
+
// * incorporate all of the component mappers into the combined mapper for the true and false members
|
|
61426
|
+
// This means we have three mappers that need applying:
|
|
61427
|
+
// * The original `mapper` used to create this conditional
|
|
61428
|
+
// * The mapper that maps the old root type parameter to the clone (`freshMapper`)
|
|
61429
|
+
// * The mapper that maps the clone to its inference result (`context.mapper`)
|
|
61430
|
+
var freshParams = ts.sameMap(root.inferTypeParameters, maybeCloneTypeParameter);
|
|
61431
|
+
var freshMapper = freshParams !== root.inferTypeParameters ? createTypeMapper(root.inferTypeParameters, freshParams) : undefined;
|
|
61432
|
+
var context = createInferenceContext(freshParams, /*signature*/ undefined, 0 /* None */);
|
|
61433
|
+
if (freshMapper) {
|
|
61434
|
+
var freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
|
|
61435
|
+
for (var _i = 0, freshParams_1 = freshParams; _i < freshParams_1.length; _i++) {
|
|
61436
|
+
var p = freshParams_1[_i];
|
|
61437
|
+
if (root.inferTypeParameters.indexOf(p) === -1) {
|
|
61438
|
+
p.mapper = freshCombinedMapper;
|
|
61439
|
+
}
|
|
61440
|
+
}
|
|
61441
|
+
}
|
|
61442
|
+
// We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type
|
|
61443
|
+
// if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to
|
|
61444
|
+
// "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint
|
|
61445
|
+
// so in those cases we refain from performing inference and retain the uninfered type parameter
|
|
61446
|
+
if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) {
|
|
61365
61447
|
// We don't want inferences from constraints as they may cause us to eagerly resolve the
|
|
61366
61448
|
// conditional type instead of deferring resolution. Also, we always want strict function
|
|
61367
61449
|
// types rules (i.e. proper contravariance) for inferences.
|
|
61368
|
-
inferTypes(context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
61450
|
+
inferTypes(context.inferences, checkType, instantiateType(extendsType, freshMapper), 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
61369
61451
|
}
|
|
61452
|
+
var innerMapper = combineTypeMappers(freshMapper, context.mapper);
|
|
61370
61453
|
// It's possible for 'infer T' type paramteters to be given uninstantiated constraints when the
|
|
61371
61454
|
// those type parameters are used in type references (see getInferredTypeParameterConstraint). For
|
|
61372
61455
|
// that reason we need context.mapper to be first in the combined mapper. See #42636 for examples.
|
|
61373
|
-
combinedMapper = mapper ? combineTypeMappers(
|
|
61456
|
+
combinedMapper = mapper ? combineTypeMappers(innerMapper, mapper) : innerMapper;
|
|
61374
61457
|
}
|
|
61375
61458
|
// Instantiate the extends type including inferences for 'infer T' type parameters
|
|
61376
61459
|
var inferredExtendsType = combinedMapper ? instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), combinedMapper) : extendsType;
|
|
@@ -61392,14 +61475,14 @@ var ts;
|
|
|
61392
61475
|
var newRoot = falseType_1.root;
|
|
61393
61476
|
if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
|
|
61394
61477
|
root = newRoot;
|
|
61395
|
-
continue;
|
|
61478
|
+
return "continue";
|
|
61396
61479
|
}
|
|
61397
61480
|
if (canTailRecurse(falseType_1, mapper)) {
|
|
61398
|
-
continue;
|
|
61481
|
+
return "continue";
|
|
61399
61482
|
}
|
|
61400
61483
|
}
|
|
61401
61484
|
result = instantiateType(falseType_1, mapper);
|
|
61402
|
-
break;
|
|
61485
|
+
return "break";
|
|
61403
61486
|
}
|
|
61404
61487
|
// Return trueType for a definitely true extends check. We check instantiations of the two
|
|
61405
61488
|
// types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
|
|
@@ -61410,10 +61493,10 @@ var ts;
|
|
|
61410
61493
|
var trueType_1 = getTypeFromTypeNode(root.node.trueType);
|
|
61411
61494
|
var trueMapper = combinedMapper || mapper;
|
|
61412
61495
|
if (canTailRecurse(trueType_1, trueMapper)) {
|
|
61413
|
-
continue;
|
|
61496
|
+
return "continue";
|
|
61414
61497
|
}
|
|
61415
61498
|
result = instantiateType(trueType_1, trueMapper);
|
|
61416
|
-
break;
|
|
61499
|
+
return "break";
|
|
61417
61500
|
}
|
|
61418
61501
|
}
|
|
61419
61502
|
// Return a deferred type for a check that is neither definitely true nor definitely false
|
|
@@ -61425,7 +61508,19 @@ var ts;
|
|
|
61425
61508
|
result.combinedMapper = combinedMapper;
|
|
61426
61509
|
result.aliasSymbol = aliasSymbol || root.aliasSymbol;
|
|
61427
61510
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
|
|
61428
|
-
break;
|
|
61511
|
+
return "break";
|
|
61512
|
+
};
|
|
61513
|
+
// We loop here for an immediately nested conditional type in the false position, effectively treating
|
|
61514
|
+
// types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
|
|
61515
|
+
// purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
|
|
61516
|
+
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
61517
|
+
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
61518
|
+
while (true) {
|
|
61519
|
+
var state_5 = _loop_18();
|
|
61520
|
+
if (typeof state_5 === "object")
|
|
61521
|
+
return state_5.value;
|
|
61522
|
+
if (state_5 === "break")
|
|
61523
|
+
break;
|
|
61429
61524
|
}
|
|
61430
61525
|
return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
|
|
61431
61526
|
// We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and
|
|
@@ -61847,9 +61942,11 @@ var ts;
|
|
|
61847
61942
|
}
|
|
61848
61943
|
function getESSymbolLikeTypeForNode(node) {
|
|
61849
61944
|
if (ts.isValidESSymbolDeclaration(node)) {
|
|
61850
|
-
var symbol = getSymbolOfNode(node);
|
|
61851
|
-
|
|
61852
|
-
|
|
61945
|
+
var symbol = ts.isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode(node.left) : getSymbolOfNode(node);
|
|
61946
|
+
if (symbol) {
|
|
61947
|
+
var links = getSymbolLinks(symbol);
|
|
61948
|
+
return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol));
|
|
61949
|
+
}
|
|
61853
61950
|
}
|
|
61854
61951
|
return esSymbolType;
|
|
61855
61952
|
}
|
|
@@ -62493,6 +62590,10 @@ var ts;
|
|
|
62493
62590
|
}
|
|
62494
62591
|
return type; // Nested invocation of `inferTypeForHomomorphicMappedType` or the `source` instantiated into something unmappable
|
|
62495
62592
|
}
|
|
62593
|
+
function getUniqueLiteralFilledInstantiation(type) {
|
|
62594
|
+
return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type :
|
|
62595
|
+
type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
62596
|
+
}
|
|
62496
62597
|
function getPermissiveInstantiation(type) {
|
|
62497
62598
|
return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type :
|
|
62498
62599
|
type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
@@ -63952,7 +64053,7 @@ var ts;
|
|
|
63952
64053
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
63953
64054
|
checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
|
|
63954
64055
|
}
|
|
63955
|
-
var
|
|
64056
|
+
var _loop_19 = function (prop) {
|
|
63956
64057
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
63957
64058
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
63958
64059
|
if (reportErrors) {
|
|
@@ -64015,9 +64116,9 @@ var ts;
|
|
|
64015
64116
|
};
|
|
64016
64117
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
64017
64118
|
var prop = _b[_i];
|
|
64018
|
-
var
|
|
64019
|
-
if (typeof
|
|
64020
|
-
return
|
|
64119
|
+
var state_6 = _loop_19(prop);
|
|
64120
|
+
if (typeof state_6 === "object")
|
|
64121
|
+
return state_6.value;
|
|
64021
64122
|
}
|
|
64022
64123
|
return false;
|
|
64023
64124
|
}
|
|
@@ -65007,11 +65108,11 @@ var ts;
|
|
|
65007
65108
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
65008
65109
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
65009
65110
|
var matchingTypes = [];
|
|
65010
|
-
var
|
|
65111
|
+
var _loop_20 = function (combination) {
|
|
65011
65112
|
var hasMatch = false;
|
|
65012
65113
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
65013
65114
|
var type = _d[_c];
|
|
65014
|
-
var
|
|
65115
|
+
var _loop_21 = function (i) {
|
|
65015
65116
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
65016
65117
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
65017
65118
|
if (!targetProperty)
|
|
@@ -65027,8 +65128,8 @@ var ts;
|
|
|
65027
65128
|
}
|
|
65028
65129
|
};
|
|
65029
65130
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
65030
|
-
var
|
|
65031
|
-
switch (
|
|
65131
|
+
var state_8 = _loop_21(i);
|
|
65132
|
+
switch (state_8) {
|
|
65032
65133
|
case "continue-outer": continue outer;
|
|
65033
65134
|
}
|
|
65034
65135
|
}
|
|
@@ -65041,9 +65142,9 @@ var ts;
|
|
|
65041
65142
|
};
|
|
65042
65143
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
65043
65144
|
var combination = discriminantCombinations_1[_a];
|
|
65044
|
-
var
|
|
65045
|
-
if (typeof
|
|
65046
|
-
return
|
|
65145
|
+
var state_7 = _loop_20(combination);
|
|
65146
|
+
if (typeof state_7 === "object")
|
|
65147
|
+
return state_7.value;
|
|
65047
65148
|
}
|
|
65048
65149
|
// Compare the remaining non-discriminant properties of each match.
|
|
65049
65150
|
var result = -1 /* True */;
|
|
@@ -65756,7 +65857,7 @@ var ts;
|
|
|
65756
65857
|
// The emptyArray singleton is used to signal a recursive invocation.
|
|
65757
65858
|
cache.variances = ts.emptyArray;
|
|
65758
65859
|
variances = [];
|
|
65759
|
-
var
|
|
65860
|
+
var _loop_22 = function (tp) {
|
|
65760
65861
|
var unmeasurable = false;
|
|
65761
65862
|
var unreliable = false;
|
|
65762
65863
|
var oldHandler = outofbandVarianceMarkerHandler;
|
|
@@ -65788,7 +65889,7 @@ var ts;
|
|
|
65788
65889
|
};
|
|
65789
65890
|
for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
|
|
65790
65891
|
var tp = typeParameters_1[_i];
|
|
65791
|
-
|
|
65892
|
+
_loop_22(tp);
|
|
65792
65893
|
}
|
|
65793
65894
|
cache.variances = variances;
|
|
65794
65895
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -68159,7 +68260,7 @@ var ts;
|
|
|
68159
68260
|
function mapTypesByKeyProperty(types, name) {
|
|
68160
68261
|
var map = new ts.Map();
|
|
68161
68262
|
var count = 0;
|
|
68162
|
-
var
|
|
68263
|
+
var _loop_23 = function (type) {
|
|
68163
68264
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
68164
68265
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
68165
68266
|
if (discriminant) {
|
|
@@ -68185,9 +68286,9 @@ var ts;
|
|
|
68185
68286
|
};
|
|
68186
68287
|
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
|
68187
68288
|
var type = types_16[_i];
|
|
68188
|
-
var
|
|
68189
|
-
if (typeof
|
|
68190
|
-
return
|
|
68289
|
+
var state_9 = _loop_23(type);
|
|
68290
|
+
if (typeof state_9 === "object")
|
|
68291
|
+
return state_9.value;
|
|
68191
68292
|
}
|
|
68192
68293
|
return count >= 10 && count * 2 >= types.length ? map : undefined;
|
|
68193
68294
|
}
|
|
@@ -74518,7 +74619,7 @@ var ts;
|
|
|
74518
74619
|
if (spreadIndex >= 0) {
|
|
74519
74620
|
// Create synthetic arguments from spreads of tuple types.
|
|
74520
74621
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
74521
|
-
var
|
|
74622
|
+
var _loop_24 = function (i) {
|
|
74522
74623
|
var arg = args[i];
|
|
74523
74624
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
74524
74625
|
var spreadType = arg.kind === 224 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -74535,7 +74636,7 @@ var ts;
|
|
|
74535
74636
|
}
|
|
74536
74637
|
};
|
|
74537
74638
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
74538
|
-
|
|
74639
|
+
_loop_24(i);
|
|
74539
74640
|
}
|
|
74540
74641
|
return effectiveArgs_1;
|
|
74541
74642
|
}
|
|
@@ -74848,7 +74949,7 @@ var ts;
|
|
|
74848
74949
|
var min_3 = Number.MAX_VALUE;
|
|
74849
74950
|
var minIndex = 0;
|
|
74850
74951
|
var i_1 = 0;
|
|
74851
|
-
var
|
|
74952
|
+
var _loop_25 = function (c) {
|
|
74852
74953
|
var chain_2 = function () { return ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Overload_0_of_1_2_gave_the_following_error, i_1 + 1, candidates.length, signatureToString(c)); };
|
|
74853
74954
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
|
|
74854
74955
|
if (diags_2) {
|
|
@@ -74866,7 +74967,7 @@ var ts;
|
|
|
74866
74967
|
};
|
|
74867
74968
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
74868
74969
|
var c = candidatesForArgumentError_1[_a];
|
|
74869
|
-
|
|
74970
|
+
_loop_25(c);
|
|
74870
74971
|
}
|
|
74871
74972
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
74872
74973
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -75024,7 +75125,7 @@ var ts;
|
|
|
75024
75125
|
}
|
|
75025
75126
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
75026
75127
|
var parameters = [];
|
|
75027
|
-
var
|
|
75128
|
+
var _loop_26 = function (i) {
|
|
75028
75129
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
75029
75130
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
75030
75131
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -75032,7 +75133,7 @@ var ts;
|
|
|
75032
75133
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
75033
75134
|
};
|
|
75034
75135
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
75035
|
-
|
|
75136
|
+
_loop_26(i);
|
|
75036
75137
|
}
|
|
75037
75138
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
75038
75139
|
var flags = 0 /* None */;
|
|
@@ -78259,7 +78360,7 @@ var ts;
|
|
|
78259
78360
|
}
|
|
78260
78361
|
function checkExpressionForMutableLocation(node, checkMode, contextualType, forceTuple) {
|
|
78261
78362
|
var type = checkExpression(node, checkMode, forceTuple);
|
|
78262
|
-
return isConstContext(node) ? getRegularTypeOfLiteralType(type) :
|
|
78363
|
+
return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
|
|
78263
78364
|
isTypeAssertion(node) ? type :
|
|
78264
78365
|
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
|
|
78265
78366
|
}
|
|
@@ -79028,7 +79129,7 @@ var ts;
|
|
|
79028
79129
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
79029
79130
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
79030
79131
|
var indexSignatureMap_1 = new ts.Map();
|
|
79031
|
-
var
|
|
79132
|
+
var _loop_27 = function (declaration) {
|
|
79032
79133
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
79033
79134
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
79034
79135
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -79043,7 +79144,7 @@ var ts;
|
|
|
79043
79144
|
};
|
|
79044
79145
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
79045
79146
|
var declaration = _a[_i];
|
|
79046
|
-
|
|
79147
|
+
_loop_27(declaration);
|
|
79047
79148
|
}
|
|
79048
79149
|
indexSignatureMap_1.forEach(function (entry) {
|
|
79049
79150
|
if (entry.declarations.length > 1) {
|
|
@@ -82422,7 +82523,7 @@ var ts;
|
|
|
82422
82523
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 257 /* InterfaceDeclaration */) : undefined;
|
|
82423
82524
|
var localPropDeclaration = declaration && declaration.kind === 220 /* BinaryExpression */ ||
|
|
82424
82525
|
name && name.kind === 161 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
82425
|
-
var
|
|
82526
|
+
var _loop_28 = function (info) {
|
|
82426
82527
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
82427
82528
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
82428
82529
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -82435,7 +82536,7 @@ var ts;
|
|
|
82435
82536
|
};
|
|
82436
82537
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
82437
82538
|
var info = indexInfos_9[_i];
|
|
82438
|
-
|
|
82539
|
+
_loop_28(info);
|
|
82439
82540
|
}
|
|
82440
82541
|
}
|
|
82441
82542
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -82443,7 +82544,7 @@ var ts;
|
|
|
82443
82544
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
82444
82545
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 257 /* InterfaceDeclaration */) : undefined;
|
|
82445
82546
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
82446
|
-
var
|
|
82547
|
+
var _loop_29 = function (info) {
|
|
82447
82548
|
if (info === checkInfo)
|
|
82448
82549
|
return "continue";
|
|
82449
82550
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -82458,7 +82559,7 @@ var ts;
|
|
|
82458
82559
|
};
|
|
82459
82560
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
82460
82561
|
var info = indexInfos_10[_i];
|
|
82461
|
-
|
|
82562
|
+
_loop_29(info);
|
|
82462
82563
|
}
|
|
82463
82564
|
}
|
|
82464
82565
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -82769,7 +82870,7 @@ var ts;
|
|
|
82769
82870
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
82770
82871
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
82771
82872
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
82772
|
-
var
|
|
82873
|
+
var _loop_30 = function (member) {
|
|
82773
82874
|
if (ts.hasAmbientModifier(member)) {
|
|
82774
82875
|
return "continue";
|
|
82775
82876
|
}
|
|
@@ -82786,7 +82887,7 @@ var ts;
|
|
|
82786
82887
|
};
|
|
82787
82888
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
82788
82889
|
var member = _a[_i];
|
|
82789
|
-
|
|
82890
|
+
_loop_30(member);
|
|
82790
82891
|
}
|
|
82791
82892
|
}
|
|
82792
82893
|
/**
|
|
@@ -82874,7 +82975,7 @@ var ts;
|
|
|
82874
82975
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
82875
82976
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
82876
82977
|
var issuedMemberError = false;
|
|
82877
|
-
var
|
|
82978
|
+
var _loop_31 = function (member) {
|
|
82878
82979
|
if (ts.isStatic(member)) {
|
|
82879
82980
|
return "continue";
|
|
82880
82981
|
}
|
|
@@ -82893,7 +82994,7 @@ var ts;
|
|
|
82893
82994
|
};
|
|
82894
82995
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
82895
82996
|
var member = _a[_i];
|
|
82896
|
-
|
|
82997
|
+
_loop_31(member);
|
|
82897
82998
|
}
|
|
82898
82999
|
if (!issuedMemberError) {
|
|
82899
83000
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -109858,7 +109959,7 @@ var ts;
|
|
|
109858
109959
|
return emitRestOrJSDocVariadicType(node);
|
|
109859
109960
|
case 318 /* JSDocNamepathType */:
|
|
109860
109961
|
return;
|
|
109861
|
-
case 319 /*
|
|
109962
|
+
case 319 /* JSDoc */:
|
|
109862
109963
|
return emitJSDoc(node);
|
|
109863
109964
|
case 321 /* JSDocTypeLiteral */:
|
|
109864
109965
|
return emitJSDocTypeLiteral(node);
|
|
@@ -120680,7 +120781,7 @@ var ts;
|
|
|
120680
120781
|
});
|
|
120681
120782
|
// Sort by paths closest to importing file Name directory
|
|
120682
120783
|
var sortedPaths = [];
|
|
120683
|
-
var
|
|
120784
|
+
var _loop_32 = function (directory) {
|
|
120684
120785
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
120685
120786
|
var pathsInDirectory;
|
|
120686
120787
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -120704,9 +120805,9 @@ var ts;
|
|
|
120704
120805
|
};
|
|
120705
120806
|
var out_directory_1;
|
|
120706
120807
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
120707
|
-
var
|
|
120808
|
+
var state_10 = _loop_32(directory);
|
|
120708
120809
|
directory = out_directory_1;
|
|
120709
|
-
if (
|
|
120810
|
+
if (state_10 === "break")
|
|
120710
120811
|
break;
|
|
120711
120812
|
}
|
|
120712
120813
|
if (allFileNames.size) {
|