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
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20220310";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -4358,6 +4358,7 @@ var ts;
|
|
|
4358
4358
|
SyntaxKind[SyntaxKind["JSDocFunctionType"] = 316] = "JSDocFunctionType";
|
|
4359
4359
|
SyntaxKind[SyntaxKind["JSDocVariadicType"] = 317] = "JSDocVariadicType";
|
|
4360
4360
|
SyntaxKind[SyntaxKind["JSDocNamepathType"] = 318] = "JSDocNamepathType";
|
|
4361
|
+
/** @deprecated Use SyntaxKind.JSDoc */
|
|
4361
4362
|
SyntaxKind[SyntaxKind["JSDocComment"] = 319] = "JSDocComment";
|
|
4362
4363
|
SyntaxKind[SyntaxKind["JSDocText"] = 320] = "JSDocText";
|
|
4363
4364
|
SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 321] = "JSDocTypeLiteral";
|
|
@@ -4431,6 +4432,7 @@ var ts;
|
|
|
4431
4432
|
SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 346] = "LastJSDocTagNode";
|
|
4432
4433
|
/* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword";
|
|
4433
4434
|
/* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 159] = "LastContextualKeyword";
|
|
4435
|
+
SyntaxKind[SyntaxKind["JSDoc"] = 319] = "JSDoc";
|
|
4434
4436
|
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
|
|
4435
4437
|
var NodeFlags;
|
|
4436
4438
|
(function (NodeFlags) {
|
|
@@ -13027,7 +13029,7 @@ var ts;
|
|
|
13027
13029
|
return ts.emptyArray;
|
|
13028
13030
|
}
|
|
13029
13031
|
if (ts.isJSDocTypeAlias(node)) {
|
|
13030
|
-
ts.Debug.assert(node.parent.kind === 319 /*
|
|
13032
|
+
ts.Debug.assert(node.parent.kind === 319 /* JSDoc */);
|
|
13031
13033
|
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
|
|
13032
13034
|
}
|
|
13033
13035
|
if (node.typeParameters) {
|
|
@@ -13974,7 +13976,7 @@ var ts;
|
|
|
13974
13976
|
ts.isJSDocNode = isJSDocNode;
|
|
13975
13977
|
/** True if node is of a kind that may contain comment text. */
|
|
13976
13978
|
function isJSDocCommentContainingNode(node) {
|
|
13977
|
-
return node.kind === 319 /*
|
|
13979
|
+
return node.kind === 319 /* JSDoc */
|
|
13978
13980
|
|| node.kind === 318 /* JSDocNamepathType */
|
|
13979
13981
|
|| node.kind === 320 /* JSDocText */
|
|
13980
13982
|
|| isJSDocLinkLike(node)
|
|
@@ -15539,10 +15541,23 @@ var ts;
|
|
|
15539
15541
|
&& node.parent.parent.kind === 236 /* VariableStatement */;
|
|
15540
15542
|
}
|
|
15541
15543
|
ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
|
|
15544
|
+
function isCommonJsExportedExpression(node) {
|
|
15545
|
+
if (!isInJSFile(node))
|
|
15546
|
+
return false;
|
|
15547
|
+
return (ts.isObjectLiteralExpression(node.parent) && ts.isBinaryExpression(node.parent.parent) && getAssignmentDeclarationKind(node.parent.parent) === 2 /* ModuleExports */) ||
|
|
15548
|
+
isCommonJsExportPropertyAssignment(node.parent);
|
|
15549
|
+
}
|
|
15550
|
+
ts.isCommonJsExportedExpression = isCommonJsExportedExpression;
|
|
15551
|
+
function isCommonJsExportPropertyAssignment(node) {
|
|
15552
|
+
if (!isInJSFile(node))
|
|
15553
|
+
return false;
|
|
15554
|
+
return (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 1 /* ExportsProperty */);
|
|
15555
|
+
}
|
|
15556
|
+
ts.isCommonJsExportPropertyAssignment = isCommonJsExportPropertyAssignment;
|
|
15542
15557
|
function isValidESSymbolDeclaration(node) {
|
|
15543
|
-
return ts.isVariableDeclaration(node) ? isVarConst(node) && ts.isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) :
|
|
15558
|
+
return (ts.isVariableDeclaration(node) ? isVarConst(node) && ts.isIdentifier(node.name) && isVariableDeclarationInVariableStatement(node) :
|
|
15544
15559
|
ts.isPropertyDeclaration(node) ? hasEffectiveReadonlyModifier(node) && hasStaticModifier(node) :
|
|
15545
|
-
ts.isPropertySignature(node) && hasEffectiveReadonlyModifier(node);
|
|
15560
|
+
ts.isPropertySignature(node) && hasEffectiveReadonlyModifier(node)) || isCommonJsExportPropertyAssignment(node);
|
|
15546
15561
|
}
|
|
15547
15562
|
ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
|
|
15548
15563
|
function introducesArgumentsExoticObject(node) {
|
|
@@ -18436,7 +18451,7 @@ var ts;
|
|
|
18436
18451
|
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
|
|
18437
18452
|
/** template tags are only available when a typedef isn't already using them */
|
|
18438
18453
|
function isNonTypeAliasTemplate(tag) {
|
|
18439
|
-
return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 319 /*
|
|
18454
|
+
return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 319 /* JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias));
|
|
18440
18455
|
}
|
|
18441
18456
|
/**
|
|
18442
18457
|
* Gets the effective type annotation of the value parameter of a set accessor. If the node
|
|
@@ -25413,7 +25428,7 @@ var ts;
|
|
|
25413
25428
|
}
|
|
25414
25429
|
// @api
|
|
25415
25430
|
function createJSDocComment(comment, tags) {
|
|
25416
|
-
var node = createBaseNode(319 /*
|
|
25431
|
+
var node = createBaseNode(319 /* JSDoc */);
|
|
25417
25432
|
node.comment = comment;
|
|
25418
25433
|
node.tags = asNodeArray(tags);
|
|
25419
25434
|
return node;
|
|
@@ -28922,7 +28937,7 @@ var ts;
|
|
|
28922
28937
|
}
|
|
28923
28938
|
ts.isJSDocNamepathType = isJSDocNamepathType;
|
|
28924
28939
|
function isJSDoc(node) {
|
|
28925
|
-
return node.kind === 319 /*
|
|
28940
|
+
return node.kind === 319 /* JSDoc */;
|
|
28926
28941
|
}
|
|
28927
28942
|
ts.isJSDoc = isJSDoc;
|
|
28928
28943
|
function isJSDocTypeLiteral(node) {
|
|
@@ -30547,7 +30562,7 @@ var ts;
|
|
|
30547
30562
|
case 316 /* JSDocFunctionType */:
|
|
30548
30563
|
return visitNodes(cbNode, cbNodes, node.parameters) ||
|
|
30549
30564
|
visitNode(cbNode, node.type);
|
|
30550
|
-
case 319 /*
|
|
30565
|
+
case 319 /* JSDoc */:
|
|
30551
30566
|
return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))
|
|
30552
30567
|
|| visitNodes(cbNode, cbNodes, node.tags);
|
|
30553
30568
|
case 345 /* JSDocSeeTag */:
|
|
@@ -47861,6 +47876,8 @@ var ts;
|
|
|
47861
47876
|
var templateConstraintType = getUnionType([stringType, numberType, booleanType, bigintType, nullType, undefinedType]);
|
|
47862
47877
|
var restrictiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? getRestrictiveTypeParameter(t) : t; });
|
|
47863
47878
|
var permissiveMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? wildcardType : t; });
|
|
47879
|
+
var uniqueLiteralType = createIntrinsicType(131072 /* Never */, "never"); // `uniqueLiteralType` is a special `never` flagged by union reduction to behave as a literal
|
|
47880
|
+
var uniqueLiteralMapper = makeFunctionTypeMapper(function (t) { return t.flags & 262144 /* TypeParameter */ ? uniqueLiteralType : t; }); // replace all type parameters with the unique literal type (disregarding constraints)
|
|
47864
47881
|
var emptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
47865
47882
|
var emptyJsxObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray);
|
|
47866
47883
|
emptyJsxObjectType.objectFlags |= 2048 /* JsxAttributes */;
|
|
@@ -48799,7 +48816,7 @@ var ts;
|
|
|
48799
48816
|
// - parameters are only in the scope of function body
|
|
48800
48817
|
// This restriction does not apply to JSDoc comment types because they are parented
|
|
48801
48818
|
// at a higher level than type parameters would normally be
|
|
48802
|
-
if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 319 /*
|
|
48819
|
+
if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 319 /* JSDoc */) {
|
|
48803
48820
|
useResult = result.flags & 262144 /* TypeParameter */
|
|
48804
48821
|
// type parameters are visible in parameter list, return type and type parameter list
|
|
48805
48822
|
? lastLocation === location.type ||
|
|
@@ -51765,10 +51782,16 @@ var ts;
|
|
|
51765
51782
|
var readonlyToken = type.declaration.readonlyToken ? ts.factory.createToken(type.declaration.readonlyToken.kind) : undefined;
|
|
51766
51783
|
var questionToken = type.declaration.questionToken ? ts.factory.createToken(type.declaration.questionToken.kind) : undefined;
|
|
51767
51784
|
var appropriateConstraintTypeNode;
|
|
51785
|
+
var newTypeVariable;
|
|
51768
51786
|
if (isMappedTypeWithKeyofConstraintDeclaration(type)) {
|
|
51769
51787
|
// We have a { [P in keyof T]: X }
|
|
51770
51788
|
// We do this to ensure we retain the toplevel keyof-ness of the type which may be lost due to keyof distribution during `getConstraintTypeFromMappedType`
|
|
51771
|
-
|
|
51789
|
+
if (!(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
51790
|
+
var newParam = createTypeParameter(createSymbol(262144 /* TypeParameter */, "T"));
|
|
51791
|
+
var name = typeParameterToName(newParam, context);
|
|
51792
|
+
newTypeVariable = ts.factory.createTypeReferenceNode(name);
|
|
51793
|
+
}
|
|
51794
|
+
appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context));
|
|
51772
51795
|
}
|
|
51773
51796
|
else {
|
|
51774
51797
|
appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context);
|
|
@@ -51778,7 +51801,14 @@ var ts;
|
|
|
51778
51801
|
var templateTypeNode = typeToTypeNodeHelper(removeMissingType(getTemplateTypeFromMappedType(type), !!(getMappedTypeModifiers(type) & 4 /* IncludeOptional */)), context);
|
|
51779
51802
|
var mappedTypeNode = ts.factory.createMappedTypeNode(readonlyToken, typeParameterNode, nameTypeNode, questionToken, templateTypeNode, /*members*/ undefined);
|
|
51780
51803
|
context.approximateLength += 10;
|
|
51781
|
-
|
|
51804
|
+
var result = ts.setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
|
|
51805
|
+
if (isMappedTypeWithKeyofConstraintDeclaration(type) && !(getModifiersTypeFromMappedType(type).flags & 262144 /* TypeParameter */) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
51806
|
+
// homomorphic mapped type with a non-homomorphic naive inlining
|
|
51807
|
+
// wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting
|
|
51808
|
+
// type stays homomorphic
|
|
51809
|
+
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 */));
|
|
51810
|
+
}
|
|
51811
|
+
return result;
|
|
51782
51812
|
}
|
|
51783
51813
|
function createAnonymousTypeNode(type) {
|
|
51784
51814
|
var _a;
|
|
@@ -53399,7 +53429,7 @@ var ts;
|
|
|
53399
53429
|
// If it's a class/interface/function: emit a class/interface/function with a `default` modifier
|
|
53400
53430
|
// These forms can merge, eg (`export default 12; export default interface A {}`)
|
|
53401
53431
|
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias) {
|
|
53402
|
-
var _a, _b;
|
|
53432
|
+
var _a, _b, _c, _d;
|
|
53403
53433
|
var symbolName = ts.unescapeLeadingUnderscores(symbol.escapedName);
|
|
53404
53434
|
var isDefault = symbol.escapedName === "default" /* Default */;
|
|
53405
53435
|
if (isPrivate && !(context.flags & 131072 /* AllowAnonymousIdentifier */) && ts.isStringANonContextualKeyword(symbolName) && !isDefault) {
|
|
@@ -53450,17 +53480,21 @@ var ts;
|
|
|
53450
53480
|
else {
|
|
53451
53481
|
// 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!_
|
|
53452
53482
|
// `var` is `FunctionScopedVariable`, `const` and `let` are `BlockScopedVariable`, and `module.exports.thing =` is `Property`
|
|
53453
|
-
var flags = !(symbol.flags & 2 /* BlockScopedVariable */)
|
|
53454
|
-
:
|
|
53483
|
+
var flags = !(symbol.flags & 2 /* BlockScopedVariable */)
|
|
53484
|
+
? ((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.valueDeclaration) && ts.isSourceFile((_b = symbol.parent) === null || _b === void 0 ? void 0 : _b.valueDeclaration)
|
|
53485
|
+
? 2 /* Const */
|
|
53486
|
+
: undefined
|
|
53487
|
+
: isConstVariable(symbol)
|
|
53488
|
+
? 2 /* Const */
|
|
53455
53489
|
: 1 /* Let */;
|
|
53456
53490
|
var name = (needsPostExportDefault || !(symbol.flags & 4 /* Property */)) ? localName : getUnusedName(localName, symbol);
|
|
53457
53491
|
var textRange = symbol.declarations && ts.find(symbol.declarations, function (d) { return ts.isVariableDeclaration(d); });
|
|
53458
53492
|
if (textRange && ts.isVariableDeclarationList(textRange.parent) && textRange.parent.declarations.length === 1) {
|
|
53459
53493
|
textRange = textRange.parent.parent;
|
|
53460
53494
|
}
|
|
53461
|
-
var propertyAccessRequire = (
|
|
53495
|
+
var propertyAccessRequire = (_c = symbol.declarations) === null || _c === void 0 ? void 0 : _c.find(ts.isPropertyAccessExpression);
|
|
53462
53496
|
if (propertyAccessRequire && ts.isBinaryExpression(propertyAccessRequire.parent) && ts.isIdentifier(propertyAccessRequire.parent.right)
|
|
53463
|
-
&& ((
|
|
53497
|
+
&& ((_d = type.symbol) === null || _d === void 0 ? void 0 : _d.valueDeclaration) && ts.isSourceFile(type.symbol.valueDeclaration)) {
|
|
53464
53498
|
var alias = localName === propertyAccessRequire.parent.right.escapedText ? undefined : propertyAccessRequire.parent.right;
|
|
53465
53499
|
addResult(ts.factory.createExportDeclaration(
|
|
53466
53500
|
/*decorators*/ undefined,
|
|
@@ -53540,8 +53574,8 @@ var ts;
|
|
|
53540
53574
|
// synthesize export * from "moduleReference"
|
|
53541
53575
|
// Straightforward - only one thing to do - make an export declaration
|
|
53542
53576
|
if (symbol.declarations) {
|
|
53543
|
-
for (var _i = 0,
|
|
53544
|
-
var node =
|
|
53577
|
+
for (var _i = 0, _e = symbol.declarations; _i < _e.length; _i++) {
|
|
53578
|
+
var node = _e[_i];
|
|
53545
53579
|
var resolvedModule = resolveExternalModuleName(node, node.moduleSpecifier);
|
|
53546
53580
|
if (!resolvedModule)
|
|
53547
53581
|
continue;
|
|
@@ -55347,7 +55381,10 @@ var ts;
|
|
|
55347
55381
|
if (containsSameNamedThisProperty(expression.left, expression.right)) {
|
|
55348
55382
|
return anyType;
|
|
55349
55383
|
}
|
|
55350
|
-
var
|
|
55384
|
+
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)));
|
|
55385
|
+
var type = resolvedSymbol ? getTypeOfSymbol(resolvedSymbol)
|
|
55386
|
+
: isDirectExport ? getRegularTypeOfLiteralType(checkExpressionCached(expression.right))
|
|
55387
|
+
: getWidenedLiteralType(checkExpressionCached(expression.right));
|
|
55351
55388
|
if (type.flags & 524288 /* Object */ &&
|
|
55352
55389
|
kind === 2 /* ModuleExports */ &&
|
|
55353
55390
|
symbol.escapedName === "export=" /* ExportEquals */) {
|
|
@@ -56091,7 +56128,7 @@ var ts;
|
|
|
56091
56128
|
node = paramSymbol.valueDeclaration;
|
|
56092
56129
|
}
|
|
56093
56130
|
break;
|
|
56094
|
-
case 319 /*
|
|
56131
|
+
case 319 /* JSDoc */: {
|
|
56095
56132
|
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
|
|
56096
56133
|
return node.tags
|
|
56097
56134
|
? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; }))
|
|
@@ -58352,10 +58389,10 @@ var ts;
|
|
|
58352
58389
|
else if (type !== firstType) {
|
|
58353
58390
|
checkFlags |= 64 /* HasNonUniformType */;
|
|
58354
58391
|
}
|
|
58355
|
-
if (isLiteralType(type) || isPatternLiteralType(type)) {
|
|
58392
|
+
if (isLiteralType(type) || isPatternLiteralType(type) || type === uniqueLiteralType) {
|
|
58356
58393
|
checkFlags |= 128 /* HasLiteralType */;
|
|
58357
58394
|
}
|
|
58358
|
-
if (type.flags & 131072 /* Never */) {
|
|
58395
|
+
if (type.flags & 131072 /* Never */ && type !== uniqueLiteralType) {
|
|
58359
58396
|
checkFlags |= 131072 /* HasNeverType */;
|
|
58360
58397
|
}
|
|
58361
58398
|
propTypes.push(type);
|
|
@@ -59540,7 +59577,7 @@ var ts;
|
|
|
59540
59577
|
function getConditionalFlowTypeOfType(type, node) {
|
|
59541
59578
|
var constraints;
|
|
59542
59579
|
var covariant = true;
|
|
59543
|
-
while (node && !ts.isStatement(node) && node.kind !== 319 /*
|
|
59580
|
+
while (node && !ts.isStatement(node) && node.kind !== 319 /* JSDoc */) {
|
|
59544
59581
|
var parent = node.parent;
|
|
59545
59582
|
// only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but
|
|
59546
59583
|
// often get used in indexed accesses where they behave sortof invariantly, but our checking is lax
|
|
@@ -60896,10 +60933,24 @@ var ts;
|
|
|
60896
60933
|
return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1 /* Literal */,
|
|
60897
60934
|
/*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, origin);
|
|
60898
60935
|
}
|
|
60936
|
+
/**
|
|
60937
|
+
* A union type which is reducible upon instantiation (meaning some members are removed under certain instantiations)
|
|
60938
|
+
* must be kept generic, as that instantiation information needs to flow through the type system. By replacing all
|
|
60939
|
+
* type parameters in the union with a special never type that is treated as a literal in `getReducedType`, we can cause the `getReducedType` logic
|
|
60940
|
+
* to reduce the resulting type if possible (since only intersections with conflicting literal-typed properties are reducible).
|
|
60941
|
+
*/
|
|
60942
|
+
function isPossiblyReducibleByInstantiation(type) {
|
|
60943
|
+
return ts.some(type.types, function (t) {
|
|
60944
|
+
var uniqueFilled = getUniqueLiteralFilledInstantiation(t);
|
|
60945
|
+
return getReducedType(uniqueFilled) !== uniqueFilled;
|
|
60946
|
+
});
|
|
60947
|
+
}
|
|
60899
60948
|
function getIndexType(type, stringsOnly, noIndexSignatures) {
|
|
60900
60949
|
if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
|
|
60901
60950
|
type = getReducedType(type);
|
|
60902
|
-
return type.flags & 1048576 /* Union */ ?
|
|
60951
|
+
return type.flags & 1048576 /* Union */ ? isPossiblyReducibleByInstantiation(type)
|
|
60952
|
+
? getIndexTypeForGenericType(type, stringsOnly)
|
|
60953
|
+
: getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
|
|
60903
60954
|
type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
|
|
60904
60955
|
type.flags & 58982400 /* InstantiableNonPrimitive */ || isGenericTupleType(type) || isGenericMappedType(type) && !hasDistributiveNameType(type) ? getIndexTypeForGenericType(type, stringsOnly) :
|
|
60905
60956
|
ts.getObjectFlags(type) & 32 /* Mapped */ ? getIndexTypeForMappedType(type, stringsOnly, noIndexSignatures) :
|
|
@@ -61527,6 +61578,10 @@ var ts;
|
|
|
61527
61578
|
}
|
|
61528
61579
|
return type;
|
|
61529
61580
|
}
|
|
61581
|
+
function maybeCloneTypeParameter(p) {
|
|
61582
|
+
var constraint = getConstraintOfTypeParameter(p);
|
|
61583
|
+
return constraint && (isGenericObjectType(constraint) || isGenericIndexType(constraint)) ? cloneTypeParameter(p) : p;
|
|
61584
|
+
}
|
|
61530
61585
|
function isTypicalNondistributiveConditional(root) {
|
|
61531
61586
|
return !root.isDistributive && isSingletonTupleType(root.node.checkType) && isSingletonTupleType(root.node.extendsType);
|
|
61532
61587
|
}
|
|
@@ -61545,37 +61600,65 @@ var ts;
|
|
|
61545
61600
|
var result;
|
|
61546
61601
|
var extraTypes;
|
|
61547
61602
|
var tailCount = 0;
|
|
61548
|
-
|
|
61549
|
-
// types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
|
|
61550
|
-
// purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
|
|
61551
|
-
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
61552
|
-
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
61553
|
-
while (true) {
|
|
61603
|
+
var _loop_18 = function () {
|
|
61554
61604
|
if (tailCount === 1000) {
|
|
61555
61605
|
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
|
|
61556
61606
|
result = errorType;
|
|
61557
|
-
break;
|
|
61607
|
+
return "break";
|
|
61558
61608
|
}
|
|
61559
61609
|
var isUnwrapped = isTypicalNondistributiveConditional(root);
|
|
61560
61610
|
var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper);
|
|
61561
61611
|
var checkTypeInstantiable = isGenericType(checkType);
|
|
61562
61612
|
var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper);
|
|
61563
61613
|
if (checkType === wildcardType || extendsType === wildcardType) {
|
|
61564
|
-
return wildcardType;
|
|
61614
|
+
return { value: wildcardType };
|
|
61565
61615
|
}
|
|
61566
61616
|
var combinedMapper = void 0;
|
|
61567
61617
|
if (root.inferTypeParameters) {
|
|
61568
|
-
|
|
61569
|
-
|
|
61618
|
+
// When we're looking at making an inference for an infer type, when we get its constraint, it'll automagically be
|
|
61619
|
+
// instantiated with the context, so it doesn't need the mapper for the inference contex - however the constraint
|
|
61620
|
+
// may refer to another _root_, _uncloned_ `infer` type parameter [1], or to something mapped by `mapper` [2].
|
|
61621
|
+
// [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
|
|
61622
|
+
// as `number`
|
|
61623
|
+
// Conversely, if we have `Foo<infer A, infer B>`, `B` is still constrained to `T` and `T` is instantiated as `A`
|
|
61624
|
+
// [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`
|
|
61625
|
+
// which is in turn instantiated as `Q`, which is in turn instantiated as `number`.
|
|
61626
|
+
// So we need to:
|
|
61627
|
+
// * Clone the type parameters so their constraints can be instantiated in the context of `mapper` (otherwise theyd only get inference context information)
|
|
61628
|
+
// * Set the clones to both map the conditional's enclosing `mapper` and the original params
|
|
61629
|
+
// * instantiate the extends type with the clones
|
|
61630
|
+
// * incorporate all of the component mappers into the combined mapper for the true and false members
|
|
61631
|
+
// This means we have three mappers that need applying:
|
|
61632
|
+
// * The original `mapper` used to create this conditional
|
|
61633
|
+
// * The mapper that maps the old root type parameter to the clone (`freshMapper`)
|
|
61634
|
+
// * The mapper that maps the clone to its inference result (`context.mapper`)
|
|
61635
|
+
var freshParams = ts.sameMap(root.inferTypeParameters, maybeCloneTypeParameter);
|
|
61636
|
+
var freshMapper = freshParams !== root.inferTypeParameters ? createTypeMapper(root.inferTypeParameters, freshParams) : undefined;
|
|
61637
|
+
var context = createInferenceContext(freshParams, /*signature*/ undefined, 0 /* None */);
|
|
61638
|
+
if (freshMapper) {
|
|
61639
|
+
var freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
|
|
61640
|
+
for (var _i = 0, freshParams_1 = freshParams; _i < freshParams_1.length; _i++) {
|
|
61641
|
+
var p = freshParams_1[_i];
|
|
61642
|
+
if (root.inferTypeParameters.indexOf(p) === -1) {
|
|
61643
|
+
p.mapper = freshCombinedMapper;
|
|
61644
|
+
}
|
|
61645
|
+
}
|
|
61646
|
+
}
|
|
61647
|
+
// We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type
|
|
61648
|
+
// if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to
|
|
61649
|
+
// "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint
|
|
61650
|
+
// so in those cases we refain from performing inference and retain the uninfered type parameter
|
|
61651
|
+
if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) {
|
|
61570
61652
|
// We don't want inferences from constraints as they may cause us to eagerly resolve the
|
|
61571
61653
|
// conditional type instead of deferring resolution. Also, we always want strict function
|
|
61572
61654
|
// types rules (i.e. proper contravariance) for inferences.
|
|
61573
|
-
inferTypes(context.inferences, checkType, extendsType, 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
61655
|
+
inferTypes(context.inferences, checkType, instantiateType(extendsType, freshMapper), 512 /* NoConstraints */ | 1024 /* AlwaysStrict */);
|
|
61574
61656
|
}
|
|
61657
|
+
var innerMapper = combineTypeMappers(freshMapper, context.mapper);
|
|
61575
61658
|
// It's possible for 'infer T' type paramteters to be given uninstantiated constraints when the
|
|
61576
61659
|
// those type parameters are used in type references (see getInferredTypeParameterConstraint). For
|
|
61577
61660
|
// that reason we need context.mapper to be first in the combined mapper. See #42636 for examples.
|
|
61578
|
-
combinedMapper = mapper ? combineTypeMappers(
|
|
61661
|
+
combinedMapper = mapper ? combineTypeMappers(innerMapper, mapper) : innerMapper;
|
|
61579
61662
|
}
|
|
61580
61663
|
// Instantiate the extends type including inferences for 'infer T' type parameters
|
|
61581
61664
|
var inferredExtendsType = combinedMapper ? instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), combinedMapper) : extendsType;
|
|
@@ -61597,14 +61680,14 @@ var ts;
|
|
|
61597
61680
|
var newRoot = falseType_1.root;
|
|
61598
61681
|
if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) {
|
|
61599
61682
|
root = newRoot;
|
|
61600
|
-
continue;
|
|
61683
|
+
return "continue";
|
|
61601
61684
|
}
|
|
61602
61685
|
if (canTailRecurse(falseType_1, mapper)) {
|
|
61603
|
-
continue;
|
|
61686
|
+
return "continue";
|
|
61604
61687
|
}
|
|
61605
61688
|
}
|
|
61606
61689
|
result = instantiateType(falseType_1, mapper);
|
|
61607
|
-
break;
|
|
61690
|
+
return "break";
|
|
61608
61691
|
}
|
|
61609
61692
|
// Return trueType for a definitely true extends check. We check instantiations of the two
|
|
61610
61693
|
// types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
|
|
@@ -61615,10 +61698,10 @@ var ts;
|
|
|
61615
61698
|
var trueType_1 = getTypeFromTypeNode(root.node.trueType);
|
|
61616
61699
|
var trueMapper = combinedMapper || mapper;
|
|
61617
61700
|
if (canTailRecurse(trueType_1, trueMapper)) {
|
|
61618
|
-
continue;
|
|
61701
|
+
return "continue";
|
|
61619
61702
|
}
|
|
61620
61703
|
result = instantiateType(trueType_1, trueMapper);
|
|
61621
|
-
break;
|
|
61704
|
+
return "break";
|
|
61622
61705
|
}
|
|
61623
61706
|
}
|
|
61624
61707
|
// Return a deferred type for a check that is neither definitely true nor definitely false
|
|
@@ -61630,7 +61713,19 @@ var ts;
|
|
|
61630
61713
|
result.combinedMapper = combinedMapper;
|
|
61631
61714
|
result.aliasSymbol = aliasSymbol || root.aliasSymbol;
|
|
61632
61715
|
result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
|
|
61633
|
-
break;
|
|
61716
|
+
return "break";
|
|
61717
|
+
};
|
|
61718
|
+
// We loop here for an immediately nested conditional type in the false position, effectively treating
|
|
61719
|
+
// types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for
|
|
61720
|
+
// purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of
|
|
61721
|
+
// another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive
|
|
61722
|
+
// cases we increment the tail recursion counter and stop after 1000 iterations.
|
|
61723
|
+
while (true) {
|
|
61724
|
+
var state_5 = _loop_18();
|
|
61725
|
+
if (typeof state_5 === "object")
|
|
61726
|
+
return state_5.value;
|
|
61727
|
+
if (state_5 === "break")
|
|
61728
|
+
break;
|
|
61634
61729
|
}
|
|
61635
61730
|
return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result;
|
|
61636
61731
|
// We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and
|
|
@@ -62052,9 +62147,11 @@ var ts;
|
|
|
62052
62147
|
}
|
|
62053
62148
|
function getESSymbolLikeTypeForNode(node) {
|
|
62054
62149
|
if (ts.isValidESSymbolDeclaration(node)) {
|
|
62055
|
-
var symbol = getSymbolOfNode(node);
|
|
62056
|
-
|
|
62057
|
-
|
|
62150
|
+
var symbol = ts.isCommonJsExportPropertyAssignment(node) ? getSymbolOfNode(node.left) : getSymbolOfNode(node);
|
|
62151
|
+
if (symbol) {
|
|
62152
|
+
var links = getSymbolLinks(symbol);
|
|
62153
|
+
return links.uniqueESSymbolType || (links.uniqueESSymbolType = createUniqueESSymbolType(symbol));
|
|
62154
|
+
}
|
|
62058
62155
|
}
|
|
62059
62156
|
return esSymbolType;
|
|
62060
62157
|
}
|
|
@@ -62698,6 +62795,10 @@ var ts;
|
|
|
62698
62795
|
}
|
|
62699
62796
|
return type; // Nested invocation of `inferTypeForHomomorphicMappedType` or the `source` instantiated into something unmappable
|
|
62700
62797
|
}
|
|
62798
|
+
function getUniqueLiteralFilledInstantiation(type) {
|
|
62799
|
+
return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type :
|
|
62800
|
+
type.uniqueLiteralFilledInstantiation || (type.uniqueLiteralFilledInstantiation = instantiateType(type, uniqueLiteralMapper));
|
|
62801
|
+
}
|
|
62701
62802
|
function getPermissiveInstantiation(type) {
|
|
62702
62803
|
return type.flags & (131068 /* Primitive */ | 3 /* AnyOrUnknown */ | 131072 /* Never */) ? type :
|
|
62703
62804
|
type.permissiveInstantiation || (type.permissiveInstantiation = instantiateType(type, permissiveMapper));
|
|
@@ -64157,7 +64258,7 @@ var ts;
|
|
|
64157
64258
|
reducedTarget = findMatchingDiscriminantType(source, target, isRelatedTo) || filterPrimitivesIfContainsNonPrimitive(target);
|
|
64158
64259
|
checkTypes = reducedTarget.flags & 1048576 /* Union */ ? reducedTarget.types : [reducedTarget];
|
|
64159
64260
|
}
|
|
64160
|
-
var
|
|
64261
|
+
var _loop_19 = function (prop) {
|
|
64161
64262
|
if (shouldCheckAsExcessProperty(prop, source.symbol) && !isIgnoredJsxProperty(source, prop)) {
|
|
64162
64263
|
if (!isKnownProperty(reducedTarget, prop.escapedName, isComparingJsxAttributes)) {
|
|
64163
64264
|
if (reportErrors) {
|
|
@@ -64220,9 +64321,9 @@ var ts;
|
|
|
64220
64321
|
};
|
|
64221
64322
|
for (var _i = 0, _b = getPropertiesOfType(source); _i < _b.length; _i++) {
|
|
64222
64323
|
var prop = _b[_i];
|
|
64223
|
-
var
|
|
64224
|
-
if (typeof
|
|
64225
|
-
return
|
|
64324
|
+
var state_6 = _loop_19(prop);
|
|
64325
|
+
if (typeof state_6 === "object")
|
|
64326
|
+
return state_6.value;
|
|
64226
64327
|
}
|
|
64227
64328
|
return false;
|
|
64228
64329
|
}
|
|
@@ -65212,11 +65313,11 @@ var ts;
|
|
|
65212
65313
|
// constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
|
|
65213
65314
|
var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
|
|
65214
65315
|
var matchingTypes = [];
|
|
65215
|
-
var
|
|
65316
|
+
var _loop_20 = function (combination) {
|
|
65216
65317
|
var hasMatch = false;
|
|
65217
65318
|
outer: for (var _c = 0, _d = target.types; _c < _d.length; _c++) {
|
|
65218
65319
|
var type = _d[_c];
|
|
65219
|
-
var
|
|
65320
|
+
var _loop_21 = function (i) {
|
|
65220
65321
|
var sourceProperty = sourcePropertiesFiltered[i];
|
|
65221
65322
|
var targetProperty = getPropertyOfType(type, sourceProperty.escapedName);
|
|
65222
65323
|
if (!targetProperty)
|
|
@@ -65232,8 +65333,8 @@ var ts;
|
|
|
65232
65333
|
}
|
|
65233
65334
|
};
|
|
65234
65335
|
for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
|
|
65235
|
-
var
|
|
65236
|
-
switch (
|
|
65336
|
+
var state_8 = _loop_21(i);
|
|
65337
|
+
switch (state_8) {
|
|
65237
65338
|
case "continue-outer": continue outer;
|
|
65238
65339
|
}
|
|
65239
65340
|
}
|
|
@@ -65246,9 +65347,9 @@ var ts;
|
|
|
65246
65347
|
};
|
|
65247
65348
|
for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
|
|
65248
65349
|
var combination = discriminantCombinations_1[_a];
|
|
65249
|
-
var
|
|
65250
|
-
if (typeof
|
|
65251
|
-
return
|
|
65350
|
+
var state_7 = _loop_20(combination);
|
|
65351
|
+
if (typeof state_7 === "object")
|
|
65352
|
+
return state_7.value;
|
|
65252
65353
|
}
|
|
65253
65354
|
// Compare the remaining non-discriminant properties of each match.
|
|
65254
65355
|
var result = -1 /* True */;
|
|
@@ -65961,7 +66062,7 @@ var ts;
|
|
|
65961
66062
|
// The emptyArray singleton is used to signal a recursive invocation.
|
|
65962
66063
|
cache.variances = ts.emptyArray;
|
|
65963
66064
|
variances = [];
|
|
65964
|
-
var
|
|
66065
|
+
var _loop_22 = function (tp) {
|
|
65965
66066
|
var unmeasurable = false;
|
|
65966
66067
|
var unreliable = false;
|
|
65967
66068
|
var oldHandler = outofbandVarianceMarkerHandler;
|
|
@@ -65993,7 +66094,7 @@ var ts;
|
|
|
65993
66094
|
};
|
|
65994
66095
|
for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
|
|
65995
66096
|
var tp = typeParameters_1[_i];
|
|
65996
|
-
|
|
66097
|
+
_loop_22(tp);
|
|
65997
66098
|
}
|
|
65998
66099
|
cache.variances = variances;
|
|
65999
66100
|
ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop();
|
|
@@ -68364,7 +68465,7 @@ var ts;
|
|
|
68364
68465
|
function mapTypesByKeyProperty(types, name) {
|
|
68365
68466
|
var map = new ts.Map();
|
|
68366
68467
|
var count = 0;
|
|
68367
|
-
var
|
|
68468
|
+
var _loop_23 = function (type) {
|
|
68368
68469
|
if (type.flags & (524288 /* Object */ | 2097152 /* Intersection */ | 58982400 /* InstantiableNonPrimitive */)) {
|
|
68369
68470
|
var discriminant = getTypeOfPropertyOfType(type, name);
|
|
68370
68471
|
if (discriminant) {
|
|
@@ -68390,9 +68491,9 @@ var ts;
|
|
|
68390
68491
|
};
|
|
68391
68492
|
for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
|
|
68392
68493
|
var type = types_16[_i];
|
|
68393
|
-
var
|
|
68394
|
-
if (typeof
|
|
68395
|
-
return
|
|
68494
|
+
var state_9 = _loop_23(type);
|
|
68495
|
+
if (typeof state_9 === "object")
|
|
68496
|
+
return state_9.value;
|
|
68396
68497
|
}
|
|
68397
68498
|
return count >= 10 && count * 2 >= types.length ? map : undefined;
|
|
68398
68499
|
}
|
|
@@ -74723,7 +74824,7 @@ var ts;
|
|
|
74723
74824
|
if (spreadIndex >= 0) {
|
|
74724
74825
|
// Create synthetic arguments from spreads of tuple types.
|
|
74725
74826
|
var effectiveArgs_1 = args.slice(0, spreadIndex);
|
|
74726
|
-
var
|
|
74827
|
+
var _loop_24 = function (i) {
|
|
74727
74828
|
var arg = args[i];
|
|
74728
74829
|
// We can call checkExpressionCached because spread expressions never have a contextual type.
|
|
74729
74830
|
var spreadType = arg.kind === 224 /* SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression));
|
|
@@ -74740,7 +74841,7 @@ var ts;
|
|
|
74740
74841
|
}
|
|
74741
74842
|
};
|
|
74742
74843
|
for (var i = spreadIndex; i < args.length; i++) {
|
|
74743
|
-
|
|
74844
|
+
_loop_24(i);
|
|
74744
74845
|
}
|
|
74745
74846
|
return effectiveArgs_1;
|
|
74746
74847
|
}
|
|
@@ -75053,7 +75154,7 @@ var ts;
|
|
|
75053
75154
|
var min_3 = Number.MAX_VALUE;
|
|
75054
75155
|
var minIndex = 0;
|
|
75055
75156
|
var i_1 = 0;
|
|
75056
|
-
var
|
|
75157
|
+
var _loop_25 = function (c) {
|
|
75057
75158
|
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)); };
|
|
75058
75159
|
var diags_2 = getSignatureApplicabilityError(node, args, c, assignableRelation, 0 /* Normal */, /*reportErrors*/ true, chain_2);
|
|
75059
75160
|
if (diags_2) {
|
|
@@ -75071,7 +75172,7 @@ var ts;
|
|
|
75071
75172
|
};
|
|
75072
75173
|
for (var _a = 0, candidatesForArgumentError_1 = candidatesForArgumentError; _a < candidatesForArgumentError_1.length; _a++) {
|
|
75073
75174
|
var c = candidatesForArgumentError_1[_a];
|
|
75074
|
-
|
|
75175
|
+
_loop_25(c);
|
|
75075
75176
|
}
|
|
75076
75177
|
var diags_3 = max > 1 ? allDiagnostics[minIndex] : ts.flatten(allDiagnostics);
|
|
75077
75178
|
ts.Debug.assert(diags_3.length > 0, "No errors reported for 3 or fewer overload signatures");
|
|
@@ -75229,7 +75330,7 @@ var ts;
|
|
|
75229
75330
|
}
|
|
75230
75331
|
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
|
|
75231
75332
|
var parameters = [];
|
|
75232
|
-
var
|
|
75333
|
+
var _loop_26 = function (i) {
|
|
75233
75334
|
var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ?
|
|
75234
75335
|
i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) :
|
|
75235
75336
|
i < s.parameters.length ? s.parameters[i] : undefined; });
|
|
@@ -75237,7 +75338,7 @@ var ts;
|
|
|
75237
75338
|
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
|
|
75238
75339
|
};
|
|
75239
75340
|
for (var i = 0; i < maxNonRestParam; i++) {
|
|
75240
|
-
|
|
75341
|
+
_loop_26(i);
|
|
75241
75342
|
}
|
|
75242
75343
|
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return signatureHasRestParameter(c) ? ts.last(c.parameters) : undefined; });
|
|
75243
75344
|
var flags = 0 /* None */;
|
|
@@ -78464,7 +78565,7 @@ var ts;
|
|
|
78464
78565
|
}
|
|
78465
78566
|
function checkExpressionForMutableLocation(node, checkMode, contextualType, forceTuple) {
|
|
78466
78567
|
var type = checkExpression(node, checkMode, forceTuple);
|
|
78467
|
-
return isConstContext(node) ? getRegularTypeOfLiteralType(type) :
|
|
78568
|
+
return isConstContext(node) || ts.isCommonJsExportedExpression(node) ? getRegularTypeOfLiteralType(type) :
|
|
78468
78569
|
isTypeAssertion(node) ? type :
|
|
78469
78570
|
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
|
|
78470
78571
|
}
|
|
@@ -79233,7 +79334,7 @@ var ts;
|
|
|
79233
79334
|
var indexSymbol = getIndexSymbol(getSymbolOfNode(node));
|
|
79234
79335
|
if (indexSymbol === null || indexSymbol === void 0 ? void 0 : indexSymbol.declarations) {
|
|
79235
79336
|
var indexSignatureMap_1 = new ts.Map();
|
|
79236
|
-
var
|
|
79337
|
+
var _loop_27 = function (declaration) {
|
|
79237
79338
|
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
|
|
79238
79339
|
forEachType(getTypeFromTypeNode(declaration.parameters[0].type), function (type) {
|
|
79239
79340
|
var entry = indexSignatureMap_1.get(getTypeId(type));
|
|
@@ -79248,7 +79349,7 @@ var ts;
|
|
|
79248
79349
|
};
|
|
79249
79350
|
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
|
|
79250
79351
|
var declaration = _a[_i];
|
|
79251
|
-
|
|
79352
|
+
_loop_27(declaration);
|
|
79252
79353
|
}
|
|
79253
79354
|
indexSignatureMap_1.forEach(function (entry) {
|
|
79254
79355
|
if (entry.declarations.length > 1) {
|
|
@@ -82627,7 +82728,7 @@ var ts;
|
|
|
82627
82728
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 257 /* InterfaceDeclaration */) : undefined;
|
|
82628
82729
|
var localPropDeclaration = declaration && declaration.kind === 220 /* BinaryExpression */ ||
|
|
82629
82730
|
name && name.kind === 161 /* ComputedPropertyName */ || getParentOfSymbol(prop) === type.symbol ? declaration : undefined;
|
|
82630
|
-
var
|
|
82731
|
+
var _loop_28 = function (info) {
|
|
82631
82732
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
82632
82733
|
// We check only when (a) the property is declared in the containing type, or (b) the applicable index signature is declared
|
|
82633
82734
|
// in the containing type, or (c) the containing type is an interface and no base interface contains both the property and
|
|
@@ -82640,7 +82741,7 @@ var ts;
|
|
|
82640
82741
|
};
|
|
82641
82742
|
for (var _i = 0, indexInfos_9 = indexInfos; _i < indexInfos_9.length; _i++) {
|
|
82642
82743
|
var info = indexInfos_9[_i];
|
|
82643
|
-
|
|
82744
|
+
_loop_28(info);
|
|
82644
82745
|
}
|
|
82645
82746
|
}
|
|
82646
82747
|
function checkIndexConstraintForIndexSignature(type, checkInfo) {
|
|
@@ -82648,7 +82749,7 @@ var ts;
|
|
|
82648
82749
|
var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType);
|
|
82649
82750
|
var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* Interface */ ? ts.getDeclarationOfKind(type.symbol, 257 /* InterfaceDeclaration */) : undefined;
|
|
82650
82751
|
var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined;
|
|
82651
|
-
var
|
|
82752
|
+
var _loop_29 = function (info) {
|
|
82652
82753
|
if (info === checkInfo)
|
|
82653
82754
|
return "continue";
|
|
82654
82755
|
var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined;
|
|
@@ -82663,7 +82764,7 @@ var ts;
|
|
|
82663
82764
|
};
|
|
82664
82765
|
for (var _i = 0, indexInfos_10 = indexInfos; _i < indexInfos_10.length; _i++) {
|
|
82665
82766
|
var info = indexInfos_10[_i];
|
|
82666
|
-
|
|
82767
|
+
_loop_29(info);
|
|
82667
82768
|
}
|
|
82668
82769
|
}
|
|
82669
82770
|
function checkTypeNameIsReserved(name, message) {
|
|
@@ -82974,7 +83075,7 @@ var ts;
|
|
|
82974
83075
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
82975
83076
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
82976
83077
|
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
82977
|
-
var
|
|
83078
|
+
var _loop_30 = function (member) {
|
|
82978
83079
|
if (ts.hasAmbientModifier(member)) {
|
|
82979
83080
|
return "continue";
|
|
82980
83081
|
}
|
|
@@ -82991,7 +83092,7 @@ var ts;
|
|
|
82991
83092
|
};
|
|
82992
83093
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
82993
83094
|
var member = _a[_i];
|
|
82994
|
-
|
|
83095
|
+
_loop_30(member);
|
|
82995
83096
|
}
|
|
82996
83097
|
}
|
|
82997
83098
|
/**
|
|
@@ -83079,7 +83180,7 @@ var ts;
|
|
|
83079
83180
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
83080
83181
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
83081
83182
|
var issuedMemberError = false;
|
|
83082
|
-
var
|
|
83183
|
+
var _loop_31 = function (member) {
|
|
83083
83184
|
if (ts.isStatic(member)) {
|
|
83084
83185
|
return "continue";
|
|
83085
83186
|
}
|
|
@@ -83098,7 +83199,7 @@ var ts;
|
|
|
83098
83199
|
};
|
|
83099
83200
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
83100
83201
|
var member = _a[_i];
|
|
83101
|
-
|
|
83202
|
+
_loop_31(member);
|
|
83102
83203
|
}
|
|
83103
83204
|
if (!issuedMemberError) {
|
|
83104
83205
|
// check again with diagnostics to generate a less-specific error
|
|
@@ -110063,7 +110164,7 @@ var ts;
|
|
|
110063
110164
|
return emitRestOrJSDocVariadicType(node);
|
|
110064
110165
|
case 318 /* JSDocNamepathType */:
|
|
110065
110166
|
return;
|
|
110066
|
-
case 319 /*
|
|
110167
|
+
case 319 /* JSDoc */:
|
|
110067
110168
|
return emitJSDoc(node);
|
|
110068
110169
|
case 321 /* JSDocTypeLiteral */:
|
|
110069
110170
|
return emitJSDocTypeLiteral(node);
|
|
@@ -120885,7 +120986,7 @@ var ts;
|
|
|
120885
120986
|
});
|
|
120886
120987
|
// Sort by paths closest to importing file Name directory
|
|
120887
120988
|
var sortedPaths = [];
|
|
120888
|
-
var
|
|
120989
|
+
var _loop_32 = function (directory) {
|
|
120889
120990
|
var directoryStart = ts.ensureTrailingDirectorySeparator(directory);
|
|
120890
120991
|
var pathsInDirectory;
|
|
120891
120992
|
allFileNames.forEach(function (_a, fileName) {
|
|
@@ -120909,9 +121010,9 @@ var ts;
|
|
|
120909
121010
|
};
|
|
120910
121011
|
var out_directory_1;
|
|
120911
121012
|
for (var directory = ts.getDirectoryPath(importingFileName); allFileNames.size !== 0;) {
|
|
120912
|
-
var
|
|
121013
|
+
var state_10 = _loop_32(directory);
|
|
120913
121014
|
directory = out_directory_1;
|
|
120914
|
-
if (
|
|
121015
|
+
if (state_10 === "break")
|
|
120915
121016
|
break;
|
|
120916
121017
|
}
|
|
120917
121018
|
if (allFileNames.size) {
|