@typescript-deploys/pr-build 5.6.0-pr-58825-5 → 5.6.0-pr-58729-60
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/lib.es5.d.ts +5 -0
- package/lib/tsc.js +191 -20
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +194 -20
- package/package.json +1 -1
package/lib/lib.es5.d.ts
CHANGED
|
@@ -1672,6 +1672,11 @@ type Uncapitalize<S extends string> = intrinsic;
|
|
|
1672
1672
|
*/
|
|
1673
1673
|
type NoInfer<T> = intrinsic;
|
|
1674
1674
|
|
|
1675
|
+
/**
|
|
1676
|
+
* Marker for deferred callbacks
|
|
1677
|
+
*/
|
|
1678
|
+
type Deferred<T extends (...args: any) => any> = intrinsic;
|
|
1679
|
+
|
|
1675
1680
|
/**
|
|
1676
1681
|
* Marker for contextual 'this' type
|
|
1677
1682
|
*/
|
package/lib/tsc.js
CHANGED
|
@@ -1644,7 +1644,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1644
1644
|
__tsDebuggerDisplay: {
|
|
1645
1645
|
value() {
|
|
1646
1646
|
const flowHeader = this.flags & 2 /* Start */ ? "FlowStart" : this.flags & 4 /* BranchLabel */ ? "FlowBranchLabel" : this.flags & 8 /* LoopLabel */ ? "FlowLoopLabel" : this.flags & 16 /* Assignment */ ? "FlowAssignment" : this.flags & 32 /* TrueCondition */ ? "FlowTrueCondition" : this.flags & 64 /* FalseCondition */ ? "FlowFalseCondition" : this.flags & 128 /* SwitchClause */ ? "FlowSwitchClause" : this.flags & 256 /* ArrayMutation */ ? "FlowArrayMutation" : this.flags & 512 /* Call */ ? "FlowCall" : this.flags & 1024 /* ReduceLabel */ ? "FlowReduceLabel" : this.flags & 1 /* Unreachable */ ? "FlowUnreachable" : "UnknownFlow";
|
|
1647
|
-
const remainingFlags = this.flags & ~(
|
|
1647
|
+
const remainingFlags = this.flags & ~(4096 /* Referenced */ - 1);
|
|
1648
1648
|
return `${flowHeader}${remainingFlags ? ` (${formatFlowFlags(remainingFlags)})` : ""}`;
|
|
1649
1649
|
}
|
|
1650
1650
|
},
|
|
@@ -3451,8 +3451,9 @@ var FlowFlags = /* @__PURE__ */ ((FlowFlags2) => {
|
|
|
3451
3451
|
FlowFlags2[FlowFlags2["ArrayMutation"] = 256] = "ArrayMutation";
|
|
3452
3452
|
FlowFlags2[FlowFlags2["Call"] = 512] = "Call";
|
|
3453
3453
|
FlowFlags2[FlowFlags2["ReduceLabel"] = 1024] = "ReduceLabel";
|
|
3454
|
-
FlowFlags2[FlowFlags2["
|
|
3455
|
-
FlowFlags2[FlowFlags2["
|
|
3454
|
+
FlowFlags2[FlowFlags2["LambdaArgs"] = 2048] = "LambdaArgs";
|
|
3455
|
+
FlowFlags2[FlowFlags2["Referenced"] = 4096] = "Referenced";
|
|
3456
|
+
FlowFlags2[FlowFlags2["Shared"] = 8192] = "Shared";
|
|
3456
3457
|
FlowFlags2[FlowFlags2["Label"] = 12] = "Label";
|
|
3457
3458
|
FlowFlags2[FlowFlags2["Condition"] = 96] = "Condition";
|
|
3458
3459
|
return FlowFlags2;
|
|
@@ -3672,10 +3673,11 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
3672
3673
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
3673
3674
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
3674
3675
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
3675
|
-
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
3676
3676
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
3677
3677
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
3678
3678
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
3679
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
3680
|
+
ObjectFlags3[ObjectFlags3["DeferredCallback"] = 268435456] = "DeferredCallback";
|
|
3679
3681
|
ObjectFlags3[ObjectFlags3["IsGenericTypeComputed"] = 2097152] = "IsGenericTypeComputed";
|
|
3680
3682
|
ObjectFlags3[ObjectFlags3["IsGenericObjectType"] = 4194304] = "IsGenericObjectType";
|
|
3681
3683
|
ObjectFlags3[ObjectFlags3["IsGenericIndexType"] = 8388608] = "IsGenericIndexType";
|
|
@@ -19366,6 +19368,16 @@ function hasInferredType(node) {
|
|
|
19366
19368
|
return false;
|
|
19367
19369
|
}
|
|
19368
19370
|
}
|
|
19371
|
+
function getLambdaArgument(node) {
|
|
19372
|
+
switch (node.kind) {
|
|
19373
|
+
case 218 /* FunctionExpression */:
|
|
19374
|
+
case 219 /* ArrowFunction */:
|
|
19375
|
+
return !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken ? node : void 0;
|
|
19376
|
+
case 217 /* ParenthesizedExpression */:
|
|
19377
|
+
return getLambdaArgument(node.expression);
|
|
19378
|
+
}
|
|
19379
|
+
return void 0;
|
|
19380
|
+
}
|
|
19369
19381
|
|
|
19370
19382
|
// src/compiler/factory/baseNodeFactory.ts
|
|
19371
19383
|
function createBaseNodeFactory() {
|
|
@@ -41233,6 +41245,7 @@ function createBinder() {
|
|
|
41233
41245
|
var activeLabelList;
|
|
41234
41246
|
var hasExplicitReturn;
|
|
41235
41247
|
var hasFlowEffects;
|
|
41248
|
+
var hasFlowMutation;
|
|
41236
41249
|
var emitFlags;
|
|
41237
41250
|
var inStrictMode;
|
|
41238
41251
|
var inAssignmentPattern = false;
|
|
@@ -41305,6 +41318,7 @@ function createBinder() {
|
|
|
41305
41318
|
activeLabelList = void 0;
|
|
41306
41319
|
hasExplicitReturn = false;
|
|
41307
41320
|
hasFlowEffects = false;
|
|
41321
|
+
hasFlowMutation = false;
|
|
41308
41322
|
inAssignmentPattern = false;
|
|
41309
41323
|
emitFlags = 0 /* None */;
|
|
41310
41324
|
}
|
|
@@ -41563,7 +41577,9 @@ function createBinder() {
|
|
|
41563
41577
|
const saveExceptionTarget = currentExceptionTarget;
|
|
41564
41578
|
const saveActiveLabelList = activeLabelList;
|
|
41565
41579
|
const saveHasExplicitReturn = hasExplicitReturn;
|
|
41566
|
-
const
|
|
41580
|
+
const isRegularFunctionExpression = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken;
|
|
41581
|
+
const isImmediatelyInvoked = isRegularFunctionExpression && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 175 /* ClassStaticBlockDeclaration */;
|
|
41582
|
+
const isLambdaArgument = isRegularFunctionExpression && walkUpParenthesizedExpressions(node.parent).kind === 213 /* CallExpression */;
|
|
41567
41583
|
if (!isImmediatelyInvoked) {
|
|
41568
41584
|
currentFlow = createFlowNode(
|
|
41569
41585
|
2 /* Start */,
|
|
@@ -41576,7 +41592,7 @@ function createBinder() {
|
|
|
41576
41592
|
currentFlow.node = node;
|
|
41577
41593
|
}
|
|
41578
41594
|
}
|
|
41579
|
-
currentReturnTarget = isImmediatelyInvoked || node.kind === 176 /* Constructor */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */) ? createBranchLabel() : void 0;
|
|
41595
|
+
currentReturnTarget = isImmediatelyInvoked || isLambdaArgument || node.kind === 176 /* Constructor */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */) ? createBranchLabel() : void 0;
|
|
41580
41596
|
currentExceptionTarget = void 0;
|
|
41581
41597
|
currentBreakTarget = void 0;
|
|
41582
41598
|
currentContinueTarget = void 0;
|
|
@@ -41596,7 +41612,7 @@ function createBinder() {
|
|
|
41596
41612
|
if (currentReturnTarget) {
|
|
41597
41613
|
addAntecedent(currentReturnTarget, currentFlow);
|
|
41598
41614
|
currentFlow = finishFlowLabel(currentReturnTarget);
|
|
41599
|
-
if (node.kind === 176 /* Constructor */ || node.kind === 175 /* ClassStaticBlockDeclaration */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */)) {
|
|
41615
|
+
if (isLambdaArgument && hasFlowMutation || node.kind === 176 /* Constructor */ || node.kind === 175 /* ClassStaticBlockDeclaration */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */)) {
|
|
41600
41616
|
node.returnFlowNode = currentFlow;
|
|
41601
41617
|
}
|
|
41602
41618
|
}
|
|
@@ -41876,7 +41892,7 @@ function createBinder() {
|
|
|
41876
41892
|
return createFlowNode(1024 /* ReduceLabel */, { target, antecedents }, antecedent);
|
|
41877
41893
|
}
|
|
41878
41894
|
function setFlowNodeReferenced(flow) {
|
|
41879
|
-
flow.flags |= flow.flags &
|
|
41895
|
+
flow.flags |= flow.flags & 4096 /* Referenced */ ? 8192 /* Shared */ : 4096 /* Referenced */;
|
|
41880
41896
|
}
|
|
41881
41897
|
function addAntecedent(label, antecedent) {
|
|
41882
41898
|
if (!(antecedent.flags & 1 /* Unreachable */) && !contains(label.antecedent, antecedent)) {
|
|
@@ -41907,6 +41923,7 @@ function createBinder() {
|
|
|
41907
41923
|
function createFlowMutation(flags, antecedent, node) {
|
|
41908
41924
|
setFlowNodeReferenced(antecedent);
|
|
41909
41925
|
hasFlowEffects = true;
|
|
41926
|
+
if (node.kind !== 260 /* VariableDeclaration */ && node.kind !== 208 /* BindingElement */) hasFlowMutation = true;
|
|
41910
41927
|
const result = createFlowNode(flags, node, antecedent);
|
|
41911
41928
|
if (currentExceptionTarget) {
|
|
41912
41929
|
addAntecedent(currentExceptionTarget, result);
|
|
@@ -41918,6 +41935,10 @@ function createBinder() {
|
|
|
41918
41935
|
hasFlowEffects = true;
|
|
41919
41936
|
return createFlowNode(512 /* Call */, node, antecedent);
|
|
41920
41937
|
}
|
|
41938
|
+
function createFlowLambdaArgs(antecedent, node) {
|
|
41939
|
+
setFlowNodeReferenced(antecedent);
|
|
41940
|
+
return createFlowNode(2048 /* LambdaArgs */, node, antecedent);
|
|
41941
|
+
}
|
|
41921
41942
|
function finishFlowLabel(flow) {
|
|
41922
41943
|
const antecedents = flow.antecedent;
|
|
41923
41944
|
if (!antecedents) {
|
|
@@ -42579,10 +42600,22 @@ function createBinder() {
|
|
|
42579
42600
|
bindEach(node.arguments);
|
|
42580
42601
|
bind(node.expression);
|
|
42581
42602
|
} else {
|
|
42582
|
-
|
|
42603
|
+
bind(node.expression);
|
|
42604
|
+
bindEach(node.typeArguments);
|
|
42605
|
+
let hasLambdaArgs = false;
|
|
42606
|
+
for (const arg of node.arguments) {
|
|
42607
|
+
const saveHasFlowMutation = hasFlowMutation;
|
|
42608
|
+
hasFlowMutation = false;
|
|
42609
|
+
bind(arg);
|
|
42610
|
+
hasLambdaArgs || (hasLambdaArgs = !!getLambdaArgument(arg) && hasFlowMutation);
|
|
42611
|
+
hasFlowMutation || (hasFlowMutation = saveHasFlowMutation);
|
|
42612
|
+
}
|
|
42583
42613
|
if (node.expression.kind === 108 /* SuperKeyword */) {
|
|
42584
42614
|
currentFlow = createFlowCall(currentFlow, node);
|
|
42585
42615
|
}
|
|
42616
|
+
if (hasLambdaArgs) {
|
|
42617
|
+
currentFlow = createFlowLambdaArgs(currentFlow, node);
|
|
42618
|
+
}
|
|
42586
42619
|
}
|
|
42587
42620
|
}
|
|
42588
42621
|
if (node.expression.kind === 211 /* PropertyAccessExpression */) {
|
|
@@ -45122,7 +45155,8 @@ var intrinsicTypeKinds = new Map(Object.entries({
|
|
|
45122
45155
|
Lowercase: 1 /* Lowercase */,
|
|
45123
45156
|
Capitalize: 2 /* Capitalize */,
|
|
45124
45157
|
Uncapitalize: 3 /* Uncapitalize */,
|
|
45125
|
-
NoInfer: 4 /* NoInfer
|
|
45158
|
+
NoInfer: 4 /* NoInfer */,
|
|
45159
|
+
Deferred: 5 /* Deferred */
|
|
45126
45160
|
}));
|
|
45127
45161
|
var SymbolLinks = class {
|
|
45128
45162
|
};
|
|
@@ -46086,6 +46120,7 @@ function createTypeChecker(host) {
|
|
|
46086
46120
|
var flowLoopStart = 0;
|
|
46087
46121
|
var flowLoopCount = 0;
|
|
46088
46122
|
var sharedFlowCount = 0;
|
|
46123
|
+
var mutationFlowCount = 0;
|
|
46089
46124
|
var flowAnalysisDisabled = false;
|
|
46090
46125
|
var flowInvocationCount = 0;
|
|
46091
46126
|
var lastFlowNode;
|
|
@@ -46117,6 +46152,8 @@ function createTypeChecker(host) {
|
|
|
46117
46152
|
var flowLoopTypes = [];
|
|
46118
46153
|
var sharedFlowNodes = [];
|
|
46119
46154
|
var sharedFlowTypes = [];
|
|
46155
|
+
var mutationFlowNodes = [];
|
|
46156
|
+
var mutationFlowStates = [];
|
|
46120
46157
|
var flowNodeReachable = [];
|
|
46121
46158
|
var flowNodePostSuper = [];
|
|
46122
46159
|
var potentialThisCollisions = [];
|
|
@@ -58290,7 +58327,7 @@ function createTypeChecker(host) {
|
|
|
58290
58327
|
if (type === intrinsicMarkerType) {
|
|
58291
58328
|
const typeKind = intrinsicTypeKinds.get(symbol.escapedName);
|
|
58292
58329
|
if (typeKind !== void 0 && typeArguments && typeArguments.length === 1) {
|
|
58293
|
-
return typeKind === 4 /* NoInfer */ ? getNoInferType(typeArguments[0]) : getStringMappingType(symbol, typeArguments[0]);
|
|
58330
|
+
return typeKind === 4 /* NoInfer */ ? getNoInferType(typeArguments[0]) : typeKind === 5 /* Deferred */ ? getDeferredCallbackType(typeArguments[0], aliasSymbol, aliasTypeArguments) : getStringMappingType(symbol, typeArguments[0]);
|
|
58294
58331
|
}
|
|
58295
58332
|
}
|
|
58296
58333
|
const links = getSymbolLinks(symbol);
|
|
@@ -58302,6 +58339,25 @@ function createTypeChecker(host) {
|
|
|
58302
58339
|
}
|
|
58303
58340
|
return instantiation;
|
|
58304
58341
|
}
|
|
58342
|
+
function getDeferredCallbackType(type, aliasSymbol, aliasTypeArguments) {
|
|
58343
|
+
if (type.flags & 524288 /* Object */) {
|
|
58344
|
+
const key = `F${getTypeId(type)}${getAliasId(aliasSymbol, aliasTypeArguments)}`;
|
|
58345
|
+
return getCachedType(key) ?? setCachedType(key, createDeferredCallbackType(type, aliasSymbol, aliasTypeArguments));
|
|
58346
|
+
}
|
|
58347
|
+
return type;
|
|
58348
|
+
}
|
|
58349
|
+
function createDeferredCallbackType(type, aliasSymbol, aliasTypeArguments) {
|
|
58350
|
+
const resolved = resolveStructuredTypeMembers(type);
|
|
58351
|
+
const result = createObjectType(16 /* Anonymous */ | 268435456 /* DeferredCallback */, type.symbol);
|
|
58352
|
+
result.members = resolved.members;
|
|
58353
|
+
result.properties = resolved.properties;
|
|
58354
|
+
result.callSignatures = resolved.callSignatures;
|
|
58355
|
+
result.constructSignatures = resolved.constructSignatures;
|
|
58356
|
+
result.indexInfos = resolved.indexInfos;
|
|
58357
|
+
result.aliasSymbol = aliasSymbol;
|
|
58358
|
+
result.aliasTypeArguments = aliasTypeArguments;
|
|
58359
|
+
return result;
|
|
58360
|
+
}
|
|
58305
58361
|
function getTypeFromTypeAliasReference(node, symbol) {
|
|
58306
58362
|
if (getCheckFlags(symbol) & 1048576 /* Unresolved */) {
|
|
58307
58363
|
const typeArguments = typeArgumentsFromTypeReferenceNode(node);
|
|
@@ -68115,7 +68171,7 @@ function createTypeChecker(host) {
|
|
|
68115
68171
|
return lastFlowNodeReachable;
|
|
68116
68172
|
}
|
|
68117
68173
|
const flags = flow.flags;
|
|
68118
|
-
if (flags &
|
|
68174
|
+
if (flags & 8192 /* Shared */) {
|
|
68119
68175
|
if (!noCacheCheck) {
|
|
68120
68176
|
const id = getFlowNodeId(flow);
|
|
68121
68177
|
const reachable = flowNodeReachable[id];
|
|
@@ -68127,7 +68183,7 @@ function createTypeChecker(host) {
|
|
|
68127
68183
|
}
|
|
68128
68184
|
noCacheCheck = false;
|
|
68129
68185
|
}
|
|
68130
|
-
if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */)) {
|
|
68186
|
+
if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */ | 2048 /* LambdaArgs */)) {
|
|
68131
68187
|
flow = flow.antecedent;
|
|
68132
68188
|
} else if (flags & 512 /* Call */) {
|
|
68133
68189
|
const signature = getEffectsSignature(flow.node);
|
|
@@ -68182,7 +68238,7 @@ function createTypeChecker(host) {
|
|
|
68182
68238
|
function isPostSuperFlowNode(flow, noCacheCheck) {
|
|
68183
68239
|
while (true) {
|
|
68184
68240
|
const flags = flow.flags;
|
|
68185
|
-
if (flags &
|
|
68241
|
+
if (flags & 8192 /* Shared */) {
|
|
68186
68242
|
if (!noCacheCheck) {
|
|
68187
68243
|
const id = getFlowNodeId(flow);
|
|
68188
68244
|
const postSuper = flowNodePostSuper[id];
|
|
@@ -68194,7 +68250,7 @@ function createTypeChecker(host) {
|
|
|
68194
68250
|
}
|
|
68195
68251
|
noCacheCheck = false;
|
|
68196
68252
|
}
|
|
68197
|
-
if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */ | 128 /* SwitchClause */)) {
|
|
68253
|
+
if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */ | 128 /* SwitchClause */ | 2048 /* LambdaArgs */)) {
|
|
68198
68254
|
flow = flow.antecedent;
|
|
68199
68255
|
} else if (flags & 512 /* Call */) {
|
|
68200
68256
|
if (flow.node.expression.kind === 108 /* SuperKeyword */) {
|
|
@@ -68248,6 +68304,7 @@ function createTypeChecker(host) {
|
|
|
68248
68304
|
function getFlowTypeOfReference(reference, declaredType, initialType = declaredType, flowContainer, flowNode = ((_a) => (_a = tryCast(reference, canHaveFlowNode)) == null ? void 0 : _a.flowNode)()) {
|
|
68249
68305
|
let key;
|
|
68250
68306
|
let isKeySet = false;
|
|
68307
|
+
let inLambdaArg = false;
|
|
68251
68308
|
let flowDepth = 0;
|
|
68252
68309
|
if (flowAnalysisDisabled) {
|
|
68253
68310
|
return errorType;
|
|
@@ -68257,8 +68314,10 @@ function createTypeChecker(host) {
|
|
|
68257
68314
|
}
|
|
68258
68315
|
flowInvocationCount++;
|
|
68259
68316
|
const sharedFlowStart = sharedFlowCount;
|
|
68317
|
+
const mutationFlowStart = mutationFlowCount;
|
|
68260
68318
|
const evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode));
|
|
68261
68319
|
sharedFlowCount = sharedFlowStart;
|
|
68320
|
+
mutationFlowCount = mutationFlowStart;
|
|
68262
68321
|
const resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType);
|
|
68263
68322
|
if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 235 /* NonNullExpression */ && !(resultType.flags & 131072 /* Never */) && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
|
|
68264
68323
|
return declaredType;
|
|
@@ -68283,7 +68342,7 @@ function createTypeChecker(host) {
|
|
|
68283
68342
|
let sharedFlow;
|
|
68284
68343
|
while (true) {
|
|
68285
68344
|
const flags = flow.flags;
|
|
68286
|
-
if (flags &
|
|
68345
|
+
if (flags & 8192 /* Shared */) {
|
|
68287
68346
|
for (let i = sharedFlowStart; i < sharedFlowCount; i++) {
|
|
68288
68347
|
if (sharedFlowNodes[i] === flow) {
|
|
68289
68348
|
flowDepth--;
|
|
@@ -68321,6 +68380,8 @@ function createTypeChecker(host) {
|
|
|
68321
68380
|
flow = flow.antecedent;
|
|
68322
68381
|
continue;
|
|
68323
68382
|
}
|
|
68383
|
+
} else if (flags & 2048 /* LambdaArgs */) {
|
|
68384
|
+
type = getTypeAtFlowLambdaArgs(flow);
|
|
68324
68385
|
} else if (flags & 1024 /* ReduceLabel */) {
|
|
68325
68386
|
const target = flow.node.target;
|
|
68326
68387
|
const saveAntecedents = target.antecedent;
|
|
@@ -68329,13 +68390,13 @@ function createTypeChecker(host) {
|
|
|
68329
68390
|
target.antecedent = saveAntecedents;
|
|
68330
68391
|
} else if (flags & 2 /* Start */) {
|
|
68331
68392
|
const container = flow.node;
|
|
68332
|
-
if (container && container !== flowContainer && reference.kind !== 211 /* PropertyAccessExpression */ && reference.kind !== 212 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 219 /* ArrowFunction */)) {
|
|
68393
|
+
if (container && container !== flowContainer && !inLambdaArg && reference.kind !== 211 /* PropertyAccessExpression */ && reference.kind !== 212 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 219 /* ArrowFunction */)) {
|
|
68333
68394
|
flow = container.flowNode;
|
|
68334
68395
|
continue;
|
|
68335
68396
|
}
|
|
68336
68397
|
type = initialType;
|
|
68337
68398
|
} else {
|
|
68338
|
-
type = convertAutoToAny(declaredType);
|
|
68399
|
+
type = inLambdaArg ? initialType : convertAutoToAny(declaredType);
|
|
68339
68400
|
}
|
|
68340
68401
|
if (sharedFlow) {
|
|
68341
68402
|
sharedFlowNodes[sharedFlowCount] = sharedFlow;
|
|
@@ -68439,6 +68500,117 @@ function createTypeChecker(host) {
|
|
|
68439
68500
|
}
|
|
68440
68501
|
return void 0;
|
|
68441
68502
|
}
|
|
68503
|
+
function getTypeAtFlowLambdaArgs(flow) {
|
|
68504
|
+
const flowType = getTypeAtFlowNode(flow.antecedent);
|
|
68505
|
+
const saveInitialType = initialType;
|
|
68506
|
+
initialType = getTypeFromFlowType(flowType);
|
|
68507
|
+
let lambdaTypes;
|
|
68508
|
+
if (initialType !== declaredType) {
|
|
68509
|
+
const saveInLambdaArg = inLambdaArg;
|
|
68510
|
+
inLambdaArg = true;
|
|
68511
|
+
const args = flow.node.arguments;
|
|
68512
|
+
let signatures;
|
|
68513
|
+
for (let i = 0; i < args.length; i++) {
|
|
68514
|
+
const lambda = getLambdaArgument(args[i]);
|
|
68515
|
+
if (lambda && lambda.returnFlowNode && isMutationFlowNode(
|
|
68516
|
+
lambda.returnFlowNode,
|
|
68517
|
+
/*noCacheCheck*/
|
|
68518
|
+
false
|
|
68519
|
+
)) {
|
|
68520
|
+
signatures ?? (signatures = getSignaturesOfType(getTypeOfExpression(flow.node.expression), 0 /* Call */));
|
|
68521
|
+
if (!some(signatures, (sig) => !!(getObjectFlags(getTypeAtPosition(sig, i)) & 268435456 /* DeferredCallback */))) {
|
|
68522
|
+
const lambdaType = getTypeFromFlowType(getTypeAtFlowNode(lambda.returnFlowNode));
|
|
68523
|
+
if (lambdaType !== initialType) {
|
|
68524
|
+
lambdaTypes ?? (lambdaTypes = [initialType]);
|
|
68525
|
+
lambdaTypes.push(lambdaType);
|
|
68526
|
+
}
|
|
68527
|
+
}
|
|
68528
|
+
}
|
|
68529
|
+
}
|
|
68530
|
+
inLambdaArg = saveInLambdaArg;
|
|
68531
|
+
}
|
|
68532
|
+
initialType = saveInitialType;
|
|
68533
|
+
return lambdaTypes ? createFlowType(getUnionOrEvolvingArrayType(lambdaTypes, 1 /* Literal */), isIncomplete(flowType)) : flowType;
|
|
68534
|
+
}
|
|
68535
|
+
function isMutationFlowNode(flow, noCacheCheck) {
|
|
68536
|
+
while (true) {
|
|
68537
|
+
const flags = flow.flags;
|
|
68538
|
+
if (flags & 8192 /* Shared */) {
|
|
68539
|
+
if (!noCacheCheck) {
|
|
68540
|
+
let cached = getMutationStateForFlowNode(flow);
|
|
68541
|
+
if (cached === void 0) {
|
|
68542
|
+
setMutationStateForFlowNode(flow, cached = isMutationFlowNode(
|
|
68543
|
+
flow,
|
|
68544
|
+
/*noCacheCheck*/
|
|
68545
|
+
true
|
|
68546
|
+
));
|
|
68547
|
+
}
|
|
68548
|
+
return cached;
|
|
68549
|
+
}
|
|
68550
|
+
noCacheCheck = false;
|
|
68551
|
+
}
|
|
68552
|
+
if (flags & 16 /* Assignment */) {
|
|
68553
|
+
if (isOrContainsMatchingReference(reference, flow.node)) {
|
|
68554
|
+
return true;
|
|
68555
|
+
}
|
|
68556
|
+
} else if (flags & 4 /* BranchLabel */) {
|
|
68557
|
+
return some(flow.antecedent, (f) => isMutationFlowNode(
|
|
68558
|
+
f,
|
|
68559
|
+
/*noCacheCheck*/
|
|
68560
|
+
false
|
|
68561
|
+
));
|
|
68562
|
+
} else if (flags & 8 /* LoopLabel */) {
|
|
68563
|
+
let cached = getMutationStateForFlowNode(flow);
|
|
68564
|
+
if (cached === void 0) {
|
|
68565
|
+
const index = setMutationStateForFlowNode(flow, false);
|
|
68566
|
+
cached = mutationFlowStates[index] = some(flow.antecedent, (f) => isMutationFlowNode(
|
|
68567
|
+
f,
|
|
68568
|
+
/*noCacheCheck*/
|
|
68569
|
+
false
|
|
68570
|
+
));
|
|
68571
|
+
}
|
|
68572
|
+
return cached;
|
|
68573
|
+
} else if (flags & 256 /* ArrayMutation */) {
|
|
68574
|
+
if (declaredType === autoType || declaredType === autoArrayType) {
|
|
68575
|
+
const node = flow.node;
|
|
68576
|
+
const expr = node.kind === 213 /* CallExpression */ ? node.expression.expression : node.left.expression;
|
|
68577
|
+
if (isMatchingReference(reference, getReferenceCandidate(expr))) {
|
|
68578
|
+
return true;
|
|
68579
|
+
}
|
|
68580
|
+
}
|
|
68581
|
+
} else if (flags & 2048 /* LambdaArgs */) {
|
|
68582
|
+
const mutation = some(flow.node.arguments, (arg) => {
|
|
68583
|
+
const lambda = getLambdaArgument(arg);
|
|
68584
|
+
return !!(lambda && lambda.returnFlowNode && isMutationFlowNode(
|
|
68585
|
+
lambda.returnFlowNode,
|
|
68586
|
+
/*noCacheCheck*/
|
|
68587
|
+
false
|
|
68588
|
+
));
|
|
68589
|
+
});
|
|
68590
|
+
if (mutation) {
|
|
68591
|
+
return true;
|
|
68592
|
+
}
|
|
68593
|
+
} else if (!(flags & (512 /* Call */ | 96 /* Condition */ | 128 /* SwitchClause */ | 1024 /* ReduceLabel */))) {
|
|
68594
|
+
return false;
|
|
68595
|
+
}
|
|
68596
|
+
flow = flow.antecedent;
|
|
68597
|
+
}
|
|
68598
|
+
}
|
|
68599
|
+
function getMutationStateForFlowNode(flow) {
|
|
68600
|
+
for (let i = mutationFlowStart; i < mutationFlowCount; i++) {
|
|
68601
|
+
if (mutationFlowNodes[i] === flow) {
|
|
68602
|
+
return mutationFlowStates[i];
|
|
68603
|
+
}
|
|
68604
|
+
}
|
|
68605
|
+
return void 0;
|
|
68606
|
+
}
|
|
68607
|
+
function setMutationStateForFlowNode(flow, state) {
|
|
68608
|
+
const index = mutationFlowCount;
|
|
68609
|
+
mutationFlowNodes[index] = flow;
|
|
68610
|
+
mutationFlowStates[index] = state;
|
|
68611
|
+
mutationFlowCount++;
|
|
68612
|
+
return index;
|
|
68613
|
+
}
|
|
68442
68614
|
function getTypeAtFlowArrayMutation(flow) {
|
|
68443
68615
|
if (declaredType === autoType || declaredType === autoArrayType) {
|
|
68444
68616
|
const node = flow.node;
|
|
@@ -118984,8 +119156,7 @@ function getConfigFileParsingDiagnostics(configFileParseResult) {
|
|
|
118984
119156
|
return configFileParseResult.options.configFile ? [...configFileParseResult.options.configFile.parseDiagnostics, ...configFileParseResult.errors] : configFileParseResult.errors;
|
|
118985
119157
|
}
|
|
118986
119158
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
118987
|
-
|
|
118988
|
-
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || pathContainsNodeModules(fileName)) && fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
119159
|
+
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
118989
119160
|
function lookupFromPackageJson() {
|
|
118990
119161
|
const state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
118991
119162
|
const packageJsonLocations = [];
|
package/lib/typescript.d.ts
CHANGED
|
@@ -6648,6 +6648,7 @@ declare namespace ts {
|
|
|
6648
6648
|
ObjectRestType = 4194304,
|
|
6649
6649
|
InstantiationExpressionType = 8388608,
|
|
6650
6650
|
SingleSignatureType = 134217728,
|
|
6651
|
+
DeferredCallback = 268435456,
|
|
6651
6652
|
}
|
|
6652
6653
|
interface ObjectType extends Type {
|
|
6653
6654
|
objectFlags: ObjectFlags;
|
package/lib/typescript.js
CHANGED
|
@@ -873,6 +873,7 @@ __export(typescript_exports, {
|
|
|
873
873
|
getJSXRuntimeImport: () => getJSXRuntimeImport,
|
|
874
874
|
getJSXTransformEnabled: () => getJSXTransformEnabled,
|
|
875
875
|
getKeyForCompilerOptions: () => getKeyForCompilerOptions,
|
|
876
|
+
getLambdaArgument: () => getLambdaArgument,
|
|
876
877
|
getLanguageVariant: () => getLanguageVariant,
|
|
877
878
|
getLastChild: () => getLastChild,
|
|
878
879
|
getLeadingCommentRanges: () => getLeadingCommentRanges,
|
|
@@ -4383,7 +4384,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
4383
4384
|
__tsDebuggerDisplay: {
|
|
4384
4385
|
value() {
|
|
4385
4386
|
const flowHeader = this.flags & 2 /* Start */ ? "FlowStart" : this.flags & 4 /* BranchLabel */ ? "FlowBranchLabel" : this.flags & 8 /* LoopLabel */ ? "FlowLoopLabel" : this.flags & 16 /* Assignment */ ? "FlowAssignment" : this.flags & 32 /* TrueCondition */ ? "FlowTrueCondition" : this.flags & 64 /* FalseCondition */ ? "FlowFalseCondition" : this.flags & 128 /* SwitchClause */ ? "FlowSwitchClause" : this.flags & 256 /* ArrayMutation */ ? "FlowArrayMutation" : this.flags & 512 /* Call */ ? "FlowCall" : this.flags & 1024 /* ReduceLabel */ ? "FlowReduceLabel" : this.flags & 1 /* Unreachable */ ? "FlowUnreachable" : "UnknownFlow";
|
|
4386
|
-
const remainingFlags = this.flags & ~(
|
|
4387
|
+
const remainingFlags = this.flags & ~(4096 /* Referenced */ - 1);
|
|
4387
4388
|
return `${flowHeader}${remainingFlags ? ` (${formatFlowFlags(remainingFlags)})` : ""}`;
|
|
4388
4389
|
}
|
|
4389
4390
|
},
|
|
@@ -6255,8 +6256,9 @@ var FlowFlags = /* @__PURE__ */ ((FlowFlags2) => {
|
|
|
6255
6256
|
FlowFlags2[FlowFlags2["ArrayMutation"] = 256] = "ArrayMutation";
|
|
6256
6257
|
FlowFlags2[FlowFlags2["Call"] = 512] = "Call";
|
|
6257
6258
|
FlowFlags2[FlowFlags2["ReduceLabel"] = 1024] = "ReduceLabel";
|
|
6258
|
-
FlowFlags2[FlowFlags2["
|
|
6259
|
-
FlowFlags2[FlowFlags2["
|
|
6259
|
+
FlowFlags2[FlowFlags2["LambdaArgs"] = 2048] = "LambdaArgs";
|
|
6260
|
+
FlowFlags2[FlowFlags2["Referenced"] = 4096] = "Referenced";
|
|
6261
|
+
FlowFlags2[FlowFlags2["Shared"] = 8192] = "Shared";
|
|
6260
6262
|
FlowFlags2[FlowFlags2["Label"] = 12] = "Label";
|
|
6261
6263
|
FlowFlags2[FlowFlags2["Condition"] = 96] = "Condition";
|
|
6262
6264
|
return FlowFlags2;
|
|
@@ -6691,10 +6693,11 @@ var ObjectFlags = /* @__PURE__ */ ((ObjectFlags3) => {
|
|
|
6691
6693
|
ObjectFlags3[ObjectFlags3["ContainsSpread"] = 2097152] = "ContainsSpread";
|
|
6692
6694
|
ObjectFlags3[ObjectFlags3["ObjectRestType"] = 4194304] = "ObjectRestType";
|
|
6693
6695
|
ObjectFlags3[ObjectFlags3["InstantiationExpressionType"] = 8388608] = "InstantiationExpressionType";
|
|
6694
|
-
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
6695
6696
|
ObjectFlags3[ObjectFlags3["IsClassInstanceClone"] = 16777216] = "IsClassInstanceClone";
|
|
6696
6697
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeCalculated"] = 33554432] = "IdenticalBaseTypeCalculated";
|
|
6697
6698
|
ObjectFlags3[ObjectFlags3["IdenticalBaseTypeExists"] = 67108864] = "IdenticalBaseTypeExists";
|
|
6699
|
+
ObjectFlags3[ObjectFlags3["SingleSignatureType"] = 134217728] = "SingleSignatureType";
|
|
6700
|
+
ObjectFlags3[ObjectFlags3["DeferredCallback"] = 268435456] = "DeferredCallback";
|
|
6698
6701
|
ObjectFlags3[ObjectFlags3["IsGenericTypeComputed"] = 2097152] = "IsGenericTypeComputed";
|
|
6699
6702
|
ObjectFlags3[ObjectFlags3["IsGenericObjectType"] = 4194304] = "IsGenericObjectType";
|
|
6700
6703
|
ObjectFlags3[ObjectFlags3["IsGenericIndexType"] = 8388608] = "IsGenericIndexType";
|
|
@@ -23613,6 +23616,16 @@ function hasInferredType(node) {
|
|
|
23613
23616
|
return false;
|
|
23614
23617
|
}
|
|
23615
23618
|
}
|
|
23619
|
+
function getLambdaArgument(node) {
|
|
23620
|
+
switch (node.kind) {
|
|
23621
|
+
case 218 /* FunctionExpression */:
|
|
23622
|
+
case 219 /* ArrowFunction */:
|
|
23623
|
+
return !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken ? node : void 0;
|
|
23624
|
+
case 217 /* ParenthesizedExpression */:
|
|
23625
|
+
return getLambdaArgument(node.expression);
|
|
23626
|
+
}
|
|
23627
|
+
return void 0;
|
|
23628
|
+
}
|
|
23616
23629
|
|
|
23617
23630
|
// src/compiler/factory/baseNodeFactory.ts
|
|
23618
23631
|
function createBaseNodeFactory() {
|
|
@@ -45906,6 +45919,7 @@ function createBinder() {
|
|
|
45906
45919
|
var activeLabelList;
|
|
45907
45920
|
var hasExplicitReturn;
|
|
45908
45921
|
var hasFlowEffects;
|
|
45922
|
+
var hasFlowMutation;
|
|
45909
45923
|
var emitFlags;
|
|
45910
45924
|
var inStrictMode;
|
|
45911
45925
|
var inAssignmentPattern = false;
|
|
@@ -45978,6 +45992,7 @@ function createBinder() {
|
|
|
45978
45992
|
activeLabelList = void 0;
|
|
45979
45993
|
hasExplicitReturn = false;
|
|
45980
45994
|
hasFlowEffects = false;
|
|
45995
|
+
hasFlowMutation = false;
|
|
45981
45996
|
inAssignmentPattern = false;
|
|
45982
45997
|
emitFlags = 0 /* None */;
|
|
45983
45998
|
}
|
|
@@ -46236,7 +46251,9 @@ function createBinder() {
|
|
|
46236
46251
|
const saveExceptionTarget = currentExceptionTarget;
|
|
46237
46252
|
const saveActiveLabelList = activeLabelList;
|
|
46238
46253
|
const saveHasExplicitReturn = hasExplicitReturn;
|
|
46239
|
-
const
|
|
46254
|
+
const isRegularFunctionExpression = containerFlags & 16 /* IsFunctionExpression */ && !hasSyntacticModifier(node, 1024 /* Async */) && !node.asteriskToken;
|
|
46255
|
+
const isImmediatelyInvoked = isRegularFunctionExpression && !!getImmediatelyInvokedFunctionExpression(node) || node.kind === 175 /* ClassStaticBlockDeclaration */;
|
|
46256
|
+
const isLambdaArgument = isRegularFunctionExpression && walkUpParenthesizedExpressions(node.parent).kind === 213 /* CallExpression */;
|
|
46240
46257
|
if (!isImmediatelyInvoked) {
|
|
46241
46258
|
currentFlow = createFlowNode(
|
|
46242
46259
|
2 /* Start */,
|
|
@@ -46249,7 +46266,7 @@ function createBinder() {
|
|
|
46249
46266
|
currentFlow.node = node;
|
|
46250
46267
|
}
|
|
46251
46268
|
}
|
|
46252
|
-
currentReturnTarget = isImmediatelyInvoked || node.kind === 176 /* Constructor */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */) ? createBranchLabel() : void 0;
|
|
46269
|
+
currentReturnTarget = isImmediatelyInvoked || isLambdaArgument || node.kind === 176 /* Constructor */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */) ? createBranchLabel() : void 0;
|
|
46253
46270
|
currentExceptionTarget = void 0;
|
|
46254
46271
|
currentBreakTarget = void 0;
|
|
46255
46272
|
currentContinueTarget = void 0;
|
|
@@ -46269,7 +46286,7 @@ function createBinder() {
|
|
|
46269
46286
|
if (currentReturnTarget) {
|
|
46270
46287
|
addAntecedent(currentReturnTarget, currentFlow);
|
|
46271
46288
|
currentFlow = finishFlowLabel(currentReturnTarget);
|
|
46272
|
-
if (node.kind === 176 /* Constructor */ || node.kind === 175 /* ClassStaticBlockDeclaration */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */)) {
|
|
46289
|
+
if (isLambdaArgument && hasFlowMutation || node.kind === 176 /* Constructor */ || node.kind === 175 /* ClassStaticBlockDeclaration */ || isInJSFile(node) && (node.kind === 262 /* FunctionDeclaration */ || node.kind === 218 /* FunctionExpression */)) {
|
|
46273
46290
|
node.returnFlowNode = currentFlow;
|
|
46274
46291
|
}
|
|
46275
46292
|
}
|
|
@@ -46549,7 +46566,7 @@ function createBinder() {
|
|
|
46549
46566
|
return createFlowNode(1024 /* ReduceLabel */, { target, antecedents }, antecedent);
|
|
46550
46567
|
}
|
|
46551
46568
|
function setFlowNodeReferenced(flow) {
|
|
46552
|
-
flow.flags |= flow.flags &
|
|
46569
|
+
flow.flags |= flow.flags & 4096 /* Referenced */ ? 8192 /* Shared */ : 4096 /* Referenced */;
|
|
46553
46570
|
}
|
|
46554
46571
|
function addAntecedent(label, antecedent) {
|
|
46555
46572
|
if (!(antecedent.flags & 1 /* Unreachable */) && !contains(label.antecedent, antecedent)) {
|
|
@@ -46580,6 +46597,7 @@ function createBinder() {
|
|
|
46580
46597
|
function createFlowMutation(flags, antecedent, node) {
|
|
46581
46598
|
setFlowNodeReferenced(antecedent);
|
|
46582
46599
|
hasFlowEffects = true;
|
|
46600
|
+
if (node.kind !== 260 /* VariableDeclaration */ && node.kind !== 208 /* BindingElement */) hasFlowMutation = true;
|
|
46583
46601
|
const result = createFlowNode(flags, node, antecedent);
|
|
46584
46602
|
if (currentExceptionTarget) {
|
|
46585
46603
|
addAntecedent(currentExceptionTarget, result);
|
|
@@ -46591,6 +46609,10 @@ function createBinder() {
|
|
|
46591
46609
|
hasFlowEffects = true;
|
|
46592
46610
|
return createFlowNode(512 /* Call */, node, antecedent);
|
|
46593
46611
|
}
|
|
46612
|
+
function createFlowLambdaArgs(antecedent, node) {
|
|
46613
|
+
setFlowNodeReferenced(antecedent);
|
|
46614
|
+
return createFlowNode(2048 /* LambdaArgs */, node, antecedent);
|
|
46615
|
+
}
|
|
46594
46616
|
function finishFlowLabel(flow) {
|
|
46595
46617
|
const antecedents = flow.antecedent;
|
|
46596
46618
|
if (!antecedents) {
|
|
@@ -47252,10 +47274,22 @@ function createBinder() {
|
|
|
47252
47274
|
bindEach(node.arguments);
|
|
47253
47275
|
bind(node.expression);
|
|
47254
47276
|
} else {
|
|
47255
|
-
|
|
47277
|
+
bind(node.expression);
|
|
47278
|
+
bindEach(node.typeArguments);
|
|
47279
|
+
let hasLambdaArgs = false;
|
|
47280
|
+
for (const arg of node.arguments) {
|
|
47281
|
+
const saveHasFlowMutation = hasFlowMutation;
|
|
47282
|
+
hasFlowMutation = false;
|
|
47283
|
+
bind(arg);
|
|
47284
|
+
hasLambdaArgs || (hasLambdaArgs = !!getLambdaArgument(arg) && hasFlowMutation);
|
|
47285
|
+
hasFlowMutation || (hasFlowMutation = saveHasFlowMutation);
|
|
47286
|
+
}
|
|
47256
47287
|
if (node.expression.kind === 108 /* SuperKeyword */) {
|
|
47257
47288
|
currentFlow = createFlowCall(currentFlow, node);
|
|
47258
47289
|
}
|
|
47290
|
+
if (hasLambdaArgs) {
|
|
47291
|
+
currentFlow = createFlowLambdaArgs(currentFlow, node);
|
|
47292
|
+
}
|
|
47259
47293
|
}
|
|
47260
47294
|
}
|
|
47261
47295
|
if (node.expression.kind === 211 /* PropertyAccessExpression */) {
|
|
@@ -49895,7 +49929,8 @@ var intrinsicTypeKinds = new Map(Object.entries({
|
|
|
49895
49929
|
Lowercase: 1 /* Lowercase */,
|
|
49896
49930
|
Capitalize: 2 /* Capitalize */,
|
|
49897
49931
|
Uncapitalize: 3 /* Uncapitalize */,
|
|
49898
|
-
NoInfer: 4 /* NoInfer
|
|
49932
|
+
NoInfer: 4 /* NoInfer */,
|
|
49933
|
+
Deferred: 5 /* Deferred */
|
|
49899
49934
|
}));
|
|
49900
49935
|
var SymbolLinks = class {
|
|
49901
49936
|
};
|
|
@@ -50859,6 +50894,7 @@ function createTypeChecker(host) {
|
|
|
50859
50894
|
var flowLoopStart = 0;
|
|
50860
50895
|
var flowLoopCount = 0;
|
|
50861
50896
|
var sharedFlowCount = 0;
|
|
50897
|
+
var mutationFlowCount = 0;
|
|
50862
50898
|
var flowAnalysisDisabled = false;
|
|
50863
50899
|
var flowInvocationCount = 0;
|
|
50864
50900
|
var lastFlowNode;
|
|
@@ -50890,6 +50926,8 @@ function createTypeChecker(host) {
|
|
|
50890
50926
|
var flowLoopTypes = [];
|
|
50891
50927
|
var sharedFlowNodes = [];
|
|
50892
50928
|
var sharedFlowTypes = [];
|
|
50929
|
+
var mutationFlowNodes = [];
|
|
50930
|
+
var mutationFlowStates = [];
|
|
50893
50931
|
var flowNodeReachable = [];
|
|
50894
50932
|
var flowNodePostSuper = [];
|
|
50895
50933
|
var potentialThisCollisions = [];
|
|
@@ -63063,7 +63101,7 @@ function createTypeChecker(host) {
|
|
|
63063
63101
|
if (type === intrinsicMarkerType) {
|
|
63064
63102
|
const typeKind = intrinsicTypeKinds.get(symbol.escapedName);
|
|
63065
63103
|
if (typeKind !== void 0 && typeArguments && typeArguments.length === 1) {
|
|
63066
|
-
return typeKind === 4 /* NoInfer */ ? getNoInferType(typeArguments[0]) : getStringMappingType(symbol, typeArguments[0]);
|
|
63104
|
+
return typeKind === 4 /* NoInfer */ ? getNoInferType(typeArguments[0]) : typeKind === 5 /* Deferred */ ? getDeferredCallbackType(typeArguments[0], aliasSymbol, aliasTypeArguments) : getStringMappingType(symbol, typeArguments[0]);
|
|
63067
63105
|
}
|
|
63068
63106
|
}
|
|
63069
63107
|
const links = getSymbolLinks(symbol);
|
|
@@ -63075,6 +63113,25 @@ function createTypeChecker(host) {
|
|
|
63075
63113
|
}
|
|
63076
63114
|
return instantiation;
|
|
63077
63115
|
}
|
|
63116
|
+
function getDeferredCallbackType(type, aliasSymbol, aliasTypeArguments) {
|
|
63117
|
+
if (type.flags & 524288 /* Object */) {
|
|
63118
|
+
const key = `F${getTypeId(type)}${getAliasId(aliasSymbol, aliasTypeArguments)}`;
|
|
63119
|
+
return getCachedType(key) ?? setCachedType(key, createDeferredCallbackType(type, aliasSymbol, aliasTypeArguments));
|
|
63120
|
+
}
|
|
63121
|
+
return type;
|
|
63122
|
+
}
|
|
63123
|
+
function createDeferredCallbackType(type, aliasSymbol, aliasTypeArguments) {
|
|
63124
|
+
const resolved = resolveStructuredTypeMembers(type);
|
|
63125
|
+
const result = createObjectType(16 /* Anonymous */ | 268435456 /* DeferredCallback */, type.symbol);
|
|
63126
|
+
result.members = resolved.members;
|
|
63127
|
+
result.properties = resolved.properties;
|
|
63128
|
+
result.callSignatures = resolved.callSignatures;
|
|
63129
|
+
result.constructSignatures = resolved.constructSignatures;
|
|
63130
|
+
result.indexInfos = resolved.indexInfos;
|
|
63131
|
+
result.aliasSymbol = aliasSymbol;
|
|
63132
|
+
result.aliasTypeArguments = aliasTypeArguments;
|
|
63133
|
+
return result;
|
|
63134
|
+
}
|
|
63078
63135
|
function getTypeFromTypeAliasReference(node, symbol) {
|
|
63079
63136
|
if (getCheckFlags(symbol) & 1048576 /* Unresolved */) {
|
|
63080
63137
|
const typeArguments = typeArgumentsFromTypeReferenceNode(node);
|
|
@@ -72888,7 +72945,7 @@ function createTypeChecker(host) {
|
|
|
72888
72945
|
return lastFlowNodeReachable;
|
|
72889
72946
|
}
|
|
72890
72947
|
const flags = flow.flags;
|
|
72891
|
-
if (flags &
|
|
72948
|
+
if (flags & 8192 /* Shared */) {
|
|
72892
72949
|
if (!noCacheCheck) {
|
|
72893
72950
|
const id = getFlowNodeId(flow);
|
|
72894
72951
|
const reachable = flowNodeReachable[id];
|
|
@@ -72900,7 +72957,7 @@ function createTypeChecker(host) {
|
|
|
72900
72957
|
}
|
|
72901
72958
|
noCacheCheck = false;
|
|
72902
72959
|
}
|
|
72903
|
-
if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */)) {
|
|
72960
|
+
if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */ | 2048 /* LambdaArgs */)) {
|
|
72904
72961
|
flow = flow.antecedent;
|
|
72905
72962
|
} else if (flags & 512 /* Call */) {
|
|
72906
72963
|
const signature = getEffectsSignature(flow.node);
|
|
@@ -72955,7 +73012,7 @@ function createTypeChecker(host) {
|
|
|
72955
73012
|
function isPostSuperFlowNode(flow, noCacheCheck) {
|
|
72956
73013
|
while (true) {
|
|
72957
73014
|
const flags = flow.flags;
|
|
72958
|
-
if (flags &
|
|
73015
|
+
if (flags & 8192 /* Shared */) {
|
|
72959
73016
|
if (!noCacheCheck) {
|
|
72960
73017
|
const id = getFlowNodeId(flow);
|
|
72961
73018
|
const postSuper = flowNodePostSuper[id];
|
|
@@ -72967,7 +73024,7 @@ function createTypeChecker(host) {
|
|
|
72967
73024
|
}
|
|
72968
73025
|
noCacheCheck = false;
|
|
72969
73026
|
}
|
|
72970
|
-
if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */ | 128 /* SwitchClause */)) {
|
|
73027
|
+
if (flags & (16 /* Assignment */ | 96 /* Condition */ | 256 /* ArrayMutation */ | 128 /* SwitchClause */ | 2048 /* LambdaArgs */)) {
|
|
72971
73028
|
flow = flow.antecedent;
|
|
72972
73029
|
} else if (flags & 512 /* Call */) {
|
|
72973
73030
|
if (flow.node.expression.kind === 108 /* SuperKeyword */) {
|
|
@@ -73021,6 +73078,7 @@ function createTypeChecker(host) {
|
|
|
73021
73078
|
function getFlowTypeOfReference(reference, declaredType, initialType = declaredType, flowContainer, flowNode = ((_a) => (_a = tryCast(reference, canHaveFlowNode)) == null ? void 0 : _a.flowNode)()) {
|
|
73022
73079
|
let key;
|
|
73023
73080
|
let isKeySet = false;
|
|
73081
|
+
let inLambdaArg = false;
|
|
73024
73082
|
let flowDepth = 0;
|
|
73025
73083
|
if (flowAnalysisDisabled) {
|
|
73026
73084
|
return errorType;
|
|
@@ -73030,8 +73088,10 @@ function createTypeChecker(host) {
|
|
|
73030
73088
|
}
|
|
73031
73089
|
flowInvocationCount++;
|
|
73032
73090
|
const sharedFlowStart = sharedFlowCount;
|
|
73091
|
+
const mutationFlowStart = mutationFlowCount;
|
|
73033
73092
|
const evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode));
|
|
73034
73093
|
sharedFlowCount = sharedFlowStart;
|
|
73094
|
+
mutationFlowCount = mutationFlowStart;
|
|
73035
73095
|
const resultType = getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType);
|
|
73036
73096
|
if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 235 /* NonNullExpression */ && !(resultType.flags & 131072 /* Never */) && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
|
|
73037
73097
|
return declaredType;
|
|
@@ -73056,7 +73116,7 @@ function createTypeChecker(host) {
|
|
|
73056
73116
|
let sharedFlow;
|
|
73057
73117
|
while (true) {
|
|
73058
73118
|
const flags = flow.flags;
|
|
73059
|
-
if (flags &
|
|
73119
|
+
if (flags & 8192 /* Shared */) {
|
|
73060
73120
|
for (let i = sharedFlowStart; i < sharedFlowCount; i++) {
|
|
73061
73121
|
if (sharedFlowNodes[i] === flow) {
|
|
73062
73122
|
flowDepth--;
|
|
@@ -73094,6 +73154,8 @@ function createTypeChecker(host) {
|
|
|
73094
73154
|
flow = flow.antecedent;
|
|
73095
73155
|
continue;
|
|
73096
73156
|
}
|
|
73157
|
+
} else if (flags & 2048 /* LambdaArgs */) {
|
|
73158
|
+
type = getTypeAtFlowLambdaArgs(flow);
|
|
73097
73159
|
} else if (flags & 1024 /* ReduceLabel */) {
|
|
73098
73160
|
const target = flow.node.target;
|
|
73099
73161
|
const saveAntecedents = target.antecedent;
|
|
@@ -73102,13 +73164,13 @@ function createTypeChecker(host) {
|
|
|
73102
73164
|
target.antecedent = saveAntecedents;
|
|
73103
73165
|
} else if (flags & 2 /* Start */) {
|
|
73104
73166
|
const container = flow.node;
|
|
73105
|
-
if (container && container !== flowContainer && reference.kind !== 211 /* PropertyAccessExpression */ && reference.kind !== 212 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 219 /* ArrowFunction */)) {
|
|
73167
|
+
if (container && container !== flowContainer && !inLambdaArg && reference.kind !== 211 /* PropertyAccessExpression */ && reference.kind !== 212 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 219 /* ArrowFunction */)) {
|
|
73106
73168
|
flow = container.flowNode;
|
|
73107
73169
|
continue;
|
|
73108
73170
|
}
|
|
73109
73171
|
type = initialType;
|
|
73110
73172
|
} else {
|
|
73111
|
-
type = convertAutoToAny(declaredType);
|
|
73173
|
+
type = inLambdaArg ? initialType : convertAutoToAny(declaredType);
|
|
73112
73174
|
}
|
|
73113
73175
|
if (sharedFlow) {
|
|
73114
73176
|
sharedFlowNodes[sharedFlowCount] = sharedFlow;
|
|
@@ -73212,6 +73274,117 @@ function createTypeChecker(host) {
|
|
|
73212
73274
|
}
|
|
73213
73275
|
return void 0;
|
|
73214
73276
|
}
|
|
73277
|
+
function getTypeAtFlowLambdaArgs(flow) {
|
|
73278
|
+
const flowType = getTypeAtFlowNode(flow.antecedent);
|
|
73279
|
+
const saveInitialType = initialType;
|
|
73280
|
+
initialType = getTypeFromFlowType(flowType);
|
|
73281
|
+
let lambdaTypes;
|
|
73282
|
+
if (initialType !== declaredType) {
|
|
73283
|
+
const saveInLambdaArg = inLambdaArg;
|
|
73284
|
+
inLambdaArg = true;
|
|
73285
|
+
const args = flow.node.arguments;
|
|
73286
|
+
let signatures;
|
|
73287
|
+
for (let i = 0; i < args.length; i++) {
|
|
73288
|
+
const lambda = getLambdaArgument(args[i]);
|
|
73289
|
+
if (lambda && lambda.returnFlowNode && isMutationFlowNode(
|
|
73290
|
+
lambda.returnFlowNode,
|
|
73291
|
+
/*noCacheCheck*/
|
|
73292
|
+
false
|
|
73293
|
+
)) {
|
|
73294
|
+
signatures ?? (signatures = getSignaturesOfType(getTypeOfExpression(flow.node.expression), 0 /* Call */));
|
|
73295
|
+
if (!some(signatures, (sig) => !!(getObjectFlags(getTypeAtPosition(sig, i)) & 268435456 /* DeferredCallback */))) {
|
|
73296
|
+
const lambdaType = getTypeFromFlowType(getTypeAtFlowNode(lambda.returnFlowNode));
|
|
73297
|
+
if (lambdaType !== initialType) {
|
|
73298
|
+
lambdaTypes ?? (lambdaTypes = [initialType]);
|
|
73299
|
+
lambdaTypes.push(lambdaType);
|
|
73300
|
+
}
|
|
73301
|
+
}
|
|
73302
|
+
}
|
|
73303
|
+
}
|
|
73304
|
+
inLambdaArg = saveInLambdaArg;
|
|
73305
|
+
}
|
|
73306
|
+
initialType = saveInitialType;
|
|
73307
|
+
return lambdaTypes ? createFlowType(getUnionOrEvolvingArrayType(lambdaTypes, 1 /* Literal */), isIncomplete(flowType)) : flowType;
|
|
73308
|
+
}
|
|
73309
|
+
function isMutationFlowNode(flow, noCacheCheck) {
|
|
73310
|
+
while (true) {
|
|
73311
|
+
const flags = flow.flags;
|
|
73312
|
+
if (flags & 8192 /* Shared */) {
|
|
73313
|
+
if (!noCacheCheck) {
|
|
73314
|
+
let cached = getMutationStateForFlowNode(flow);
|
|
73315
|
+
if (cached === void 0) {
|
|
73316
|
+
setMutationStateForFlowNode(flow, cached = isMutationFlowNode(
|
|
73317
|
+
flow,
|
|
73318
|
+
/*noCacheCheck*/
|
|
73319
|
+
true
|
|
73320
|
+
));
|
|
73321
|
+
}
|
|
73322
|
+
return cached;
|
|
73323
|
+
}
|
|
73324
|
+
noCacheCheck = false;
|
|
73325
|
+
}
|
|
73326
|
+
if (flags & 16 /* Assignment */) {
|
|
73327
|
+
if (isOrContainsMatchingReference(reference, flow.node)) {
|
|
73328
|
+
return true;
|
|
73329
|
+
}
|
|
73330
|
+
} else if (flags & 4 /* BranchLabel */) {
|
|
73331
|
+
return some(flow.antecedent, (f) => isMutationFlowNode(
|
|
73332
|
+
f,
|
|
73333
|
+
/*noCacheCheck*/
|
|
73334
|
+
false
|
|
73335
|
+
));
|
|
73336
|
+
} else if (flags & 8 /* LoopLabel */) {
|
|
73337
|
+
let cached = getMutationStateForFlowNode(flow);
|
|
73338
|
+
if (cached === void 0) {
|
|
73339
|
+
const index = setMutationStateForFlowNode(flow, false);
|
|
73340
|
+
cached = mutationFlowStates[index] = some(flow.antecedent, (f) => isMutationFlowNode(
|
|
73341
|
+
f,
|
|
73342
|
+
/*noCacheCheck*/
|
|
73343
|
+
false
|
|
73344
|
+
));
|
|
73345
|
+
}
|
|
73346
|
+
return cached;
|
|
73347
|
+
} else if (flags & 256 /* ArrayMutation */) {
|
|
73348
|
+
if (declaredType === autoType || declaredType === autoArrayType) {
|
|
73349
|
+
const node = flow.node;
|
|
73350
|
+
const expr = node.kind === 213 /* CallExpression */ ? node.expression.expression : node.left.expression;
|
|
73351
|
+
if (isMatchingReference(reference, getReferenceCandidate(expr))) {
|
|
73352
|
+
return true;
|
|
73353
|
+
}
|
|
73354
|
+
}
|
|
73355
|
+
} else if (flags & 2048 /* LambdaArgs */) {
|
|
73356
|
+
const mutation = some(flow.node.arguments, (arg) => {
|
|
73357
|
+
const lambda = getLambdaArgument(arg);
|
|
73358
|
+
return !!(lambda && lambda.returnFlowNode && isMutationFlowNode(
|
|
73359
|
+
lambda.returnFlowNode,
|
|
73360
|
+
/*noCacheCheck*/
|
|
73361
|
+
false
|
|
73362
|
+
));
|
|
73363
|
+
});
|
|
73364
|
+
if (mutation) {
|
|
73365
|
+
return true;
|
|
73366
|
+
}
|
|
73367
|
+
} else if (!(flags & (512 /* Call */ | 96 /* Condition */ | 128 /* SwitchClause */ | 1024 /* ReduceLabel */))) {
|
|
73368
|
+
return false;
|
|
73369
|
+
}
|
|
73370
|
+
flow = flow.antecedent;
|
|
73371
|
+
}
|
|
73372
|
+
}
|
|
73373
|
+
function getMutationStateForFlowNode(flow) {
|
|
73374
|
+
for (let i = mutationFlowStart; i < mutationFlowCount; i++) {
|
|
73375
|
+
if (mutationFlowNodes[i] === flow) {
|
|
73376
|
+
return mutationFlowStates[i];
|
|
73377
|
+
}
|
|
73378
|
+
}
|
|
73379
|
+
return void 0;
|
|
73380
|
+
}
|
|
73381
|
+
function setMutationStateForFlowNode(flow, state) {
|
|
73382
|
+
const index = mutationFlowCount;
|
|
73383
|
+
mutationFlowNodes[index] = flow;
|
|
73384
|
+
mutationFlowStates[index] = state;
|
|
73385
|
+
mutationFlowCount++;
|
|
73386
|
+
return index;
|
|
73387
|
+
}
|
|
73215
73388
|
function getTypeAtFlowArrayMutation(flow) {
|
|
73216
73389
|
if (declaredType === autoType || declaredType === autoArrayType) {
|
|
73217
73390
|
const node = flow.node;
|
|
@@ -123996,8 +124169,7 @@ function getImpliedNodeFormatForFile(fileName, packageJsonInfoCache, host, optio
|
|
|
123996
124169
|
return typeof result === "object" ? result.impliedNodeFormat : result;
|
|
123997
124170
|
}
|
|
123998
124171
|
function getImpliedNodeFormatForFileWorker(fileName, packageJsonInfoCache, host, options) {
|
|
123999
|
-
|
|
124000
|
-
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : (100 /* Node16 */ <= moduleKind && moduleKind <= 199 /* NodeNext */ || pathContainsNodeModules(fileName)) && fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
124172
|
+
return fileExtensionIsOneOf(fileName, [".d.mts" /* Dmts */, ".mts" /* Mts */, ".mjs" /* Mjs */]) ? 99 /* ESNext */ : fileExtensionIsOneOf(fileName, [".d.cts" /* Dcts */, ".cts" /* Cts */, ".cjs" /* Cjs */]) ? 1 /* CommonJS */ : fileExtensionIsOneOf(fileName, [".d.ts" /* Dts */, ".ts" /* Ts */, ".tsx" /* Tsx */, ".js" /* Js */, ".jsx" /* Jsx */]) ? lookupFromPackageJson() : void 0;
|
|
124001
124173
|
function lookupFromPackageJson() {
|
|
124002
124174
|
const state = getTemporaryModuleResolutionState(packageJsonInfoCache, host, options);
|
|
124003
124175
|
const packageJsonLocations = [];
|
|
@@ -179374,6 +179546,7 @@ __export(ts_exports2, {
|
|
|
179374
179546
|
getJSXRuntimeImport: () => getJSXRuntimeImport,
|
|
179375
179547
|
getJSXTransformEnabled: () => getJSXTransformEnabled,
|
|
179376
179548
|
getKeyForCompilerOptions: () => getKeyForCompilerOptions,
|
|
179549
|
+
getLambdaArgument: () => getLambdaArgument,
|
|
179377
179550
|
getLanguageVariant: () => getLanguageVariant,
|
|
179378
179551
|
getLastChild: () => getLastChild,
|
|
179379
179552
|
getLeadingCommentRanges: () => getLeadingCommentRanges,
|
|
@@ -193810,6 +193983,7 @@ if (typeof console !== "undefined") {
|
|
|
193810
193983
|
getJSXRuntimeImport,
|
|
193811
193984
|
getJSXTransformEnabled,
|
|
193812
193985
|
getKeyForCompilerOptions,
|
|
193986
|
+
getLambdaArgument,
|
|
193813
193987
|
getLanguageVariant,
|
|
193814
193988
|
getLastChild,
|
|
193815
193989
|
getLeadingCommentRanges,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.6.0-pr-
|
|
5
|
+
"version": "5.6.0-pr-58729-60",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|