typescript 5.5.0-dev.20240523 → 5.5.0-dev.20240524
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 +114 -50
- package/lib/typescript.js +127 -55
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.5";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240524`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -3561,6 +3561,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3561
3561
|
TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral";
|
|
3562
3562
|
TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping";
|
|
3563
3563
|
TypeFlags2[TypeFlags2["Reserved1"] = 536870912] = "Reserved1";
|
|
3564
|
+
TypeFlags2[TypeFlags2["Reserved2"] = 1073741824] = "Reserved2";
|
|
3564
3565
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
3565
3566
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
3566
3567
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
@@ -3599,6 +3600,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
3599
3600
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
3600
3601
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
3601
3602
|
TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 536870912 /* Reserved1 */] = "IncludesConstrainedTypeVariable";
|
|
3603
|
+
TypeFlags2[TypeFlags2["IncludesError"] = 1073741824 /* Reserved2 */] = "IncludesError";
|
|
3602
3604
|
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
3603
3605
|
return TypeFlags2;
|
|
3604
3606
|
})(TypeFlags || {});
|
|
@@ -46240,7 +46242,12 @@ function createTypeChecker(host) {
|
|
|
46240
46242
|
if (resolvedTarget === unknownSymbol) {
|
|
46241
46243
|
return source;
|
|
46242
46244
|
}
|
|
46243
|
-
|
|
46245
|
+
if (!(resolvedTarget.flags & getExcludedSymbolFlags(source.flags)) || (source.flags | resolvedTarget.flags) & 67108864 /* Assignment */) {
|
|
46246
|
+
target = cloneSymbol(resolvedTarget);
|
|
46247
|
+
} else {
|
|
46248
|
+
reportMergeSymbolError(target, source);
|
|
46249
|
+
return source;
|
|
46250
|
+
}
|
|
46244
46251
|
}
|
|
46245
46252
|
if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
|
|
46246
46253
|
target.constEnumOnlyModule = false;
|
|
@@ -46270,27 +46277,30 @@ function createTypeChecker(host) {
|
|
|
46270
46277
|
);
|
|
46271
46278
|
}
|
|
46272
46279
|
} else {
|
|
46273
|
-
|
|
46274
|
-
|
|
46280
|
+
reportMergeSymbolError(target, source);
|
|
46281
|
+
}
|
|
46282
|
+
return target;
|
|
46283
|
+
function reportMergeSymbolError(target2, source2) {
|
|
46284
|
+
const isEitherEnum = !!(target2.flags & 384 /* Enum */ || source2.flags & 384 /* Enum */);
|
|
46285
|
+
const isEitherBlockScoped = !!(target2.flags & 2 /* BlockScopedVariable */ || source2.flags & 2 /* BlockScopedVariable */);
|
|
46275
46286
|
const message = isEitherEnum ? Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations : isEitherBlockScoped ? Diagnostics.Cannot_redeclare_block_scoped_variable_0 : Diagnostics.Duplicate_identifier_0;
|
|
46276
|
-
const sourceSymbolFile =
|
|
46277
|
-
const targetSymbolFile =
|
|
46287
|
+
const sourceSymbolFile = source2.declarations && getSourceFileOfNode(source2.declarations[0]);
|
|
46288
|
+
const targetSymbolFile = target2.declarations && getSourceFileOfNode(target2.declarations[0]);
|
|
46278
46289
|
const isSourcePlainJs = isPlainJsFile(sourceSymbolFile, compilerOptions.checkJs);
|
|
46279
46290
|
const isTargetPlainJs = isPlainJsFile(targetSymbolFile, compilerOptions.checkJs);
|
|
46280
|
-
const symbolName2 = symbolToString(
|
|
46291
|
+
const symbolName2 = symbolToString(source2);
|
|
46281
46292
|
if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) {
|
|
46282
46293
|
const firstFile = comparePaths(sourceSymbolFile.path, targetSymbolFile.path) === -1 /* LessThan */ ? sourceSymbolFile : targetSymbolFile;
|
|
46283
46294
|
const secondFile = firstFile === sourceSymbolFile ? targetSymbolFile : sourceSymbolFile;
|
|
46284
46295
|
const filesDuplicates = getOrUpdate(amalgamatedDuplicates, `${firstFile.path}|${secondFile.path}`, () => ({ firstFile, secondFile, conflictingSymbols: /* @__PURE__ */ new Map() }));
|
|
46285
46296
|
const conflictingSymbolInfo = getOrUpdate(filesDuplicates.conflictingSymbols, symbolName2, () => ({ isBlockScoped: isEitherBlockScoped, firstFileLocations: [], secondFileLocations: [] }));
|
|
46286
|
-
if (!isSourcePlainJs) addDuplicateLocations(conflictingSymbolInfo.firstFileLocations,
|
|
46287
|
-
if (!isTargetPlainJs) addDuplicateLocations(conflictingSymbolInfo.secondFileLocations,
|
|
46297
|
+
if (!isSourcePlainJs) addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source2);
|
|
46298
|
+
if (!isTargetPlainJs) addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target2);
|
|
46288
46299
|
} else {
|
|
46289
|
-
if (!isSourcePlainJs) addDuplicateDeclarationErrorsForSymbols(
|
|
46290
|
-
if (!isTargetPlainJs) addDuplicateDeclarationErrorsForSymbols(
|
|
46300
|
+
if (!isSourcePlainJs) addDuplicateDeclarationErrorsForSymbols(source2, message, symbolName2, target2);
|
|
46301
|
+
if (!isTargetPlainJs) addDuplicateDeclarationErrorsForSymbols(target2, message, symbolName2, source2);
|
|
46291
46302
|
}
|
|
46292
46303
|
}
|
|
46293
|
-
return target;
|
|
46294
46304
|
function addDuplicateLocations(locs, symbol) {
|
|
46295
46305
|
if (symbol.declarations) {
|
|
46296
46306
|
for (const decl of symbol.declarations) {
|
|
@@ -49136,6 +49146,9 @@ function createTypeChecker(host) {
|
|
|
49136
49146
|
function isClassInstanceSide(type) {
|
|
49137
49147
|
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 524288 /* Object */) && !!(getObjectFlags(type) & 16777216 /* IsClassInstanceClone */));
|
|
49138
49148
|
}
|
|
49149
|
+
function getTypeFromTypeNodeWithoutContext(node) {
|
|
49150
|
+
return getTypeFromTypeNode(node);
|
|
49151
|
+
}
|
|
49139
49152
|
function createNodeBuilder() {
|
|
49140
49153
|
return {
|
|
49141
49154
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
@@ -49164,6 +49177,12 @@ function createTypeChecker(host) {
|
|
|
49164
49177
|
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
49165
49178
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
49166
49179
|
};
|
|
49180
|
+
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
|
49181
|
+
const type = getTypeFromTypeNodeWithoutContext(node);
|
|
49182
|
+
if (!context.mapper) return type;
|
|
49183
|
+
const mappedType = instantiateType(type, context.mapper);
|
|
49184
|
+
return noMappedTypes && mappedType !== type ? void 0 : mappedType;
|
|
49185
|
+
}
|
|
49167
49186
|
function setTextRange2(context, range, location) {
|
|
49168
49187
|
if (!nodeIsSynthesized(range) && !(range.flags & 16 /* Synthesized */) && (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(range))) {
|
|
49169
49188
|
range = factory.cloneNode(range);
|
|
@@ -49209,7 +49228,7 @@ function createTypeChecker(host) {
|
|
|
49209
49228
|
}
|
|
49210
49229
|
const clone = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
|
|
49211
49230
|
if (clone) {
|
|
49212
|
-
if (addUndefined && !someType(
|
|
49231
|
+
if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
49213
49232
|
return factory.createUnionTypeNode([clone, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
49214
49233
|
}
|
|
49215
49234
|
return clone;
|
|
@@ -49222,8 +49241,13 @@ function createTypeChecker(host) {
|
|
|
49222
49241
|
}
|
|
49223
49242
|
return void 0;
|
|
49224
49243
|
}
|
|
49225
|
-
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType
|
|
49226
|
-
|
|
49244
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType = getTypeFromTypeNode2(
|
|
49245
|
+
context,
|
|
49246
|
+
existing,
|
|
49247
|
+
/*noMappedTypes*/
|
|
49248
|
+
true
|
|
49249
|
+
)) {
|
|
49250
|
+
if (annotationType && typeNodeIsEquivalentToType(host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
49227
49251
|
const result = tryReuseExistingTypeNodeHelper(context, existing);
|
|
49228
49252
|
if (result) {
|
|
49229
49253
|
return result;
|
|
@@ -49271,7 +49295,8 @@ function createTypeChecker(host) {
|
|
|
49271
49295
|
mustCreateTypeParametersNamesLookups: true,
|
|
49272
49296
|
typeParameterNames: void 0,
|
|
49273
49297
|
typeParameterNamesByText: void 0,
|
|
49274
|
-
typeParameterNamesByTextNextNameCount: void 0
|
|
49298
|
+
typeParameterNamesByTextNextNameCount: void 0,
|
|
49299
|
+
mapper: void 0
|
|
49275
49300
|
};
|
|
49276
49301
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
49277
49302
|
const resultingNode = cb(context);
|
|
@@ -49562,8 +49587,8 @@ function createTypeChecker(host) {
|
|
|
49562
49587
|
context.inferTypeParameters = type2.root.inferTypeParameters;
|
|
49563
49588
|
const extendsTypeNode2 = typeToTypeNodeHelper(instantiateType(type2.root.extendsType, newMapper), context);
|
|
49564
49589
|
context.inferTypeParameters = saveInferTypeParameters2;
|
|
49565
|
-
const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(
|
|
49566
|
-
const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(
|
|
49590
|
+
const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.trueType), newMapper));
|
|
49591
|
+
const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.falseType), newMapper));
|
|
49567
49592
|
return factory.createConditionalTypeNode(
|
|
49568
49593
|
checkTypeNode,
|
|
49569
49594
|
factory.createInferTypeNode(factory.createTypeParameterDeclaration(
|
|
@@ -49646,7 +49671,7 @@ function createTypeChecker(host) {
|
|
|
49646
49671
|
context.approximateLength += 10;
|
|
49647
49672
|
const result = setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
|
|
49648
49673
|
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
49649
|
-
const originalConstraint = instantiateType(getConstraintOfTypeParameter(
|
|
49674
|
+
const originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode2(context, type2.declaration.typeParameter.constraint.type)) || unknownType, type2.mapper);
|
|
49650
49675
|
return factory.createConditionalTypeNode(
|
|
49651
49676
|
typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context),
|
|
49652
49677
|
factory.createInferTypeNode(factory.createTypeParameterDeclaration(
|
|
@@ -50273,7 +50298,7 @@ function createTypeChecker(host) {
|
|
|
50273
50298
|
/*skipUnionExpanding*/
|
|
50274
50299
|
true
|
|
50275
50300
|
)[0];
|
|
50276
|
-
const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters);
|
|
50301
|
+
const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters, signature.mapper);
|
|
50277
50302
|
context.approximateLength += 3;
|
|
50278
50303
|
if (context.flags & 32 /* WriteTypeArgumentsOfSignature */ && signature.target && signature.mapper && signature.target.typeParameters) {
|
|
50279
50304
|
typeArguments = signature.target.typeParameters.map((parameter) => typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context));
|
|
@@ -50381,11 +50406,15 @@ function createTypeChecker(host) {
|
|
|
50381
50406
|
function getParametersInScope(node) {
|
|
50382
50407
|
return isFunctionLike(node) || isJSDocSignature(node) ? getSignatureFromDeclaration(node).parameters : void 0;
|
|
50383
50408
|
}
|
|
50384
|
-
function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters) {
|
|
50409
|
+
function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters, mapper) {
|
|
50385
50410
|
const cleanupContext = cloneNodeBuilderContext(context);
|
|
50386
50411
|
let cleanupParams;
|
|
50387
50412
|
let cleanupTypeParams;
|
|
50388
50413
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
50414
|
+
const oldMapper = context.mapper;
|
|
50415
|
+
if (mapper) {
|
|
50416
|
+
context.mapper = mapper;
|
|
50417
|
+
}
|
|
50389
50418
|
if (context.enclosingDeclaration && declaration) {
|
|
50390
50419
|
let pushFakeScope2 = function(kind, addAll) {
|
|
50391
50420
|
Debug.assert(context.enclosingDeclaration);
|
|
@@ -50484,6 +50513,7 @@ function createTypeChecker(host) {
|
|
|
50484
50513
|
cleanupTypeParams == null ? void 0 : cleanupTypeParams();
|
|
50485
50514
|
cleanupContext();
|
|
50486
50515
|
context.enclosingDeclaration = oldEnclosingDecl;
|
|
50516
|
+
context.mapper = oldMapper;
|
|
50487
50517
|
};
|
|
50488
50518
|
}
|
|
50489
50519
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -50501,7 +50531,7 @@ function createTypeChecker(host) {
|
|
|
50501
50531
|
"this",
|
|
50502
50532
|
/*questionToken*/
|
|
50503
50533
|
void 0,
|
|
50504
|
-
typeToTypeNodeHelper(
|
|
50534
|
+
typeToTypeNodeHelper(getTypeFromTypeNode2(context, thisTag.typeExpression), context)
|
|
50505
50535
|
);
|
|
50506
50536
|
}
|
|
50507
50537
|
}
|
|
@@ -51140,10 +51170,10 @@ function createTypeChecker(host) {
|
|
|
51140
51170
|
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
51141
51171
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
51142
51172
|
if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
|
|
51143
|
-
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol
|
|
51173
|
+
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
|
|
51144
51174
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
51145
51175
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
51146
|
-
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
51176
|
+
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
51147
51177
|
if (result2) {
|
|
51148
51178
|
return result2;
|
|
51149
51179
|
}
|
|
@@ -51163,7 +51193,7 @@ function createTypeChecker(host) {
|
|
|
51163
51193
|
context.flags = oldFlags;
|
|
51164
51194
|
return result;
|
|
51165
51195
|
}
|
|
51166
|
-
function typeNodeIsEquivalentToType(
|
|
51196
|
+
function typeNodeIsEquivalentToType(annotatedDeclaration, type, typeFromTypeNode) {
|
|
51167
51197
|
if (typeFromTypeNode === type) {
|
|
51168
51198
|
return true;
|
|
51169
51199
|
}
|
|
@@ -51193,13 +51223,10 @@ function createTypeChecker(host) {
|
|
|
51193
51223
|
function serializeReturnTypeForSignatureWorker(context, signature) {
|
|
51194
51224
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
51195
51225
|
const type = getReturnTypeOfSignature(signature);
|
|
51196
|
-
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
|
|
51226
|
+
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
51197
51227
|
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
51198
|
-
|
|
51199
|
-
|
|
51200
|
-
const annotated = getTypeFromTypeNode(annotation);
|
|
51201
|
-
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
51202
|
-
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, thisInstantiated);
|
|
51228
|
+
if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
|
|
51229
|
+
const result = tryReuseExistingTypeNodeHelper(context, annotation);
|
|
51203
51230
|
if (result) {
|
|
51204
51231
|
return result;
|
|
51205
51232
|
}
|
|
@@ -51342,13 +51369,26 @@ function createTypeChecker(host) {
|
|
|
51342
51369
|
!(length(existing.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))));
|
|
51343
51370
|
}
|
|
51344
51371
|
}
|
|
51372
|
+
if (isThisTypeNode(existing)) {
|
|
51373
|
+
if (context.mapper === void 0) return true;
|
|
51374
|
+
const type = getTypeFromTypeNode2(
|
|
51375
|
+
context,
|
|
51376
|
+
existing,
|
|
51377
|
+
/*noMappedTypes*/
|
|
51378
|
+
true
|
|
51379
|
+
);
|
|
51380
|
+
return !!type;
|
|
51381
|
+
}
|
|
51345
51382
|
if (isTypeReferenceNode(existing)) {
|
|
51346
51383
|
if (isConstTypeReference(existing)) return false;
|
|
51347
51384
|
const type = getTypeFromTypeReference(existing);
|
|
51348
51385
|
const symbol = getNodeLinks(existing).resolvedSymbol;
|
|
51349
51386
|
if (!symbol) return false;
|
|
51350
51387
|
if (symbol.flags & 262144 /* TypeParameter */) {
|
|
51351
|
-
|
|
51388
|
+
const type2 = getDeclaredTypeOfSymbol(symbol);
|
|
51389
|
+
if (context.mapper && getMappedType(type2, context.mapper) !== type2) {
|
|
51390
|
+
return false;
|
|
51391
|
+
}
|
|
51352
51392
|
}
|
|
51353
51393
|
if (isInJSDoc(existing)) {
|
|
51354
51394
|
return existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) && !getIntendedTypeFromJSDocTypeReference(existing) && symbol.flags & 788968 /* Type */;
|
|
@@ -51361,7 +51401,7 @@ function createTypeChecker(host) {
|
|
|
51361
51401
|
return true;
|
|
51362
51402
|
}
|
|
51363
51403
|
function serializeExistingTypeNode(context, typeNode) {
|
|
51364
|
-
const type =
|
|
51404
|
+
const type = getTypeFromTypeNode2(context, typeNode);
|
|
51365
51405
|
return typeToTypeNodeHelper(type, context);
|
|
51366
51406
|
}
|
|
51367
51407
|
function tryReuseExistingTypeNodeHelper(context, existing) {
|
|
@@ -51409,8 +51449,8 @@ function createTypeChecker(host) {
|
|
|
51409
51449
|
if (isJSDocTypeLiteral(node)) {
|
|
51410
51450
|
return factory.createTypeLiteralNode(map(node.jsDocPropertyTags, (t) => {
|
|
51411
51451
|
const name = isIdentifier(t.name) ? t.name : t.name.right;
|
|
51412
|
-
const typeViaParent = getTypeOfPropertyOfType(
|
|
51413
|
-
const overrideTypeNode = typeViaParent && t.typeExpression &&
|
|
51452
|
+
const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode2(context, node), name.escapedText);
|
|
51453
|
+
const overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode2(context, t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0;
|
|
51414
51454
|
return factory.createPropertySignature(
|
|
51415
51455
|
/*modifiers*/
|
|
51416
51456
|
void 0,
|
|
@@ -51451,7 +51491,7 @@ function createTypeChecker(host) {
|
|
|
51451
51491
|
/*modifiers*/
|
|
51452
51492
|
void 0,
|
|
51453
51493
|
getEffectiveDotDotDotForParameter(p),
|
|
51454
|
-
getNameForJSDocFunctionParameter(p, i),
|
|
51494
|
+
setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
|
|
51455
51495
|
p.questionToken,
|
|
51456
51496
|
visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51457
51497
|
/*initializer*/
|
|
@@ -51466,7 +51506,7 @@ function createTypeChecker(host) {
|
|
|
51466
51506
|
/*modifiers*/
|
|
51467
51507
|
void 0,
|
|
51468
51508
|
getEffectiveDotDotDotForParameter(p),
|
|
51469
|
-
getNameForJSDocFunctionParameter(p, i),
|
|
51509
|
+
setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
|
|
51470
51510
|
p.questionToken,
|
|
51471
51511
|
visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51472
51512
|
/*initializer*/
|
|
@@ -51476,6 +51516,21 @@ function createTypeChecker(host) {
|
|
|
51476
51516
|
);
|
|
51477
51517
|
}
|
|
51478
51518
|
}
|
|
51519
|
+
if (isThisTypeNode(node)) {
|
|
51520
|
+
if (canReuseTypeNode(context, node)) {
|
|
51521
|
+
return node;
|
|
51522
|
+
}
|
|
51523
|
+
return serializeExistingTypeNode(context, node);
|
|
51524
|
+
}
|
|
51525
|
+
if (isTypeParameterDeclaration(node)) {
|
|
51526
|
+
return factory.updateTypeParameterDeclaration(
|
|
51527
|
+
node,
|
|
51528
|
+
node.modifiers,
|
|
51529
|
+
setTextRange2(context, typeParameterToName(getDeclaredTypeOfSymbol(getSymbolOfDeclaration(node)), context), node),
|
|
51530
|
+
visitNode(node.constraint, visitExistingNodeTreeSymbols, isTypeNode),
|
|
51531
|
+
visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
|
|
51532
|
+
);
|
|
51533
|
+
}
|
|
51479
51534
|
if (isTypeReferenceNode(node)) {
|
|
51480
51535
|
if (canReuseTypeNode(context, node)) {
|
|
51481
51536
|
const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
|
|
@@ -51507,7 +51562,7 @@ function createTypeChecker(host) {
|
|
|
51507
51562
|
if (isInJSDoc(node) && nodeSymbol && // The import type resolved using jsdoc fallback logic
|
|
51508
51563
|
(!node.isTypeOf && !(nodeSymbol.flags & 788968 /* Type */) || // The import type had type arguments autofilled by js fallback logic
|
|
51509
51564
|
!(length(node.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))))) {
|
|
51510
|
-
return setTextRange2(context, typeToTypeNodeHelper(
|
|
51565
|
+
return setTextRange2(context, typeToTypeNodeHelper(getTypeFromTypeNode2(context, node), context), node);
|
|
51511
51566
|
}
|
|
51512
51567
|
return factory.updateImportTypeNode(
|
|
51513
51568
|
node,
|
|
@@ -51577,10 +51632,16 @@ function createTypeChecker(host) {
|
|
|
51577
51632
|
return factory.updateComputedPropertyName(node, literal);
|
|
51578
51633
|
}
|
|
51579
51634
|
}
|
|
51580
|
-
if (isTypePredicateNode(node)
|
|
51581
|
-
|
|
51582
|
-
|
|
51583
|
-
|
|
51635
|
+
if (isTypePredicateNode(node)) {
|
|
51636
|
+
let parameterName;
|
|
51637
|
+
if (isIdentifier(node.parameterName)) {
|
|
51638
|
+
const { node: result, introducesError } = trackExistingEntityName(node.parameterName, context);
|
|
51639
|
+
hadError = hadError || introducesError;
|
|
51640
|
+
parameterName = result;
|
|
51641
|
+
} else {
|
|
51642
|
+
parameterName = node.parameterName;
|
|
51643
|
+
}
|
|
51644
|
+
return factory.updateTypePredicateNode(node, node.assertsModifier, parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
|
|
51584
51645
|
}
|
|
51585
51646
|
if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
|
|
51586
51647
|
const visited = visitEachChild(
|
|
@@ -52356,7 +52417,7 @@ function createTypeChecker(host) {
|
|
|
52356
52417
|
}
|
|
52357
52418
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
52358
52419
|
expr,
|
|
52359
|
-
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a,
|
|
52420
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode2(context, a)) || typeToTypeNodeHelper(getTypeFromTypeNode2(context, a), context))
|
|
52360
52421
|
));
|
|
52361
52422
|
function cleanup(result2) {
|
|
52362
52423
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -58900,6 +58961,7 @@ function createTypeChecker(host) {
|
|
|
58900
58961
|
if (flags & 465829888 /* Instantiable */) includes |= 33554432 /* IncludesInstantiable */;
|
|
58901
58962
|
if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) includes |= 536870912 /* IncludesConstrainedTypeVariable */;
|
|
58902
58963
|
if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */;
|
|
58964
|
+
if (isErrorType(type)) includes |= 1073741824 /* IncludesError */;
|
|
58903
58965
|
if (!strictNullChecks && flags & 98304 /* Nullable */) {
|
|
58904
58966
|
if (!(getObjectFlags(type) & 65536 /* ContainsWideningType */)) includes |= 4194304 /* IncludesNonWideningType */;
|
|
58905
58967
|
} else {
|
|
@@ -59091,7 +59153,7 @@ function createTypeChecker(host) {
|
|
|
59091
59153
|
const includes = addTypesToUnion(typeSet, 0, types);
|
|
59092
59154
|
if (unionReduction !== 0 /* None */) {
|
|
59093
59155
|
if (includes & 3 /* AnyOrUnknown */) {
|
|
59094
|
-
return includes & 1 /* Any */ ? includes & 8388608 /* IncludesWildcard */ ? wildcardType : anyType : unknownType;
|
|
59156
|
+
return includes & 1 /* Any */ ? includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType : unknownType;
|
|
59095
59157
|
}
|
|
59096
59158
|
if (includes & 32768 /* Undefined */) {
|
|
59097
59159
|
if (typeSet.length >= 2 && typeSet[0] === undefinedType && typeSet[1] === missingType) {
|
|
@@ -59217,6 +59279,7 @@ function createTypeChecker(host) {
|
|
|
59217
59279
|
} else {
|
|
59218
59280
|
if (flags & 3 /* AnyOrUnknown */) {
|
|
59219
59281
|
if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */;
|
|
59282
|
+
if (isErrorType(type)) includes |= 1073741824 /* IncludesError */;
|
|
59220
59283
|
} else if (strictNullChecks || !(flags & 98304 /* Nullable */)) {
|
|
59221
59284
|
if (type === missingType) {
|
|
59222
59285
|
includes |= 262144 /* IncludesMissingType */;
|
|
@@ -59344,7 +59407,7 @@ function createTypeChecker(host) {
|
|
|
59344
59407
|
return neverType;
|
|
59345
59408
|
}
|
|
59346
59409
|
if (includes & 1 /* Any */) {
|
|
59347
|
-
return includes & 8388608 /* IncludesWildcard */ ? wildcardType : anyType;
|
|
59410
|
+
return includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType;
|
|
59348
59411
|
}
|
|
59349
59412
|
if (!strictNullChecks && includes & 98304 /* Nullable */) {
|
|
59350
59413
|
return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType;
|
|
@@ -84847,6 +84910,7 @@ function createTypeChecker(host) {
|
|
|
84847
84910
|
function getSingleReturnExpression(declaration) {
|
|
84848
84911
|
let candidateExpr;
|
|
84849
84912
|
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
84913
|
+
if (getFunctionFlags(declaration) & 3 /* AsyncGenerator */) return void 0;
|
|
84850
84914
|
const body = declaration.body;
|
|
84851
84915
|
if (body && isBlock(body)) {
|
|
84852
84916
|
forEachReturnStatement(body, (s) => {
|
|
@@ -92248,10 +92312,9 @@ function transformClassFields(context) {
|
|
|
92248
92312
|
}
|
|
92249
92313
|
}
|
|
92250
92314
|
}
|
|
92251
|
-
function
|
|
92315
|
+
function tryGetClassThis() {
|
|
92252
92316
|
const lex = getClassLexicalEnvironment();
|
|
92253
|
-
|
|
92254
|
-
return Debug.checkDefined(classThis);
|
|
92317
|
+
return lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
|
|
92255
92318
|
}
|
|
92256
92319
|
function transformAutoAccessor(node) {
|
|
92257
92320
|
const commentRange = getCommentRange(node);
|
|
@@ -92279,7 +92342,7 @@ function transformClassFields(context) {
|
|
|
92279
92342
|
setOriginalNode(backingField, node);
|
|
92280
92343
|
setEmitFlags(backingField, 3072 /* NoComments */);
|
|
92281
92344
|
setSourceMapRange(backingField, sourceMapRange);
|
|
92282
|
-
const receiver = isStatic(node) ?
|
|
92345
|
+
const receiver = isStatic(node) ? tryGetClassThis() ?? factory2.createThis() : factory2.createThis();
|
|
92283
92346
|
const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName, receiver);
|
|
92284
92347
|
setOriginalNode(getter, node);
|
|
92285
92348
|
setCommentRange(getter, commentRange);
|
|
@@ -92845,7 +92908,7 @@ function transformClassFields(context) {
|
|
|
92845
92908
|
var _a;
|
|
92846
92909
|
let facts = 0 /* None */;
|
|
92847
92910
|
const original = getOriginalNode(node);
|
|
92848
|
-
if (
|
|
92911
|
+
if (isClassLike(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
|
|
92849
92912
|
facts |= 1 /* ClassWasDecorated */;
|
|
92850
92913
|
}
|
|
92851
92914
|
if (shouldTransformPrivateElementsOrClassStaticBlocks && (classHasClassThisAssignment(node) || classHasExplicitlyAssignedName(node))) {
|
|
@@ -129200,6 +129263,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
129200
129263
|
function typeFromSingleReturnExpression(declaration, context) {
|
|
129201
129264
|
let candidateExpr;
|
|
129202
129265
|
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
129266
|
+
if (getFunctionFlags(declaration) & 3 /* AsyncGenerator */) return void 0;
|
|
129203
129267
|
const body = declaration.body;
|
|
129204
129268
|
if (body && isBlock(body)) {
|
|
129205
129269
|
forEachReturnStatement(body, (s) => {
|
package/lib/typescript.js
CHANGED
|
@@ -2370,7 +2370,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2370
2370
|
|
|
2371
2371
|
// src/compiler/corePublic.ts
|
|
2372
2372
|
var versionMajorMinor = "5.5";
|
|
2373
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2373
|
+
var version = `${versionMajorMinor}.0-dev.20240524`;
|
|
2374
2374
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2375
2375
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2376
2376
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6602,6 +6602,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6602
6602
|
TypeFlags2[TypeFlags2["TemplateLiteral"] = 134217728] = "TemplateLiteral";
|
|
6603
6603
|
TypeFlags2[TypeFlags2["StringMapping"] = 268435456] = "StringMapping";
|
|
6604
6604
|
TypeFlags2[TypeFlags2["Reserved1"] = 536870912] = "Reserved1";
|
|
6605
|
+
TypeFlags2[TypeFlags2["Reserved2"] = 1073741824] = "Reserved2";
|
|
6605
6606
|
TypeFlags2[TypeFlags2["AnyOrUnknown"] = 3] = "AnyOrUnknown";
|
|
6606
6607
|
TypeFlags2[TypeFlags2["Nullable"] = 98304] = "Nullable";
|
|
6607
6608
|
TypeFlags2[TypeFlags2["Literal"] = 2944] = "Literal";
|
|
@@ -6640,6 +6641,7 @@ var TypeFlags = /* @__PURE__ */ ((TypeFlags2) => {
|
|
|
6640
6641
|
TypeFlags2[TypeFlags2["IncludesEmptyObject"] = 16777216 /* Conditional */] = "IncludesEmptyObject";
|
|
6641
6642
|
TypeFlags2[TypeFlags2["IncludesInstantiable"] = 33554432 /* Substitution */] = "IncludesInstantiable";
|
|
6642
6643
|
TypeFlags2[TypeFlags2["IncludesConstrainedTypeVariable"] = 536870912 /* Reserved1 */] = "IncludesConstrainedTypeVariable";
|
|
6644
|
+
TypeFlags2[TypeFlags2["IncludesError"] = 1073741824 /* Reserved2 */] = "IncludesError";
|
|
6643
6645
|
TypeFlags2[TypeFlags2["NotPrimitiveUnion"] = 36323331] = "NotPrimitiveUnion";
|
|
6644
6646
|
return TypeFlags2;
|
|
6645
6647
|
})(TypeFlags || {});
|
|
@@ -51035,7 +51037,12 @@ function createTypeChecker(host) {
|
|
|
51035
51037
|
if (resolvedTarget === unknownSymbol) {
|
|
51036
51038
|
return source;
|
|
51037
51039
|
}
|
|
51038
|
-
|
|
51040
|
+
if (!(resolvedTarget.flags & getExcludedSymbolFlags(source.flags)) || (source.flags | resolvedTarget.flags) & 67108864 /* Assignment */) {
|
|
51041
|
+
target = cloneSymbol(resolvedTarget);
|
|
51042
|
+
} else {
|
|
51043
|
+
reportMergeSymbolError(target, source);
|
|
51044
|
+
return source;
|
|
51045
|
+
}
|
|
51039
51046
|
}
|
|
51040
51047
|
if (source.flags & 512 /* ValueModule */ && target.flags & 512 /* ValueModule */ && target.constEnumOnlyModule && !source.constEnumOnlyModule) {
|
|
51041
51048
|
target.constEnumOnlyModule = false;
|
|
@@ -51065,27 +51072,30 @@ function createTypeChecker(host) {
|
|
|
51065
51072
|
);
|
|
51066
51073
|
}
|
|
51067
51074
|
} else {
|
|
51068
|
-
|
|
51069
|
-
|
|
51075
|
+
reportMergeSymbolError(target, source);
|
|
51076
|
+
}
|
|
51077
|
+
return target;
|
|
51078
|
+
function reportMergeSymbolError(target2, source2) {
|
|
51079
|
+
const isEitherEnum = !!(target2.flags & 384 /* Enum */ || source2.flags & 384 /* Enum */);
|
|
51080
|
+
const isEitherBlockScoped = !!(target2.flags & 2 /* BlockScopedVariable */ || source2.flags & 2 /* BlockScopedVariable */);
|
|
51070
51081
|
const message = isEitherEnum ? Diagnostics.Enum_declarations_can_only_merge_with_namespace_or_other_enum_declarations : isEitherBlockScoped ? Diagnostics.Cannot_redeclare_block_scoped_variable_0 : Diagnostics.Duplicate_identifier_0;
|
|
51071
|
-
const sourceSymbolFile =
|
|
51072
|
-
const targetSymbolFile =
|
|
51082
|
+
const sourceSymbolFile = source2.declarations && getSourceFileOfNode(source2.declarations[0]);
|
|
51083
|
+
const targetSymbolFile = target2.declarations && getSourceFileOfNode(target2.declarations[0]);
|
|
51073
51084
|
const isSourcePlainJs = isPlainJsFile(sourceSymbolFile, compilerOptions.checkJs);
|
|
51074
51085
|
const isTargetPlainJs = isPlainJsFile(targetSymbolFile, compilerOptions.checkJs);
|
|
51075
|
-
const symbolName2 = symbolToString(
|
|
51086
|
+
const symbolName2 = symbolToString(source2);
|
|
51076
51087
|
if (sourceSymbolFile && targetSymbolFile && amalgamatedDuplicates && !isEitherEnum && sourceSymbolFile !== targetSymbolFile) {
|
|
51077
51088
|
const firstFile = comparePaths(sourceSymbolFile.path, targetSymbolFile.path) === -1 /* LessThan */ ? sourceSymbolFile : targetSymbolFile;
|
|
51078
51089
|
const secondFile = firstFile === sourceSymbolFile ? targetSymbolFile : sourceSymbolFile;
|
|
51079
51090
|
const filesDuplicates = getOrUpdate(amalgamatedDuplicates, `${firstFile.path}|${secondFile.path}`, () => ({ firstFile, secondFile, conflictingSymbols: /* @__PURE__ */ new Map() }));
|
|
51080
51091
|
const conflictingSymbolInfo = getOrUpdate(filesDuplicates.conflictingSymbols, symbolName2, () => ({ isBlockScoped: isEitherBlockScoped, firstFileLocations: [], secondFileLocations: [] }));
|
|
51081
|
-
if (!isSourcePlainJs) addDuplicateLocations(conflictingSymbolInfo.firstFileLocations,
|
|
51082
|
-
if (!isTargetPlainJs) addDuplicateLocations(conflictingSymbolInfo.secondFileLocations,
|
|
51092
|
+
if (!isSourcePlainJs) addDuplicateLocations(conflictingSymbolInfo.firstFileLocations, source2);
|
|
51093
|
+
if (!isTargetPlainJs) addDuplicateLocations(conflictingSymbolInfo.secondFileLocations, target2);
|
|
51083
51094
|
} else {
|
|
51084
|
-
if (!isSourcePlainJs) addDuplicateDeclarationErrorsForSymbols(
|
|
51085
|
-
if (!isTargetPlainJs) addDuplicateDeclarationErrorsForSymbols(
|
|
51095
|
+
if (!isSourcePlainJs) addDuplicateDeclarationErrorsForSymbols(source2, message, symbolName2, target2);
|
|
51096
|
+
if (!isTargetPlainJs) addDuplicateDeclarationErrorsForSymbols(target2, message, symbolName2, source2);
|
|
51086
51097
|
}
|
|
51087
51098
|
}
|
|
51088
|
-
return target;
|
|
51089
51099
|
function addDuplicateLocations(locs, symbol) {
|
|
51090
51100
|
if (symbol.declarations) {
|
|
51091
51101
|
for (const decl of symbol.declarations) {
|
|
@@ -53931,6 +53941,9 @@ function createTypeChecker(host) {
|
|
|
53931
53941
|
function isClassInstanceSide(type) {
|
|
53932
53942
|
return !!type.symbol && !!(type.symbol.flags & 32 /* Class */) && (type === getDeclaredTypeOfClassOrInterface(type.symbol) || !!(type.flags & 524288 /* Object */) && !!(getObjectFlags(type) & 16777216 /* IsClassInstanceClone */));
|
|
53933
53943
|
}
|
|
53944
|
+
function getTypeFromTypeNodeWithoutContext(node) {
|
|
53945
|
+
return getTypeFromTypeNode(node);
|
|
53946
|
+
}
|
|
53934
53947
|
function createNodeBuilder() {
|
|
53935
53948
|
return {
|
|
53936
53949
|
typeToTypeNode: (type, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => typeToTypeNodeHelper(type, context)),
|
|
@@ -53959,6 +53972,12 @@ function createTypeChecker(host) {
|
|
|
53959
53972
|
symbolTableToDeclarationStatements: (symbolTable, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolTableToDeclarationStatements(symbolTable, context)),
|
|
53960
53973
|
symbolToNode: (symbol, meaning, enclosingDeclaration, flags, tracker) => withContext2(enclosingDeclaration, flags, tracker, (context) => symbolToNode(symbol, context, meaning))
|
|
53961
53974
|
};
|
|
53975
|
+
function getTypeFromTypeNode2(context, node, noMappedTypes) {
|
|
53976
|
+
const type = getTypeFromTypeNodeWithoutContext(node);
|
|
53977
|
+
if (!context.mapper) return type;
|
|
53978
|
+
const mappedType = instantiateType(type, context.mapper);
|
|
53979
|
+
return noMappedTypes && mappedType !== type ? void 0 : mappedType;
|
|
53980
|
+
}
|
|
53962
53981
|
function setTextRange2(context, range, location) {
|
|
53963
53982
|
if (!nodeIsSynthesized(range) && !(range.flags & 16 /* Synthesized */) && (!context.enclosingFile || context.enclosingFile !== getSourceFileOfNode(range))) {
|
|
53964
53983
|
range = factory.cloneNode(range);
|
|
@@ -54004,7 +54023,7 @@ function createTypeChecker(host) {
|
|
|
54004
54023
|
}
|
|
54005
54024
|
const clone2 = tryReuseExistingNonParameterTypeNode(context, typeNode, type, host2);
|
|
54006
54025
|
if (clone2) {
|
|
54007
|
-
if (addUndefined && !someType(
|
|
54026
|
+
if (addUndefined && !someType(getTypeFromTypeNode2(context, typeNode), (t) => !!(t.flags & 32768 /* Undefined */))) {
|
|
54008
54027
|
return factory.createUnionTypeNode([clone2, factory.createKeywordTypeNode(157 /* UndefinedKeyword */)]);
|
|
54009
54028
|
}
|
|
54010
54029
|
return clone2;
|
|
@@ -54017,8 +54036,13 @@ function createTypeChecker(host) {
|
|
|
54017
54036
|
}
|
|
54018
54037
|
return void 0;
|
|
54019
54038
|
}
|
|
54020
|
-
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType
|
|
54021
|
-
|
|
54039
|
+
function tryReuseExistingNonParameterTypeNode(context, existing, type, host2 = context.enclosingDeclaration, annotationType = getTypeFromTypeNode2(
|
|
54040
|
+
context,
|
|
54041
|
+
existing,
|
|
54042
|
+
/*noMappedTypes*/
|
|
54043
|
+
true
|
|
54044
|
+
)) {
|
|
54045
|
+
if (annotationType && typeNodeIsEquivalentToType(host2, type, annotationType) && existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type)) {
|
|
54022
54046
|
const result = tryReuseExistingTypeNodeHelper(context, existing);
|
|
54023
54047
|
if (result) {
|
|
54024
54048
|
return result;
|
|
@@ -54066,7 +54090,8 @@ function createTypeChecker(host) {
|
|
|
54066
54090
|
mustCreateTypeParametersNamesLookups: true,
|
|
54067
54091
|
typeParameterNames: void 0,
|
|
54068
54092
|
typeParameterNamesByText: void 0,
|
|
54069
|
-
typeParameterNamesByTextNextNameCount: void 0
|
|
54093
|
+
typeParameterNamesByTextNextNameCount: void 0,
|
|
54094
|
+
mapper: void 0
|
|
54070
54095
|
};
|
|
54071
54096
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
54072
54097
|
const resultingNode = cb(context);
|
|
@@ -54357,8 +54382,8 @@ function createTypeChecker(host) {
|
|
|
54357
54382
|
context.inferTypeParameters = type2.root.inferTypeParameters;
|
|
54358
54383
|
const extendsTypeNode2 = typeToTypeNodeHelper(instantiateType(type2.root.extendsType, newMapper), context);
|
|
54359
54384
|
context.inferTypeParameters = saveInferTypeParameters2;
|
|
54360
|
-
const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(
|
|
54361
|
-
const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(
|
|
54385
|
+
const trueTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.trueType), newMapper));
|
|
54386
|
+
const falseTypeNode2 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode2(context, type2.root.node.falseType), newMapper));
|
|
54362
54387
|
return factory.createConditionalTypeNode(
|
|
54363
54388
|
checkTypeNode,
|
|
54364
54389
|
factory.createInferTypeNode(factory.createTypeParameterDeclaration(
|
|
@@ -54441,7 +54466,7 @@ function createTypeChecker(host) {
|
|
|
54441
54466
|
context.approximateLength += 10;
|
|
54442
54467
|
const result = setEmitFlags(mappedTypeNode, 1 /* SingleLine */);
|
|
54443
54468
|
if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type2) && context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
54444
|
-
const originalConstraint = instantiateType(getConstraintOfTypeParameter(
|
|
54469
|
+
const originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode2(context, type2.declaration.typeParameter.constraint.type)) || unknownType, type2.mapper);
|
|
54445
54470
|
return factory.createConditionalTypeNode(
|
|
54446
54471
|
typeToTypeNodeHelper(getModifiersTypeFromMappedType(type2), context),
|
|
54447
54472
|
factory.createInferTypeNode(factory.createTypeParameterDeclaration(
|
|
@@ -55068,7 +55093,7 @@ function createTypeChecker(host) {
|
|
|
55068
55093
|
/*skipUnionExpanding*/
|
|
55069
55094
|
true
|
|
55070
55095
|
)[0];
|
|
55071
|
-
const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters);
|
|
55096
|
+
const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters, signature.mapper);
|
|
55072
55097
|
context.approximateLength += 3;
|
|
55073
55098
|
if (context.flags & 32 /* WriteTypeArgumentsOfSignature */ && signature.target && signature.mapper && signature.target.typeParameters) {
|
|
55074
55099
|
typeArguments = signature.target.typeParameters.map((parameter) => typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context));
|
|
@@ -55176,11 +55201,15 @@ function createTypeChecker(host) {
|
|
|
55176
55201
|
function getParametersInScope(node) {
|
|
55177
55202
|
return isFunctionLike(node) || isJSDocSignature(node) ? getSignatureFromDeclaration(node).parameters : void 0;
|
|
55178
55203
|
}
|
|
55179
|
-
function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters) {
|
|
55204
|
+
function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters, mapper) {
|
|
55180
55205
|
const cleanupContext = cloneNodeBuilderContext(context);
|
|
55181
55206
|
let cleanupParams;
|
|
55182
55207
|
let cleanupTypeParams;
|
|
55183
55208
|
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
55209
|
+
const oldMapper = context.mapper;
|
|
55210
|
+
if (mapper) {
|
|
55211
|
+
context.mapper = mapper;
|
|
55212
|
+
}
|
|
55184
55213
|
if (context.enclosingDeclaration && declaration) {
|
|
55185
55214
|
let pushFakeScope2 = function(kind, addAll) {
|
|
55186
55215
|
Debug.assert(context.enclosingDeclaration);
|
|
@@ -55279,6 +55308,7 @@ function createTypeChecker(host) {
|
|
|
55279
55308
|
cleanupTypeParams == null ? void 0 : cleanupTypeParams();
|
|
55280
55309
|
cleanupContext();
|
|
55281
55310
|
context.enclosingDeclaration = oldEnclosingDecl;
|
|
55311
|
+
context.mapper = oldMapper;
|
|
55282
55312
|
};
|
|
55283
55313
|
}
|
|
55284
55314
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
@@ -55296,7 +55326,7 @@ function createTypeChecker(host) {
|
|
|
55296
55326
|
"this",
|
|
55297
55327
|
/*questionToken*/
|
|
55298
55328
|
void 0,
|
|
55299
|
-
typeToTypeNodeHelper(
|
|
55329
|
+
typeToTypeNodeHelper(getTypeFromTypeNode2(context, thisTag.typeExpression), context)
|
|
55300
55330
|
);
|
|
55301
55331
|
}
|
|
55302
55332
|
}
|
|
@@ -55935,10 +55965,10 @@ function createTypeChecker(host) {
|
|
|
55935
55965
|
const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
|
|
55936
55966
|
const enclosingDeclaration = context.enclosingDeclaration;
|
|
55937
55967
|
if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
|
|
55938
|
-
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol
|
|
55968
|
+
const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol);
|
|
55939
55969
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
55940
55970
|
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
55941
|
-
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
55971
|
+
const result2 = !isTypePredicateNode(existing) && tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined);
|
|
55942
55972
|
if (result2) {
|
|
55943
55973
|
return result2;
|
|
55944
55974
|
}
|
|
@@ -55958,7 +55988,7 @@ function createTypeChecker(host) {
|
|
|
55958
55988
|
context.flags = oldFlags;
|
|
55959
55989
|
return result;
|
|
55960
55990
|
}
|
|
55961
|
-
function typeNodeIsEquivalentToType(
|
|
55991
|
+
function typeNodeIsEquivalentToType(annotatedDeclaration, type, typeFromTypeNode) {
|
|
55962
55992
|
if (typeFromTypeNode === type) {
|
|
55963
55993
|
return true;
|
|
55964
55994
|
}
|
|
@@ -55988,13 +56018,10 @@ function createTypeChecker(host) {
|
|
|
55988
56018
|
function serializeReturnTypeForSignatureWorker(context, signature) {
|
|
55989
56019
|
const typePredicate = getTypePredicateOfSignature(signature);
|
|
55990
56020
|
const type = getReturnTypeOfSignature(signature);
|
|
55991
|
-
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
|
|
56021
|
+
if (context.enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */) && signature.declaration && !nodeIsSynthesized(signature.declaration)) {
|
|
55992
56022
|
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
55993
|
-
|
|
55994
|
-
|
|
55995
|
-
const annotated = getTypeFromTypeNode(annotation);
|
|
55996
|
-
const thisInstantiated = annotated.flags & 262144 /* TypeParameter */ && annotated.isThisType ? instantiateType(annotated, signature.mapper) : annotated;
|
|
55997
|
-
const result = tryReuseExistingNonParameterTypeNode(context, annotation, type, signature.declaration, thisInstantiated);
|
|
56023
|
+
if (annotation && getTypeFromTypeNode2(context, annotation) === type) {
|
|
56024
|
+
const result = tryReuseExistingTypeNodeHelper(context, annotation);
|
|
55998
56025
|
if (result) {
|
|
55999
56026
|
return result;
|
|
56000
56027
|
}
|
|
@@ -56137,13 +56164,26 @@ function createTypeChecker(host) {
|
|
|
56137
56164
|
!(length(existing.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))));
|
|
56138
56165
|
}
|
|
56139
56166
|
}
|
|
56167
|
+
if (isThisTypeNode(existing)) {
|
|
56168
|
+
if (context.mapper === void 0) return true;
|
|
56169
|
+
const type = getTypeFromTypeNode2(
|
|
56170
|
+
context,
|
|
56171
|
+
existing,
|
|
56172
|
+
/*noMappedTypes*/
|
|
56173
|
+
true
|
|
56174
|
+
);
|
|
56175
|
+
return !!type;
|
|
56176
|
+
}
|
|
56140
56177
|
if (isTypeReferenceNode(existing)) {
|
|
56141
56178
|
if (isConstTypeReference(existing)) return false;
|
|
56142
56179
|
const type = getTypeFromTypeReference(existing);
|
|
56143
56180
|
const symbol = getNodeLinks(existing).resolvedSymbol;
|
|
56144
56181
|
if (!symbol) return false;
|
|
56145
56182
|
if (symbol.flags & 262144 /* TypeParameter */) {
|
|
56146
|
-
|
|
56183
|
+
const type2 = getDeclaredTypeOfSymbol(symbol);
|
|
56184
|
+
if (context.mapper && getMappedType(type2, context.mapper) !== type2) {
|
|
56185
|
+
return false;
|
|
56186
|
+
}
|
|
56147
56187
|
}
|
|
56148
56188
|
if (isInJSDoc(existing)) {
|
|
56149
56189
|
return existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) && !getIntendedTypeFromJSDocTypeReference(existing) && symbol.flags & 788968 /* Type */;
|
|
@@ -56156,7 +56196,7 @@ function createTypeChecker(host) {
|
|
|
56156
56196
|
return true;
|
|
56157
56197
|
}
|
|
56158
56198
|
function serializeExistingTypeNode(context, typeNode) {
|
|
56159
|
-
const type =
|
|
56199
|
+
const type = getTypeFromTypeNode2(context, typeNode);
|
|
56160
56200
|
return typeToTypeNodeHelper(type, context);
|
|
56161
56201
|
}
|
|
56162
56202
|
function tryReuseExistingTypeNodeHelper(context, existing) {
|
|
@@ -56204,8 +56244,8 @@ function createTypeChecker(host) {
|
|
|
56204
56244
|
if (isJSDocTypeLiteral(node)) {
|
|
56205
56245
|
return factory.createTypeLiteralNode(map(node.jsDocPropertyTags, (t) => {
|
|
56206
56246
|
const name = isIdentifier(t.name) ? t.name : t.name.right;
|
|
56207
|
-
const typeViaParent = getTypeOfPropertyOfType(
|
|
56208
|
-
const overrideTypeNode = typeViaParent && t.typeExpression &&
|
|
56247
|
+
const typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode2(context, node), name.escapedText);
|
|
56248
|
+
const overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode2(context, t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : void 0;
|
|
56209
56249
|
return factory.createPropertySignature(
|
|
56210
56250
|
/*modifiers*/
|
|
56211
56251
|
void 0,
|
|
@@ -56246,7 +56286,7 @@ function createTypeChecker(host) {
|
|
|
56246
56286
|
/*modifiers*/
|
|
56247
56287
|
void 0,
|
|
56248
56288
|
getEffectiveDotDotDotForParameter(p),
|
|
56249
|
-
getNameForJSDocFunctionParameter(p, i),
|
|
56289
|
+
setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
|
|
56250
56290
|
p.questionToken,
|
|
56251
56291
|
visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
|
|
56252
56292
|
/*initializer*/
|
|
@@ -56261,7 +56301,7 @@ function createTypeChecker(host) {
|
|
|
56261
56301
|
/*modifiers*/
|
|
56262
56302
|
void 0,
|
|
56263
56303
|
getEffectiveDotDotDotForParameter(p),
|
|
56264
|
-
getNameForJSDocFunctionParameter(p, i),
|
|
56304
|
+
setTextRange2(context, factory.createIdentifier(getNameForJSDocFunctionParameter(p, i)), p),
|
|
56265
56305
|
p.questionToken,
|
|
56266
56306
|
visitNode(p.type, visitExistingNodeTreeSymbols, isTypeNode),
|
|
56267
56307
|
/*initializer*/
|
|
@@ -56271,6 +56311,21 @@ function createTypeChecker(host) {
|
|
|
56271
56311
|
);
|
|
56272
56312
|
}
|
|
56273
56313
|
}
|
|
56314
|
+
if (isThisTypeNode(node)) {
|
|
56315
|
+
if (canReuseTypeNode(context, node)) {
|
|
56316
|
+
return node;
|
|
56317
|
+
}
|
|
56318
|
+
return serializeExistingTypeNode(context, node);
|
|
56319
|
+
}
|
|
56320
|
+
if (isTypeParameterDeclaration(node)) {
|
|
56321
|
+
return factory.updateTypeParameterDeclaration(
|
|
56322
|
+
node,
|
|
56323
|
+
node.modifiers,
|
|
56324
|
+
setTextRange2(context, typeParameterToName(getDeclaredTypeOfSymbol(getSymbolOfDeclaration(node)), context), node),
|
|
56325
|
+
visitNode(node.constraint, visitExistingNodeTreeSymbols, isTypeNode),
|
|
56326
|
+
visitNode(node.default, visitExistingNodeTreeSymbols, isTypeNode)
|
|
56327
|
+
);
|
|
56328
|
+
}
|
|
56274
56329
|
if (isTypeReferenceNode(node)) {
|
|
56275
56330
|
if (canReuseTypeNode(context, node)) {
|
|
56276
56331
|
const { introducesError, node: newName } = trackExistingEntityName(node.typeName, context);
|
|
@@ -56302,7 +56357,7 @@ function createTypeChecker(host) {
|
|
|
56302
56357
|
if (isInJSDoc(node) && nodeSymbol && // The import type resolved using jsdoc fallback logic
|
|
56303
56358
|
(!node.isTypeOf && !(nodeSymbol.flags & 788968 /* Type */) || // The import type had type arguments autofilled by js fallback logic
|
|
56304
56359
|
!(length(node.typeArguments) >= getMinTypeArgumentCount(getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(nodeSymbol))))) {
|
|
56305
|
-
return setTextRange2(context, typeToTypeNodeHelper(
|
|
56360
|
+
return setTextRange2(context, typeToTypeNodeHelper(getTypeFromTypeNode2(context, node), context), node);
|
|
56306
56361
|
}
|
|
56307
56362
|
return factory.updateImportTypeNode(
|
|
56308
56363
|
node,
|
|
@@ -56372,10 +56427,16 @@ function createTypeChecker(host) {
|
|
|
56372
56427
|
return factory.updateComputedPropertyName(node, literal);
|
|
56373
56428
|
}
|
|
56374
56429
|
}
|
|
56375
|
-
if (isTypePredicateNode(node)
|
|
56376
|
-
|
|
56377
|
-
|
|
56378
|
-
|
|
56430
|
+
if (isTypePredicateNode(node)) {
|
|
56431
|
+
let parameterName;
|
|
56432
|
+
if (isIdentifier(node.parameterName)) {
|
|
56433
|
+
const { node: result, introducesError } = trackExistingEntityName(node.parameterName, context);
|
|
56434
|
+
hadError = hadError || introducesError;
|
|
56435
|
+
parameterName = result;
|
|
56436
|
+
} else {
|
|
56437
|
+
parameterName = node.parameterName;
|
|
56438
|
+
}
|
|
56439
|
+
return factory.updateTypePredicateNode(node, node.assertsModifier, parameterName, visitNode(node.type, visitExistingNodeTreeSymbols, isTypeNode));
|
|
56379
56440
|
}
|
|
56380
56441
|
if (isTupleTypeNode(node) || isTypeLiteralNode(node) || isMappedTypeNode(node)) {
|
|
56381
56442
|
const visited = visitEachChild(
|
|
@@ -57151,7 +57212,7 @@ function createTypeChecker(host) {
|
|
|
57151
57212
|
}
|
|
57152
57213
|
return cleanup(factory.createExpressionWithTypeArguments(
|
|
57153
57214
|
expr,
|
|
57154
|
-
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a,
|
|
57215
|
+
map(e.typeArguments, (a) => tryReuseExistingNonParameterTypeNode(context, a, getTypeFromTypeNode2(context, a)) || typeToTypeNodeHelper(getTypeFromTypeNode2(context, a), context))
|
|
57155
57216
|
));
|
|
57156
57217
|
function cleanup(result2) {
|
|
57157
57218
|
context.enclosingDeclaration = oldEnclosing;
|
|
@@ -63695,6 +63756,7 @@ function createTypeChecker(host) {
|
|
|
63695
63756
|
if (flags & 465829888 /* Instantiable */) includes |= 33554432 /* IncludesInstantiable */;
|
|
63696
63757
|
if (flags & 2097152 /* Intersection */ && getObjectFlags(type) & 67108864 /* IsConstrainedTypeVariable */) includes |= 536870912 /* IncludesConstrainedTypeVariable */;
|
|
63697
63758
|
if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */;
|
|
63759
|
+
if (isErrorType(type)) includes |= 1073741824 /* IncludesError */;
|
|
63698
63760
|
if (!strictNullChecks && flags & 98304 /* Nullable */) {
|
|
63699
63761
|
if (!(getObjectFlags(type) & 65536 /* ContainsWideningType */)) includes |= 4194304 /* IncludesNonWideningType */;
|
|
63700
63762
|
} else {
|
|
@@ -63886,7 +63948,7 @@ function createTypeChecker(host) {
|
|
|
63886
63948
|
const includes = addTypesToUnion(typeSet, 0, types);
|
|
63887
63949
|
if (unionReduction !== 0 /* None */) {
|
|
63888
63950
|
if (includes & 3 /* AnyOrUnknown */) {
|
|
63889
|
-
return includes & 1 /* Any */ ? includes & 8388608 /* IncludesWildcard */ ? wildcardType : anyType : unknownType;
|
|
63951
|
+
return includes & 1 /* Any */ ? includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType : unknownType;
|
|
63890
63952
|
}
|
|
63891
63953
|
if (includes & 32768 /* Undefined */) {
|
|
63892
63954
|
if (typeSet.length >= 2 && typeSet[0] === undefinedType && typeSet[1] === missingType) {
|
|
@@ -64012,6 +64074,7 @@ function createTypeChecker(host) {
|
|
|
64012
64074
|
} else {
|
|
64013
64075
|
if (flags & 3 /* AnyOrUnknown */) {
|
|
64014
64076
|
if (type === wildcardType) includes |= 8388608 /* IncludesWildcard */;
|
|
64077
|
+
if (isErrorType(type)) includes |= 1073741824 /* IncludesError */;
|
|
64015
64078
|
} else if (strictNullChecks || !(flags & 98304 /* Nullable */)) {
|
|
64016
64079
|
if (type === missingType) {
|
|
64017
64080
|
includes |= 262144 /* IncludesMissingType */;
|
|
@@ -64139,7 +64202,7 @@ function createTypeChecker(host) {
|
|
|
64139
64202
|
return neverType;
|
|
64140
64203
|
}
|
|
64141
64204
|
if (includes & 1 /* Any */) {
|
|
64142
|
-
return includes & 8388608 /* IncludesWildcard */ ? wildcardType : anyType;
|
|
64205
|
+
return includes & 8388608 /* IncludesWildcard */ ? wildcardType : includes & 1073741824 /* IncludesError */ ? errorType : anyType;
|
|
64143
64206
|
}
|
|
64144
64207
|
if (!strictNullChecks && includes & 98304 /* Nullable */) {
|
|
64145
64208
|
return includes & 16777216 /* IncludesEmptyObject */ ? neverType : includes & 32768 /* Undefined */ ? undefinedType : nullType;
|
|
@@ -89642,6 +89705,7 @@ function createTypeChecker(host) {
|
|
|
89642
89705
|
function getSingleReturnExpression(declaration) {
|
|
89643
89706
|
let candidateExpr;
|
|
89644
89707
|
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
89708
|
+
if (getFunctionFlags(declaration) & 3 /* AsyncGenerator */) return void 0;
|
|
89645
89709
|
const body = declaration.body;
|
|
89646
89710
|
if (body && isBlock(body)) {
|
|
89647
89711
|
forEachReturnStatement(body, (s) => {
|
|
@@ -97225,10 +97289,9 @@ function transformClassFields(context) {
|
|
|
97225
97289
|
}
|
|
97226
97290
|
}
|
|
97227
97291
|
}
|
|
97228
|
-
function
|
|
97292
|
+
function tryGetClassThis() {
|
|
97229
97293
|
const lex = getClassLexicalEnvironment();
|
|
97230
|
-
|
|
97231
|
-
return Debug.checkDefined(classThis);
|
|
97294
|
+
return lex.classThis ?? lex.classConstructor ?? (currentClassContainer == null ? void 0 : currentClassContainer.name);
|
|
97232
97295
|
}
|
|
97233
97296
|
function transformAutoAccessor(node) {
|
|
97234
97297
|
const commentRange = getCommentRange(node);
|
|
@@ -97256,7 +97319,7 @@ function transformClassFields(context) {
|
|
|
97256
97319
|
setOriginalNode(backingField, node);
|
|
97257
97320
|
setEmitFlags(backingField, 3072 /* NoComments */);
|
|
97258
97321
|
setSourceMapRange(backingField, sourceMapRange);
|
|
97259
|
-
const receiver = isStatic(node) ?
|
|
97322
|
+
const receiver = isStatic(node) ? tryGetClassThis() ?? factory2.createThis() : factory2.createThis();
|
|
97260
97323
|
const getter = createAccessorPropertyGetRedirector(factory2, node, modifiers, getterName, receiver);
|
|
97261
97324
|
setOriginalNode(getter, node);
|
|
97262
97325
|
setCommentRange(getter, commentRange);
|
|
@@ -97822,7 +97885,7 @@ function transformClassFields(context) {
|
|
|
97822
97885
|
var _a;
|
|
97823
97886
|
let facts = 0 /* None */;
|
|
97824
97887
|
const original = getOriginalNode(node);
|
|
97825
|
-
if (
|
|
97888
|
+
if (isClassLike(original) && classOrConstructorParameterIsDecorated(legacyDecorators, original)) {
|
|
97826
97889
|
facts |= 1 /* ClassWasDecorated */;
|
|
97827
97890
|
}
|
|
97828
97891
|
if (shouldTransformPrivateElementsOrClassStaticBlocks && (classHasClassThisAssignment(node) || classHasExplicitlyAssignedName(node))) {
|
|
@@ -134331,6 +134394,7 @@ function createSyntacticTypeNodeBuilder(options, resolver) {
|
|
|
134331
134394
|
function typeFromSingleReturnExpression(declaration, context) {
|
|
134332
134395
|
let candidateExpr;
|
|
134333
134396
|
if (declaration && !nodeIsMissing(declaration.body)) {
|
|
134397
|
+
if (getFunctionFlags(declaration) & 3 /* AsyncGenerator */) return void 0;
|
|
134334
134398
|
const body = declaration.body;
|
|
134335
134399
|
if (body && isBlock(body)) {
|
|
134336
134400
|
forEachReturnStatement(body, (s) => {
|
|
@@ -142906,7 +142970,7 @@ registerRefactor(refactorNameForMoveToFile, {
|
|
|
142906
142970
|
if (!interactiveRefactorArguments) {
|
|
142907
142971
|
return emptyArray;
|
|
142908
142972
|
}
|
|
142909
|
-
if (context.endPosition !== void 0) {
|
|
142973
|
+
if (context.triggerReason === "implicit" && context.endPosition !== void 0) {
|
|
142910
142974
|
const startNodeAncestor = findAncestor(getTokenAtPosition(file, context.startPosition), isBlockLike);
|
|
142911
142975
|
const endNodeAncestor = findAncestor(getTokenAtPosition(file, context.endPosition), isBlockLike);
|
|
142912
142976
|
if (startNodeAncestor && !isSourceFile(startNodeAncestor) && endNodeAncestor && !isSourceFile(endNodeAncestor)) {
|
|
@@ -143897,11 +143961,19 @@ registerRefactor(refactorName5, {
|
|
|
143897
143961
|
kinds: [moveToNewFileAction.kind],
|
|
143898
143962
|
getAvailableActions: function getRefactorActionsToMoveToNewFile(context) {
|
|
143899
143963
|
const statements = getStatementsToMove(context);
|
|
143964
|
+
const file = context.file;
|
|
143965
|
+
if (context.triggerReason === "implicit" && context.endPosition !== void 0) {
|
|
143966
|
+
const startNodeAncestor = findAncestor(getTokenAtPosition(file, context.startPosition), isBlockLike);
|
|
143967
|
+
const endNodeAncestor = findAncestor(getTokenAtPosition(file, context.endPosition), isBlockLike);
|
|
143968
|
+
if (startNodeAncestor && !isSourceFile(startNodeAncestor) && endNodeAncestor && !isSourceFile(endNodeAncestor)) {
|
|
143969
|
+
return emptyArray;
|
|
143970
|
+
}
|
|
143971
|
+
}
|
|
143900
143972
|
if (context.preferences.allowTextChangesInNewFiles && statements) {
|
|
143901
|
-
const
|
|
143973
|
+
const file2 = context.file;
|
|
143902
143974
|
const affectedTextRange = {
|
|
143903
|
-
start: { line: getLineAndCharacterOfPosition(
|
|
143904
|
-
end: { line: getLineAndCharacterOfPosition(
|
|
143975
|
+
start: { line: getLineAndCharacterOfPosition(file2, statements.all[0].getStart(file2)).line, offset: getLineAndCharacterOfPosition(file2, statements.all[0].getStart(file2)).character },
|
|
143976
|
+
end: { line: getLineAndCharacterOfPosition(file2, last(statements.all).end).line, offset: getLineAndCharacterOfPosition(file2, last(statements.all).end).character }
|
|
143905
143977
|
};
|
|
143906
143978
|
return [{ name: refactorName5, description: description2, actions: [{ ...moveToNewFileAction, range: affectedTextRange }] }];
|
|
143907
143979
|
}
|
|
@@ -173273,7 +173345,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKindWorker(typeChecker, symb
|
|
|
173273
173345
|
typeChecker,
|
|
173274
173346
|
resolvedSymbol,
|
|
173275
173347
|
getSourceFileOfNode(resolvedNode),
|
|
173276
|
-
|
|
173348
|
+
enclosingDeclaration,
|
|
173277
173349
|
declarationName,
|
|
173278
173350
|
type,
|
|
173279
173351
|
semanticMeaning,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.5.0-dev.
|
|
5
|
+
"version": "5.5.0-dev.20240524",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"node": "20.1.0",
|
|
113
113
|
"npm": "8.19.4"
|
|
114
114
|
},
|
|
115
|
-
"gitHead": "
|
|
115
|
+
"gitHead": "cffc425ad75bd7b1298abb78ce09337d08cc94b9"
|
|
116
116
|
}
|