@typescript-deploys/pr-build 5.5.0-pr-57973-2 → 5.5.0-pr-57996-3
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 +154 -108
- package/lib/typescript.js +195 -146
- 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-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20240329`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -42682,17 +42682,23 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
42682
42682
|
if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
|
|
42683
42683
|
return maybeNonRelative;
|
|
42684
42684
|
}
|
|
42685
|
-
|
|
42686
|
-
|
|
42687
|
-
|
|
42688
|
-
|
|
42689
|
-
if (nearestSourcePackageJson !== nearestTargetPackageJson) {
|
|
42685
|
+
const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
|
|
42686
|
+
const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
|
|
42687
|
+
const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
|
|
42688
|
+
if (!packageJsonPathsAreEqual(nearestTargetPackageJson, nearestSourcePackageJson, ignoreCase)) {
|
|
42690
42689
|
return maybeNonRelative;
|
|
42691
42690
|
}
|
|
42692
42691
|
return relativePath;
|
|
42693
42692
|
}
|
|
42694
42693
|
return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
|
|
42695
42694
|
}
|
|
42695
|
+
function packageJsonPathsAreEqual(a, b, ignoreCase) {
|
|
42696
|
+
if (a === b)
|
|
42697
|
+
return true;
|
|
42698
|
+
if (a === void 0 || b === void 0)
|
|
42699
|
+
return false;
|
|
42700
|
+
return comparePaths(a, b, ignoreCase) === 0 /* EqualTo */;
|
|
42701
|
+
}
|
|
42696
42702
|
function countPathComponents(path) {
|
|
42697
42703
|
let count = 0;
|
|
42698
42704
|
for (let i = startsWith(path, "./") ? 2 : 0; i < path.length; i++) {
|
|
@@ -47971,6 +47977,7 @@ function createTypeChecker(host) {
|
|
|
47971
47977
|
void 0,
|
|
47972
47978
|
addUndefined
|
|
47973
47979
|
)),
|
|
47980
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
47974
47981
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
47975
47982
|
indexInfo,
|
|
47976
47983
|
context,
|
|
@@ -49055,9 +49062,8 @@ function createTypeChecker(host) {
|
|
|
49055
49062
|
}
|
|
49056
49063
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
49057
49064
|
var _a;
|
|
49058
|
-
const
|
|
49059
|
-
|
|
49060
|
-
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
49065
|
+
const flags = context.flags;
|
|
49066
|
+
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
49061
49067
|
context.approximateLength += 3;
|
|
49062
49068
|
let typeParameters;
|
|
49063
49069
|
let typeArguments;
|
|
@@ -49138,22 +49144,12 @@ function createTypeChecker(host) {
|
|
|
49138
49144
|
if (thisParameter) {
|
|
49139
49145
|
parameters.unshift(thisParameter);
|
|
49140
49146
|
}
|
|
49141
|
-
|
|
49142
|
-
const
|
|
49143
|
-
if (typePredicate) {
|
|
49144
|
-
returnTypeNode = typePredicateToTypePredicateNodeHelper(typePredicate, context);
|
|
49145
|
-
} else {
|
|
49146
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
49147
|
-
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
49148
|
-
returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports);
|
|
49149
|
-
} else if (!suppressAny) {
|
|
49150
|
-
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
49151
|
-
}
|
|
49152
|
-
}
|
|
49147
|
+
context.flags = flags;
|
|
49148
|
+
const returnTypeNode = serializeReturnTypeForSignature(context, signature, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports);
|
|
49153
49149
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
49154
49150
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
49155
|
-
const
|
|
49156
|
-
modifiers = factory.createModifiersFromModifierFlags(
|
|
49151
|
+
const flags2 = modifiersToFlags(modifiers);
|
|
49152
|
+
modifiers = factory.createModifiersFromModifierFlags(flags2 | 64 /* Abstract */);
|
|
49157
49153
|
}
|
|
49158
49154
|
const node = kind === 179 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 180 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 174 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
49159
49155
|
modifiers,
|
|
@@ -49855,7 +49851,7 @@ function createTypeChecker(host) {
|
|
|
49855
49851
|
return initial;
|
|
49856
49852
|
}
|
|
49857
49853
|
function getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration) {
|
|
49858
|
-
return symbol.declarations && find(symbol.declarations, (s) => !!
|
|
49854
|
+
return symbol.declarations && find(symbol.declarations, (s) => !!getNonlocalEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!findAncestor(s, (n) => n === enclosingDeclaration)));
|
|
49859
49855
|
}
|
|
49860
49856
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
49861
49857
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
@@ -49871,7 +49867,7 @@ function createTypeChecker(host) {
|
|
|
49871
49867
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
49872
49868
|
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
49873
49869
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
49874
|
-
const existing =
|
|
49870
|
+
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
49875
49871
|
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined, includePrivateSymbol, bundled);
|
|
49876
49872
|
if (result2) {
|
|
49877
49873
|
return result2;
|
|
@@ -49897,9 +49893,26 @@ function createTypeChecker(host) {
|
|
|
49897
49893
|
}
|
|
49898
49894
|
return false;
|
|
49899
49895
|
}
|
|
49900
|
-
function serializeReturnTypeForSignature(context,
|
|
49896
|
+
function serializeReturnTypeForSignature(context, signature, includePrivateSymbol, bundled) {
|
|
49897
|
+
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
49898
|
+
const flags = context.flags;
|
|
49899
|
+
if (suppressAny)
|
|
49900
|
+
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
49901
|
+
let returnTypeNode;
|
|
49902
|
+
const returnType = getReturnTypeOfSignature(signature);
|
|
49903
|
+
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
49904
|
+
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature, includePrivateSymbol, bundled);
|
|
49905
|
+
} else if (!suppressAny) {
|
|
49906
|
+
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
49907
|
+
}
|
|
49908
|
+
context.flags = flags;
|
|
49909
|
+
return returnTypeNode;
|
|
49910
|
+
}
|
|
49911
|
+
function serializeReturnTypeForSignatureWorker(context, signature, includePrivateSymbol, bundled) {
|
|
49912
|
+
const typePredicate = getTypePredicateOfSignature(signature);
|
|
49913
|
+
const type = getReturnTypeOfSignature(signature);
|
|
49901
49914
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
49902
|
-
const annotation = signature.declaration &&
|
|
49915
|
+
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
49903
49916
|
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
49904
49917
|
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
49905
49918
|
const annotated = getTypeFromTypeNode(annotation);
|
|
@@ -49910,7 +49923,11 @@ function createTypeChecker(host) {
|
|
|
49910
49923
|
}
|
|
49911
49924
|
}
|
|
49912
49925
|
}
|
|
49913
|
-
|
|
49926
|
+
if (typePredicate) {
|
|
49927
|
+
return typePredicateToTypePredicateNodeHelper(typePredicate, context);
|
|
49928
|
+
}
|
|
49929
|
+
const expr = signature.declaration && getPossibleTypeNodeReuseExpression(signature.declaration);
|
|
49930
|
+
return expressionOrTypeToTypeNode(context, expr, type);
|
|
49914
49931
|
}
|
|
49915
49932
|
function trackExistingEntityName(node, context, includePrivateSymbol) {
|
|
49916
49933
|
let introducesError = false;
|
|
@@ -50075,30 +50092,24 @@ function createTypeChecker(host) {
|
|
|
50075
50092
|
node.isTypeOf
|
|
50076
50093
|
);
|
|
50077
50094
|
}
|
|
50078
|
-
if (
|
|
50079
|
-
|
|
50080
|
-
return factory.updateParameterDeclaration(
|
|
50081
|
-
node,
|
|
50082
|
-
/*modifiers*/
|
|
50083
|
-
void 0,
|
|
50084
|
-
node.dotDotDotToken,
|
|
50085
|
-
visitEachChild(
|
|
50086
|
-
node.name,
|
|
50087
|
-
visitExistingNodeTreeSymbols,
|
|
50088
|
-
/*context*/
|
|
50089
|
-
void 0
|
|
50090
|
-
),
|
|
50091
|
-
node.questionToken,
|
|
50092
|
-
factory.createKeywordTypeNode(133 /* AnyKeyword */),
|
|
50093
|
-
/*initializer*/
|
|
50094
|
-
void 0
|
|
50095
|
-
);
|
|
50096
|
-
}
|
|
50095
|
+
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
|
|
50096
|
+
return void 0;
|
|
50097
50097
|
}
|
|
50098
|
-
if (isPropertySignature(node)) {
|
|
50099
|
-
|
|
50100
|
-
|
|
50098
|
+
if (isFunctionLike(node) && !node.type || isPropertyDeclaration(node) && !node.type && !node.initializer || isPropertySignature(node) && !node.type && !node.initializer || isParameter(node) && !node.type && !node.initializer) {
|
|
50099
|
+
let visited = visitEachChild(
|
|
50100
|
+
node,
|
|
50101
|
+
visitExistingNodeTreeSymbols,
|
|
50102
|
+
/*context*/
|
|
50103
|
+
void 0
|
|
50104
|
+
);
|
|
50105
|
+
if (visited === node) {
|
|
50106
|
+
visited = setTextRange(factory.cloneNode(node), node);
|
|
50101
50107
|
}
|
|
50108
|
+
visited.type = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50109
|
+
if (isParameter(node)) {
|
|
50110
|
+
visited.modifiers = void 0;
|
|
50111
|
+
}
|
|
50112
|
+
return visited;
|
|
50102
50113
|
}
|
|
50103
50114
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
50104
50115
|
const { introducesError, node: result } = trackExistingEntityName(node, context, includePrivateSymbol);
|
|
@@ -54797,11 +54808,15 @@ function createTypeChecker(host) {
|
|
|
54797
54808
|
const modifiers = getMappedTypeModifiers(type);
|
|
54798
54809
|
return modifiers & 8 /* ExcludeOptional */ ? -1 : modifiers & 4 /* IncludeOptional */ ? 1 : 0;
|
|
54799
54810
|
}
|
|
54800
|
-
function getModifiersTypeOptionality(type) {
|
|
54801
|
-
return type.flags & 2097152 /* Intersection */ ? Math.max(...map(type.types, getModifiersTypeOptionality)) : getObjectFlags(type) & 32 /* Mapped */ ? getCombinedMappedTypeOptionality(type) : 0;
|
|
54802
|
-
}
|
|
54803
54811
|
function getCombinedMappedTypeOptionality(type) {
|
|
54804
|
-
|
|
54812
|
+
if (getObjectFlags(type) & 32 /* Mapped */) {
|
|
54813
|
+
return getMappedTypeOptionality(type) || getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(type));
|
|
54814
|
+
}
|
|
54815
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
54816
|
+
const optionality = getCombinedMappedTypeOptionality(type.types[0]);
|
|
54817
|
+
return every(type.types, (t, i) => i === 0 || getCombinedMappedTypeOptionality(t) === optionality) ? optionality : 0;
|
|
54818
|
+
}
|
|
54819
|
+
return 0;
|
|
54805
54820
|
}
|
|
54806
54821
|
function isPartialMappedType(type) {
|
|
54807
54822
|
return !!(getObjectFlags(type) & 32 /* Mapped */ && getMappedTypeModifiers(type) & 4 /* IncludeOptional */);
|
|
@@ -58610,13 +58625,18 @@ function createTypeChecker(host) {
|
|
|
58610
58625
|
const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
|
58611
58626
|
const templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
58612
58627
|
const instantiatedTemplateType = instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
|
|
58628
|
+
const isOptional = getMappedTypeOptionality(objectType) > 0 || (isGenericType(objectType) ? getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(objectType)) > 0 : couldAccessOptionalProperty(objectType, index));
|
|
58613
58629
|
return addOptionality(
|
|
58614
58630
|
instantiatedTemplateType,
|
|
58615
58631
|
/*isProperty*/
|
|
58616
58632
|
true,
|
|
58617
|
-
|
|
58633
|
+
isOptional
|
|
58618
58634
|
);
|
|
58619
58635
|
}
|
|
58636
|
+
function couldAccessOptionalProperty(objectType, indexType) {
|
|
58637
|
+
const indexConstraint = getBaseConstraintOfType(indexType);
|
|
58638
|
+
return !!indexConstraint && some(getPropertiesOfType(objectType), (p) => !!(p.flags & 16777216 /* Optional */) && isTypeAssignableTo(getLiteralTypeFromProperty(p, 8576 /* StringOrNumberLiteralOrUnique */), indexConstraint));
|
|
58639
|
+
}
|
|
58620
58640
|
function getIndexedAccessType(objectType, indexType, accessFlags = 0 /* None */, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
58621
58641
|
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
|
|
58622
58642
|
}
|
|
@@ -71196,7 +71216,7 @@ function createTypeChecker(host) {
|
|
|
71196
71216
|
if (isErrorType(objectType) || objectType === silentNeverType) {
|
|
71197
71217
|
return objectType;
|
|
71198
71218
|
}
|
|
71199
|
-
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)) {
|
|
71219
|
+
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression) && !isPreservedConstEnumUse(node, objectType)) {
|
|
71200
71220
|
error(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
|
|
71201
71221
|
return errorType;
|
|
71202
71222
|
}
|
|
@@ -76240,17 +76260,28 @@ function createTypeChecker(host) {
|
|
|
76240
76260
|
}
|
|
76241
76261
|
function checkConstEnumAccess(node, type) {
|
|
76242
76262
|
const ok = node.parent.kind === 211 /* PropertyAccessExpression */ && node.parent.expression === node || node.parent.kind === 212 /* ElementAccessExpression */ && node.parent.expression === node || ((node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || node.parent.kind === 186 /* TypeQuery */ && node.parent.exprName === node) || node.parent.kind === 281 /* ExportSpecifier */;
|
|
76243
|
-
if (!ok) {
|
|
76244
|
-
|
|
76263
|
+
if (!ok || getIsolatedModules(compilerOptions)) {
|
|
76264
|
+
if (!isPreservedConstEnumUse(node, type)) {
|
|
76265
|
+
if (!ok) {
|
|
76266
|
+
error(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
|
|
76267
|
+
} else if (type.symbol.valueDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
76268
|
+
error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
76269
|
+
}
|
|
76270
|
+
}
|
|
76245
76271
|
}
|
|
76246
|
-
|
|
76247
|
-
|
|
76248
|
-
|
|
76249
|
-
|
|
76250
|
-
|
|
76251
|
-
|
|
76272
|
+
}
|
|
76273
|
+
function isPreservedConstEnumUse(use, enumType) {
|
|
76274
|
+
Debug.assert(!!(enumType.symbol.flags & 128 /* ConstEnum */));
|
|
76275
|
+
const constEnumDeclaration = enumType.symbol.valueDeclaration;
|
|
76276
|
+
const otherFile = getSourceFileOfNode(constEnumDeclaration);
|
|
76277
|
+
if (!otherFile.isDeclarationFile) {
|
|
76278
|
+
if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(use)) {
|
|
76279
|
+
return false;
|
|
76252
76280
|
}
|
|
76281
|
+
return shouldPreserveConstEnums(compilerOptions);
|
|
76253
76282
|
}
|
|
76283
|
+
const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(otherFile.resolvedPath);
|
|
76284
|
+
return redirect && shouldPreserveConstEnums(redirect.commandLine.options);
|
|
76254
76285
|
}
|
|
76255
76286
|
function checkParenthesizedExpression(node, checkMode) {
|
|
76256
76287
|
if (hasJSDocNodes(node)) {
|
|
@@ -83160,9 +83191,23 @@ function createTypeChecker(host) {
|
|
|
83160
83191
|
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
83161
83192
|
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
83162
83193
|
}
|
|
83194
|
+
function getAllAccessorDeclarationsForDeclaration(accessor) {
|
|
83195
|
+
accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration);
|
|
83196
|
+
const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */;
|
|
83197
|
+
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind);
|
|
83198
|
+
const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor;
|
|
83199
|
+
const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor;
|
|
83200
|
+
const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor;
|
|
83201
|
+
const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor;
|
|
83202
|
+
return {
|
|
83203
|
+
firstAccessor,
|
|
83204
|
+
secondAccessor,
|
|
83205
|
+
setAccessor,
|
|
83206
|
+
getAccessor
|
|
83207
|
+
};
|
|
83208
|
+
}
|
|
83163
83209
|
function getPossibleTypeNodeReuseExpression(declaration) {
|
|
83164
|
-
|
|
83165
|
-
return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarations((_a = getSymbolOfDeclaration(declaration.parent)) == null ? void 0 : _a.declarations, declaration.parent).getAccessor) : void 0;
|
|
83210
|
+
return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarationsForDeclaration(declaration.parent).getAccessor) : void 0;
|
|
83166
83211
|
}
|
|
83167
83212
|
function getSingleReturnExpression(declaration) {
|
|
83168
83213
|
let candidateExpr;
|
|
@@ -83188,20 +83233,7 @@ function createTypeChecker(host) {
|
|
|
83188
83233
|
if (!signatureDeclaration) {
|
|
83189
83234
|
return factory.createToken(133 /* AnyKeyword */);
|
|
83190
83235
|
}
|
|
83191
|
-
|
|
83192
|
-
const typePredicate = getTypePredicateOfSignature(signature);
|
|
83193
|
-
if (typePredicate) {
|
|
83194
|
-
return nodeBuilder.typePredicateToTypePredicateNode(typePredicate, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
83195
|
-
}
|
|
83196
|
-
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
83197
|
-
getPossibleTypeNodeReuseExpression(signatureDeclaration),
|
|
83198
|
-
getReturnTypeOfSignature(signature),
|
|
83199
|
-
/*addUndefined*/
|
|
83200
|
-
void 0,
|
|
83201
|
-
enclosingDeclaration,
|
|
83202
|
-
flags | 1024 /* MultilineObjectLiterals */,
|
|
83203
|
-
tracker
|
|
83204
|
-
);
|
|
83236
|
+
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
83205
83237
|
}
|
|
83206
83238
|
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
83207
83239
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
@@ -83360,6 +83392,35 @@ function createTypeChecker(host) {
|
|
|
83360
83392
|
return parseIsolatedEntityName(compilerOptions.jsxFragmentFactory, languageVersion);
|
|
83361
83393
|
}
|
|
83362
83394
|
}
|
|
83395
|
+
function getNonlocalEffectiveTypeAnnotationNode(node) {
|
|
83396
|
+
const direct = getEffectiveTypeAnnotationNode(node);
|
|
83397
|
+
if (direct) {
|
|
83398
|
+
return direct;
|
|
83399
|
+
}
|
|
83400
|
+
if (node.kind === 169 /* Parameter */ && node.parent.kind === 178 /* SetAccessor */) {
|
|
83401
|
+
const other = getAllAccessorDeclarationsForDeclaration(node.parent).getAccessor;
|
|
83402
|
+
if (other) {
|
|
83403
|
+
return getEffectiveReturnTypeNode(other);
|
|
83404
|
+
}
|
|
83405
|
+
}
|
|
83406
|
+
return void 0;
|
|
83407
|
+
}
|
|
83408
|
+
function getNonlocalEffectiveReturnTypeAnnotationNode(node) {
|
|
83409
|
+
const direct = getEffectiveReturnTypeNode(node);
|
|
83410
|
+
if (direct) {
|
|
83411
|
+
return direct;
|
|
83412
|
+
}
|
|
83413
|
+
if (node.kind === 177 /* GetAccessor */) {
|
|
83414
|
+
const other = getAllAccessorDeclarationsForDeclaration(node).setAccessor;
|
|
83415
|
+
if (other) {
|
|
83416
|
+
const param = getSetAccessorValueParameter(other);
|
|
83417
|
+
if (param) {
|
|
83418
|
+
return getEffectiveTypeAnnotationNode(param);
|
|
83419
|
+
}
|
|
83420
|
+
}
|
|
83421
|
+
}
|
|
83422
|
+
return void 0;
|
|
83423
|
+
}
|
|
83363
83424
|
function createResolver() {
|
|
83364
83425
|
return {
|
|
83365
83426
|
getReferencedExportContainer,
|
|
@@ -83413,21 +83474,6 @@ function createTypeChecker(host) {
|
|
|
83413
83474
|
},
|
|
83414
83475
|
getJsxFactoryEntity,
|
|
83415
83476
|
getJsxFragmentFactoryEntity,
|
|
83416
|
-
getAllAccessorDeclarations(accessor) {
|
|
83417
|
-
accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration);
|
|
83418
|
-
const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */;
|
|
83419
|
-
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind);
|
|
83420
|
-
const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor;
|
|
83421
|
-
const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor;
|
|
83422
|
-
const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor;
|
|
83423
|
-
const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor;
|
|
83424
|
-
return {
|
|
83425
|
-
firstAccessor,
|
|
83426
|
-
secondAccessor,
|
|
83427
|
-
setAccessor,
|
|
83428
|
-
getAccessor
|
|
83429
|
-
};
|
|
83430
|
-
},
|
|
83431
83477
|
isBindingCapturedByNode: (node, decl) => {
|
|
83432
83478
|
const parseNode = getParseTreeNode(node);
|
|
83433
83479
|
const parseDecl = getParseTreeNode(decl);
|
|
@@ -83782,7 +83828,7 @@ function createTypeChecker(host) {
|
|
|
83782
83828
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here);
|
|
83783
83829
|
}
|
|
83784
83830
|
} else if (legacyDecorators && (node.kind === 177 /* GetAccessor */ || node.kind === 178 /* SetAccessor */)) {
|
|
83785
|
-
const accessors =
|
|
83831
|
+
const accessors = getAllAccessorDeclarationsForDeclaration(node);
|
|
83786
83832
|
if (hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) {
|
|
83787
83833
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
|
|
83788
83834
|
}
|
|
@@ -88973,7 +89019,7 @@ function transformTypeScript(context) {
|
|
|
88973
89019
|
if (typeSerializer) {
|
|
88974
89020
|
let decorators;
|
|
88975
89021
|
if (shouldAddTypeMetadata(node)) {
|
|
88976
|
-
const typeMetadata = emitHelpers().createMetadataHelper("design:type", typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node));
|
|
89022
|
+
const typeMetadata = emitHelpers().createMetadataHelper("design:type", typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node, container));
|
|
88977
89023
|
decorators = append(decorators, factory2.createDecorator(typeMetadata));
|
|
88978
89024
|
}
|
|
88979
89025
|
if (shouldAddParamTypesMetadata(node)) {
|
|
@@ -89000,7 +89046,7 @@ function transformTypeScript(context) {
|
|
|
89000
89046
|
/*type*/
|
|
89001
89047
|
void 0,
|
|
89002
89048
|
factory2.createToken(39 /* EqualsGreaterThanToken */),
|
|
89003
|
-
typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node)
|
|
89049
|
+
typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node, container)
|
|
89004
89050
|
));
|
|
89005
89051
|
properties = append(properties, typeProperty);
|
|
89006
89052
|
}
|
|
@@ -92437,7 +92483,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92437
92483
|
let currentNameScope;
|
|
92438
92484
|
return {
|
|
92439
92485
|
serializeTypeNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeNode, node),
|
|
92440
|
-
serializeTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node),
|
|
92486
|
+
serializeTypeOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node, container),
|
|
92441
92487
|
serializeParameterTypesOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeParameterTypesOfNode, node, container),
|
|
92442
92488
|
serializeReturnTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeReturnTypeOfNode, node)
|
|
92443
92489
|
};
|
|
@@ -92451,18 +92497,18 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92451
92497
|
currentNameScope = savedCurrentNameScope;
|
|
92452
92498
|
return result;
|
|
92453
92499
|
}
|
|
92454
|
-
function getAccessorTypeNode(node) {
|
|
92455
|
-
const accessors =
|
|
92500
|
+
function getAccessorTypeNode(node, container) {
|
|
92501
|
+
const accessors = getAllAccessorDeclarations(container.members, node);
|
|
92456
92502
|
return accessors.setAccessor && getSetAccessorTypeAnnotationNode(accessors.setAccessor) || accessors.getAccessor && getEffectiveReturnTypeNode(accessors.getAccessor);
|
|
92457
92503
|
}
|
|
92458
|
-
function serializeTypeOfNode(node) {
|
|
92504
|
+
function serializeTypeOfNode(node, container) {
|
|
92459
92505
|
switch (node.kind) {
|
|
92460
92506
|
case 172 /* PropertyDeclaration */:
|
|
92461
92507
|
case 169 /* Parameter */:
|
|
92462
92508
|
return serializeTypeNode(node.type);
|
|
92463
92509
|
case 178 /* SetAccessor */:
|
|
92464
92510
|
case 177 /* GetAccessor */:
|
|
92465
|
-
return serializeTypeNode(getAccessorTypeNode(node));
|
|
92511
|
+
return serializeTypeNode(getAccessorTypeNode(node, container));
|
|
92466
92512
|
case 263 /* ClassDeclaration */:
|
|
92467
92513
|
case 231 /* ClassExpression */:
|
|
92468
92514
|
case 174 /* MethodDeclaration */:
|
|
@@ -92485,7 +92531,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
92485
92531
|
if (parameter.dotDotDotToken) {
|
|
92486
92532
|
expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type)));
|
|
92487
92533
|
} else {
|
|
92488
|
-
expressions.push(serializeTypeOfNode(parameter));
|
|
92534
|
+
expressions.push(serializeTypeOfNode(parameter, container));
|
|
92489
92535
|
}
|
|
92490
92536
|
}
|
|
92491
92537
|
}
|
|
@@ -108875,7 +108921,7 @@ function transformDeclarations(context) {
|
|
|
108875
108921
|
if (!isPrivate) {
|
|
108876
108922
|
const valueParameter = getSetAccessorValueParameter(input);
|
|
108877
108923
|
if (valueParameter) {
|
|
108878
|
-
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input,
|
|
108924
|
+
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
|
|
108879
108925
|
newValueParameter = ensureParameter(
|
|
108880
108926
|
valueParameter,
|
|
108881
108927
|
/*modifierMask*/
|
|
@@ -109161,7 +109207,7 @@ function transformDeclarations(context) {
|
|
|
109161
109207
|
void 0
|
|
109162
109208
|
);
|
|
109163
109209
|
}
|
|
109164
|
-
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input,
|
|
109210
|
+
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
|
|
109165
109211
|
return cleanup(factory2.updateGetAccessorDeclaration(
|
|
109166
109212
|
input,
|
|
109167
109213
|
ensureModifiers(input),
|
|
@@ -111009,7 +111055,6 @@ var notImplementedResolver = {
|
|
|
111009
111055
|
isLiteralConstDeclaration: notImplemented,
|
|
111010
111056
|
getJsxFactoryEntity: notImplemented,
|
|
111011
111057
|
getJsxFragmentFactoryEntity: notImplemented,
|
|
111012
|
-
getAllAccessorDeclarations: notImplemented,
|
|
111013
111058
|
isBindingCapturedByNode: notImplemented,
|
|
111014
111059
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
111015
111060
|
isImportRequiredByAugmentation: notImplemented
|
|
@@ -121951,7 +121996,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
121951
121996
|
impliedFormatPackageJsons.delete(newFile.resolvedPath);
|
|
121952
121997
|
});
|
|
121953
121998
|
impliedFormatPackageJsons.forEach((existing, path) => {
|
|
121954
|
-
|
|
121999
|
+
const newFile = newProgram == null ? void 0 : newProgram.getSourceFileByPath(path);
|
|
122000
|
+
if (!newFile || newFile.resolvedPath !== path) {
|
|
121955
122001
|
existing.forEach((location) => fileWatchesOfAffectingLocations.get(location).files--);
|
|
121956
122002
|
impliedFormatPackageJsons.delete(path);
|
|
121957
122003
|
}
|
package/lib/typescript.js
CHANGED
|
@@ -2328,7 +2328,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2328
2328
|
|
|
2329
2329
|
// src/compiler/corePublic.ts
|
|
2330
2330
|
var versionMajorMinor = "5.5";
|
|
2331
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2331
|
+
var version = `${versionMajorMinor}.0-insiders.20240329`;
|
|
2332
2332
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2333
2333
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2334
2334
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -47431,17 +47431,23 @@ function getLocalModuleSpecifier(moduleFileName, info, compilerOptions, host, im
|
|
|
47431
47431
|
if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
|
|
47432
47432
|
return maybeNonRelative;
|
|
47433
47433
|
}
|
|
47434
|
-
|
|
47435
|
-
|
|
47436
|
-
|
|
47437
|
-
|
|
47438
|
-
if (nearestSourcePackageJson !== nearestTargetPackageJson) {
|
|
47434
|
+
const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
|
|
47435
|
+
const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
|
|
47436
|
+
const ignoreCase = !hostUsesCaseSensitiveFileNames(host);
|
|
47437
|
+
if (!packageJsonPathsAreEqual(nearestTargetPackageJson, nearestSourcePackageJson, ignoreCase)) {
|
|
47439
47438
|
return maybeNonRelative;
|
|
47440
47439
|
}
|
|
47441
47440
|
return relativePath;
|
|
47442
47441
|
}
|
|
47443
47442
|
return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
|
|
47444
47443
|
}
|
|
47444
|
+
function packageJsonPathsAreEqual(a, b, ignoreCase) {
|
|
47445
|
+
if (a === b)
|
|
47446
|
+
return true;
|
|
47447
|
+
if (a === void 0 || b === void 0)
|
|
47448
|
+
return false;
|
|
47449
|
+
return comparePaths(a, b, ignoreCase) === 0 /* EqualTo */;
|
|
47450
|
+
}
|
|
47445
47451
|
function countPathComponents(path) {
|
|
47446
47452
|
let count = 0;
|
|
47447
47453
|
for (let i = startsWith(path, "./") ? 2 : 0; i < path.length; i++) {
|
|
@@ -52736,6 +52742,7 @@ function createTypeChecker(host) {
|
|
|
52736
52742
|
void 0,
|
|
52737
52743
|
addUndefined
|
|
52738
52744
|
)),
|
|
52745
|
+
serializeReturnTypeForSignature: (signature, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => serializeReturnTypeForSignature(context, signature)),
|
|
52739
52746
|
indexInfoToIndexSignatureDeclaration: (indexInfo, enclosingDeclaration, flags, tracker) => withContext(enclosingDeclaration, flags, tracker, (context) => indexInfoToIndexSignatureDeclarationHelper(
|
|
52740
52747
|
indexInfo,
|
|
52741
52748
|
context,
|
|
@@ -53820,9 +53827,8 @@ function createTypeChecker(host) {
|
|
|
53820
53827
|
}
|
|
53821
53828
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
53822
53829
|
var _a;
|
|
53823
|
-
const
|
|
53824
|
-
|
|
53825
|
-
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
53830
|
+
const flags = context.flags;
|
|
53831
|
+
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
53826
53832
|
context.approximateLength += 3;
|
|
53827
53833
|
let typeParameters;
|
|
53828
53834
|
let typeArguments;
|
|
@@ -53903,22 +53909,12 @@ function createTypeChecker(host) {
|
|
|
53903
53909
|
if (thisParameter) {
|
|
53904
53910
|
parameters.unshift(thisParameter);
|
|
53905
53911
|
}
|
|
53906
|
-
|
|
53907
|
-
const
|
|
53908
|
-
if (typePredicate) {
|
|
53909
|
-
returnTypeNode = typePredicateToTypePredicateNodeHelper(typePredicate, context);
|
|
53910
|
-
} else {
|
|
53911
|
-
const returnType = getReturnTypeOfSignature(signature);
|
|
53912
|
-
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
53913
|
-
returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports);
|
|
53914
|
-
} else if (!suppressAny) {
|
|
53915
|
-
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
53916
|
-
}
|
|
53917
|
-
}
|
|
53912
|
+
context.flags = flags;
|
|
53913
|
+
const returnTypeNode = serializeReturnTypeForSignature(context, signature, options == null ? void 0 : options.privateSymbolVisitor, options == null ? void 0 : options.bundledImports);
|
|
53918
53914
|
let modifiers = options == null ? void 0 : options.modifiers;
|
|
53919
53915
|
if (kind === 185 /* ConstructorType */ && signature.flags & 4 /* Abstract */) {
|
|
53920
|
-
const
|
|
53921
|
-
modifiers = factory.createModifiersFromModifierFlags(
|
|
53916
|
+
const flags2 = modifiersToFlags(modifiers);
|
|
53917
|
+
modifiers = factory.createModifiersFromModifierFlags(flags2 | 64 /* Abstract */);
|
|
53922
53918
|
}
|
|
53923
53919
|
const node = kind === 179 /* CallSignature */ ? factory.createCallSignature(typeParameters, parameters, returnTypeNode) : kind === 180 /* ConstructSignature */ ? factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : kind === 173 /* MethodSignature */ ? factory.createMethodSignature(modifiers, (options == null ? void 0 : options.name) ?? factory.createIdentifier(""), options == null ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : kind === 174 /* MethodDeclaration */ ? factory.createMethodDeclaration(
|
|
53924
53920
|
modifiers,
|
|
@@ -54620,7 +54616,7 @@ function createTypeChecker(host) {
|
|
|
54620
54616
|
return initial;
|
|
54621
54617
|
}
|
|
54622
54618
|
function getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration) {
|
|
54623
|
-
return symbol.declarations && find(symbol.declarations, (s) => !!
|
|
54619
|
+
return symbol.declarations && find(symbol.declarations, (s) => !!getNonlocalEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!findAncestor(s, (n) => n === enclosingDeclaration)));
|
|
54624
54620
|
}
|
|
54625
54621
|
function existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(existing, type) {
|
|
54626
54622
|
return !(getObjectFlags(type) & 4 /* Reference */) || !isTypeReferenceNode(existing) || length(existing.typeArguments) >= getMinTypeArgumentCount(type.target.typeParameters);
|
|
@@ -54636,7 +54632,7 @@ function createTypeChecker(host) {
|
|
|
54636
54632
|
if (!isErrorType(type) && enclosingDeclaration) {
|
|
54637
54633
|
const declWithExistingAnnotation = getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
|
|
54638
54634
|
if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
|
|
54639
|
-
const existing =
|
|
54635
|
+
const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
|
|
54640
54636
|
const result2 = tryReuseExistingTypeNode(context, existing, type, declWithExistingAnnotation, addUndefined, includePrivateSymbol, bundled);
|
|
54641
54637
|
if (result2) {
|
|
54642
54638
|
return result2;
|
|
@@ -54662,9 +54658,26 @@ function createTypeChecker(host) {
|
|
|
54662
54658
|
}
|
|
54663
54659
|
return false;
|
|
54664
54660
|
}
|
|
54665
|
-
function serializeReturnTypeForSignature(context,
|
|
54661
|
+
function serializeReturnTypeForSignature(context, signature, includePrivateSymbol, bundled) {
|
|
54662
|
+
const suppressAny = context.flags & 256 /* SuppressAnyReturnType */;
|
|
54663
|
+
const flags = context.flags;
|
|
54664
|
+
if (suppressAny)
|
|
54665
|
+
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
54666
|
+
let returnTypeNode;
|
|
54667
|
+
const returnType = getReturnTypeOfSignature(signature);
|
|
54668
|
+
if (returnType && !(suppressAny && isTypeAny(returnType))) {
|
|
54669
|
+
returnTypeNode = serializeReturnTypeForSignatureWorker(context, signature, includePrivateSymbol, bundled);
|
|
54670
|
+
} else if (!suppressAny) {
|
|
54671
|
+
returnTypeNode = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
54672
|
+
}
|
|
54673
|
+
context.flags = flags;
|
|
54674
|
+
return returnTypeNode;
|
|
54675
|
+
}
|
|
54676
|
+
function serializeReturnTypeForSignatureWorker(context, signature, includePrivateSymbol, bundled) {
|
|
54677
|
+
const typePredicate = getTypePredicateOfSignature(signature);
|
|
54678
|
+
const type = getReturnTypeOfSignature(signature);
|
|
54666
54679
|
if (!isErrorType(type) && context.enclosingDeclaration) {
|
|
54667
|
-
const annotation = signature.declaration &&
|
|
54680
|
+
const annotation = signature.declaration && getNonlocalEffectiveReturnTypeAnnotationNode(signature.declaration);
|
|
54668
54681
|
const enclosingDeclarationIgnoringFakeScope = getEnclosingDeclarationIgnoringFakeScope(context.enclosingDeclaration);
|
|
54669
54682
|
if (!!findAncestor(annotation, (n) => n === enclosingDeclarationIgnoringFakeScope) && annotation) {
|
|
54670
54683
|
const annotated = getTypeFromTypeNode(annotation);
|
|
@@ -54675,7 +54688,11 @@ function createTypeChecker(host) {
|
|
|
54675
54688
|
}
|
|
54676
54689
|
}
|
|
54677
54690
|
}
|
|
54678
|
-
|
|
54691
|
+
if (typePredicate) {
|
|
54692
|
+
return typePredicateToTypePredicateNodeHelper(typePredicate, context);
|
|
54693
|
+
}
|
|
54694
|
+
const expr = signature.declaration && getPossibleTypeNodeReuseExpression(signature.declaration);
|
|
54695
|
+
return expressionOrTypeToTypeNode(context, expr, type);
|
|
54679
54696
|
}
|
|
54680
54697
|
function trackExistingEntityName(node, context, includePrivateSymbol) {
|
|
54681
54698
|
let introducesError = false;
|
|
@@ -54840,30 +54857,24 @@ function createTypeChecker(host) {
|
|
|
54840
54857
|
node.isTypeOf
|
|
54841
54858
|
);
|
|
54842
54859
|
}
|
|
54843
|
-
if (
|
|
54844
|
-
|
|
54845
|
-
return factory.updateParameterDeclaration(
|
|
54846
|
-
node,
|
|
54847
|
-
/*modifiers*/
|
|
54848
|
-
void 0,
|
|
54849
|
-
node.dotDotDotToken,
|
|
54850
|
-
visitEachChild(
|
|
54851
|
-
node.name,
|
|
54852
|
-
visitExistingNodeTreeSymbols,
|
|
54853
|
-
/*context*/
|
|
54854
|
-
void 0
|
|
54855
|
-
),
|
|
54856
|
-
node.questionToken,
|
|
54857
|
-
factory.createKeywordTypeNode(133 /* AnyKeyword */),
|
|
54858
|
-
/*initializer*/
|
|
54859
|
-
void 0
|
|
54860
|
-
);
|
|
54861
|
-
}
|
|
54860
|
+
if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
|
|
54861
|
+
return void 0;
|
|
54862
54862
|
}
|
|
54863
|
-
if (isPropertySignature(node)) {
|
|
54864
|
-
|
|
54865
|
-
|
|
54863
|
+
if (isFunctionLike(node) && !node.type || isPropertyDeclaration(node) && !node.type && !node.initializer || isPropertySignature(node) && !node.type && !node.initializer || isParameter(node) && !node.type && !node.initializer) {
|
|
54864
|
+
let visited = visitEachChild(
|
|
54865
|
+
node,
|
|
54866
|
+
visitExistingNodeTreeSymbols,
|
|
54867
|
+
/*context*/
|
|
54868
|
+
void 0
|
|
54869
|
+
);
|
|
54870
|
+
if (visited === node) {
|
|
54871
|
+
visited = setTextRange(factory.cloneNode(node), node);
|
|
54872
|
+
}
|
|
54873
|
+
visited.type = factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
54874
|
+
if (isParameter(node)) {
|
|
54875
|
+
visited.modifiers = void 0;
|
|
54866
54876
|
}
|
|
54877
|
+
return visited;
|
|
54867
54878
|
}
|
|
54868
54879
|
if (isEntityName(node) || isEntityNameExpression(node)) {
|
|
54869
54880
|
const { introducesError, node: result } = trackExistingEntityName(node, context, includePrivateSymbol);
|
|
@@ -59562,11 +59573,15 @@ function createTypeChecker(host) {
|
|
|
59562
59573
|
const modifiers = getMappedTypeModifiers(type);
|
|
59563
59574
|
return modifiers & 8 /* ExcludeOptional */ ? -1 : modifiers & 4 /* IncludeOptional */ ? 1 : 0;
|
|
59564
59575
|
}
|
|
59565
|
-
function getModifiersTypeOptionality(type) {
|
|
59566
|
-
return type.flags & 2097152 /* Intersection */ ? Math.max(...map(type.types, getModifiersTypeOptionality)) : getObjectFlags(type) & 32 /* Mapped */ ? getCombinedMappedTypeOptionality(type) : 0;
|
|
59567
|
-
}
|
|
59568
59576
|
function getCombinedMappedTypeOptionality(type) {
|
|
59569
|
-
|
|
59577
|
+
if (getObjectFlags(type) & 32 /* Mapped */) {
|
|
59578
|
+
return getMappedTypeOptionality(type) || getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(type));
|
|
59579
|
+
}
|
|
59580
|
+
if (type.flags & 2097152 /* Intersection */) {
|
|
59581
|
+
const optionality = getCombinedMappedTypeOptionality(type.types[0]);
|
|
59582
|
+
return every(type.types, (t, i) => i === 0 || getCombinedMappedTypeOptionality(t) === optionality) ? optionality : 0;
|
|
59583
|
+
}
|
|
59584
|
+
return 0;
|
|
59570
59585
|
}
|
|
59571
59586
|
function isPartialMappedType(type) {
|
|
59572
59587
|
return !!(getObjectFlags(type) & 32 /* Mapped */ && getMappedTypeModifiers(type) & 4 /* IncludeOptional */);
|
|
@@ -63375,13 +63390,18 @@ function createTypeChecker(host) {
|
|
|
63375
63390
|
const mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
|
|
63376
63391
|
const templateMapper = combineTypeMappers(objectType.mapper, mapper);
|
|
63377
63392
|
const instantiatedTemplateType = instantiateType(getTemplateTypeFromMappedType(objectType.target || objectType), templateMapper);
|
|
63393
|
+
const isOptional = getMappedTypeOptionality(objectType) > 0 || (isGenericType(objectType) ? getCombinedMappedTypeOptionality(getModifiersTypeFromMappedType(objectType)) > 0 : couldAccessOptionalProperty(objectType, index));
|
|
63378
63394
|
return addOptionality(
|
|
63379
63395
|
instantiatedTemplateType,
|
|
63380
63396
|
/*isProperty*/
|
|
63381
63397
|
true,
|
|
63382
|
-
|
|
63398
|
+
isOptional
|
|
63383
63399
|
);
|
|
63384
63400
|
}
|
|
63401
|
+
function couldAccessOptionalProperty(objectType, indexType) {
|
|
63402
|
+
const indexConstraint = getBaseConstraintOfType(indexType);
|
|
63403
|
+
return !!indexConstraint && some(getPropertiesOfType(objectType), (p) => !!(p.flags & 16777216 /* Optional */) && isTypeAssignableTo(getLiteralTypeFromProperty(p, 8576 /* StringOrNumberLiteralOrUnique */), indexConstraint));
|
|
63404
|
+
}
|
|
63385
63405
|
function getIndexedAccessType(objectType, indexType, accessFlags = 0 /* None */, accessNode, aliasSymbol, aliasTypeArguments) {
|
|
63386
63406
|
return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType);
|
|
63387
63407
|
}
|
|
@@ -75961,7 +75981,7 @@ function createTypeChecker(host) {
|
|
|
75961
75981
|
if (isErrorType(objectType) || objectType === silentNeverType) {
|
|
75962
75982
|
return objectType;
|
|
75963
75983
|
}
|
|
75964
|
-
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression)) {
|
|
75984
|
+
if (isConstEnumObjectType(objectType) && !isStringLiteralLike(indexExpression) && !isPreservedConstEnumUse(node, objectType)) {
|
|
75965
75985
|
error2(indexExpression, Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
|
|
75966
75986
|
return errorType;
|
|
75967
75987
|
}
|
|
@@ -81005,17 +81025,28 @@ function createTypeChecker(host) {
|
|
|
81005
81025
|
}
|
|
81006
81026
|
function checkConstEnumAccess(node, type) {
|
|
81007
81027
|
const ok = node.parent.kind === 211 /* PropertyAccessExpression */ && node.parent.expression === node || node.parent.kind === 212 /* ElementAccessExpression */ && node.parent.expression === node || ((node.kind === 80 /* Identifier */ || node.kind === 166 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || node.parent.kind === 186 /* TypeQuery */ && node.parent.exprName === node) || node.parent.kind === 281 /* ExportSpecifier */;
|
|
81008
|
-
if (!ok) {
|
|
81009
|
-
|
|
81028
|
+
if (!ok || getIsolatedModules(compilerOptions)) {
|
|
81029
|
+
if (!isPreservedConstEnumUse(node, type)) {
|
|
81030
|
+
if (!ok) {
|
|
81031
|
+
error2(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
|
|
81032
|
+
} else if (type.symbol.valueDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
81033
|
+
error2(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
81034
|
+
}
|
|
81035
|
+
}
|
|
81010
81036
|
}
|
|
81011
|
-
|
|
81012
|
-
|
|
81013
|
-
|
|
81014
|
-
|
|
81015
|
-
|
|
81016
|
-
|
|
81037
|
+
}
|
|
81038
|
+
function isPreservedConstEnumUse(use, enumType) {
|
|
81039
|
+
Debug.assert(!!(enumType.symbol.flags & 128 /* ConstEnum */));
|
|
81040
|
+
const constEnumDeclaration = enumType.symbol.valueDeclaration;
|
|
81041
|
+
const otherFile = getSourceFileOfNode(constEnumDeclaration);
|
|
81042
|
+
if (!otherFile.isDeclarationFile) {
|
|
81043
|
+
if (constEnumDeclaration.flags & 33554432 /* Ambient */ && !isValidTypeOnlyAliasUseSite(use)) {
|
|
81044
|
+
return false;
|
|
81017
81045
|
}
|
|
81046
|
+
return shouldPreserveConstEnums(compilerOptions);
|
|
81018
81047
|
}
|
|
81048
|
+
const redirect = host.getRedirectReferenceForResolutionFromSourceOfProject(otherFile.resolvedPath);
|
|
81049
|
+
return redirect && shouldPreserveConstEnums(redirect.commandLine.options);
|
|
81019
81050
|
}
|
|
81020
81051
|
function checkParenthesizedExpression(node, checkMode) {
|
|
81021
81052
|
if (hasJSDocNodes(node)) {
|
|
@@ -87925,9 +87956,23 @@ function createTypeChecker(host) {
|
|
|
87925
87956
|
function isDeclarationWithPossibleInnerTypeNodeReuse(declaration) {
|
|
87926
87957
|
return isFunctionLike(declaration) || isExportAssignment(declaration) || isVariableLike(declaration);
|
|
87927
87958
|
}
|
|
87959
|
+
function getAllAccessorDeclarationsForDeclaration(accessor) {
|
|
87960
|
+
accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration);
|
|
87961
|
+
const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */;
|
|
87962
|
+
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind);
|
|
87963
|
+
const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor;
|
|
87964
|
+
const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor;
|
|
87965
|
+
const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor;
|
|
87966
|
+
const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor;
|
|
87967
|
+
return {
|
|
87968
|
+
firstAccessor,
|
|
87969
|
+
secondAccessor,
|
|
87970
|
+
setAccessor,
|
|
87971
|
+
getAccessor
|
|
87972
|
+
};
|
|
87973
|
+
}
|
|
87928
87974
|
function getPossibleTypeNodeReuseExpression(declaration) {
|
|
87929
|
-
|
|
87930
|
-
return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarations((_a = getSymbolOfDeclaration(declaration.parent)) == null ? void 0 : _a.declarations, declaration.parent).getAccessor) : void 0;
|
|
87975
|
+
return isFunctionLike(declaration) && !isSetAccessor(declaration) ? getSingleReturnExpression(declaration) : isExportAssignment(declaration) ? declaration.expression : !!declaration.initializer ? declaration.initializer : isParameter(declaration) && isSetAccessor(declaration.parent) ? getSingleReturnExpression(getAllAccessorDeclarationsForDeclaration(declaration.parent).getAccessor) : void 0;
|
|
87931
87976
|
}
|
|
87932
87977
|
function getSingleReturnExpression(declaration) {
|
|
87933
87978
|
let candidateExpr;
|
|
@@ -87953,20 +87998,7 @@ function createTypeChecker(host) {
|
|
|
87953
87998
|
if (!signatureDeclaration) {
|
|
87954
87999
|
return factory.createToken(133 /* AnyKeyword */);
|
|
87955
88000
|
}
|
|
87956
|
-
|
|
87957
|
-
const typePredicate = getTypePredicateOfSignature(signature);
|
|
87958
|
-
if (typePredicate) {
|
|
87959
|
-
return nodeBuilder.typePredicateToTypePredicateNode(typePredicate, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
87960
|
-
}
|
|
87961
|
-
return nodeBuilder.expressionOrTypeToTypeNode(
|
|
87962
|
-
getPossibleTypeNodeReuseExpression(signatureDeclaration),
|
|
87963
|
-
getReturnTypeOfSignature(signature),
|
|
87964
|
-
/*addUndefined*/
|
|
87965
|
-
void 0,
|
|
87966
|
-
enclosingDeclaration,
|
|
87967
|
-
flags | 1024 /* MultilineObjectLiterals */,
|
|
87968
|
-
tracker
|
|
87969
|
-
);
|
|
88001
|
+
return nodeBuilder.serializeReturnTypeForSignature(getSignatureFromDeclaration(signatureDeclaration), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
|
|
87970
88002
|
}
|
|
87971
88003
|
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
|
|
87972
88004
|
const expr = getParseTreeNode(exprIn, isExpression);
|
|
@@ -88125,6 +88157,35 @@ function createTypeChecker(host) {
|
|
|
88125
88157
|
return parseIsolatedEntityName(compilerOptions.jsxFragmentFactory, languageVersion);
|
|
88126
88158
|
}
|
|
88127
88159
|
}
|
|
88160
|
+
function getNonlocalEffectiveTypeAnnotationNode(node) {
|
|
88161
|
+
const direct = getEffectiveTypeAnnotationNode(node);
|
|
88162
|
+
if (direct) {
|
|
88163
|
+
return direct;
|
|
88164
|
+
}
|
|
88165
|
+
if (node.kind === 169 /* Parameter */ && node.parent.kind === 178 /* SetAccessor */) {
|
|
88166
|
+
const other = getAllAccessorDeclarationsForDeclaration(node.parent).getAccessor;
|
|
88167
|
+
if (other) {
|
|
88168
|
+
return getEffectiveReturnTypeNode(other);
|
|
88169
|
+
}
|
|
88170
|
+
}
|
|
88171
|
+
return void 0;
|
|
88172
|
+
}
|
|
88173
|
+
function getNonlocalEffectiveReturnTypeAnnotationNode(node) {
|
|
88174
|
+
const direct = getEffectiveReturnTypeNode(node);
|
|
88175
|
+
if (direct) {
|
|
88176
|
+
return direct;
|
|
88177
|
+
}
|
|
88178
|
+
if (node.kind === 177 /* GetAccessor */) {
|
|
88179
|
+
const other = getAllAccessorDeclarationsForDeclaration(node).setAccessor;
|
|
88180
|
+
if (other) {
|
|
88181
|
+
const param = getSetAccessorValueParameter(other);
|
|
88182
|
+
if (param) {
|
|
88183
|
+
return getEffectiveTypeAnnotationNode(param);
|
|
88184
|
+
}
|
|
88185
|
+
}
|
|
88186
|
+
}
|
|
88187
|
+
return void 0;
|
|
88188
|
+
}
|
|
88128
88189
|
function createResolver() {
|
|
88129
88190
|
return {
|
|
88130
88191
|
getReferencedExportContainer,
|
|
@@ -88178,21 +88239,6 @@ function createTypeChecker(host) {
|
|
|
88178
88239
|
},
|
|
88179
88240
|
getJsxFactoryEntity,
|
|
88180
88241
|
getJsxFragmentFactoryEntity,
|
|
88181
|
-
getAllAccessorDeclarations(accessor) {
|
|
88182
|
-
accessor = getParseTreeNode(accessor, isGetOrSetAccessorDeclaration);
|
|
88183
|
-
const otherKind = accessor.kind === 178 /* SetAccessor */ ? 177 /* GetAccessor */ : 178 /* SetAccessor */;
|
|
88184
|
-
const otherAccessor = getDeclarationOfKind(getSymbolOfDeclaration(accessor), otherKind);
|
|
88185
|
-
const firstAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? otherAccessor : accessor;
|
|
88186
|
-
const secondAccessor = otherAccessor && otherAccessor.pos < accessor.pos ? accessor : otherAccessor;
|
|
88187
|
-
const setAccessor = accessor.kind === 178 /* SetAccessor */ ? accessor : otherAccessor;
|
|
88188
|
-
const getAccessor = accessor.kind === 177 /* GetAccessor */ ? accessor : otherAccessor;
|
|
88189
|
-
return {
|
|
88190
|
-
firstAccessor,
|
|
88191
|
-
secondAccessor,
|
|
88192
|
-
setAccessor,
|
|
88193
|
-
getAccessor
|
|
88194
|
-
};
|
|
88195
|
-
},
|
|
88196
88242
|
isBindingCapturedByNode: (node, decl) => {
|
|
88197
88243
|
const parseNode = getParseTreeNode(node);
|
|
88198
88244
|
const parseDecl = getParseTreeNode(decl);
|
|
@@ -88547,7 +88593,7 @@ function createTypeChecker(host) {
|
|
|
88547
88593
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_are_not_valid_here);
|
|
88548
88594
|
}
|
|
88549
88595
|
} else if (legacyDecorators && (node.kind === 177 /* GetAccessor */ || node.kind === 178 /* SetAccessor */)) {
|
|
88550
|
-
const accessors =
|
|
88596
|
+
const accessors = getAllAccessorDeclarationsForDeclaration(node);
|
|
88551
88597
|
if (hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) {
|
|
88552
88598
|
return grammarErrorOnFirstToken(node, Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
|
|
88553
88599
|
}
|
|
@@ -93925,7 +93971,7 @@ function transformTypeScript(context) {
|
|
|
93925
93971
|
if (typeSerializer) {
|
|
93926
93972
|
let decorators;
|
|
93927
93973
|
if (shouldAddTypeMetadata(node)) {
|
|
93928
|
-
const typeMetadata = emitHelpers().createMetadataHelper("design:type", typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node));
|
|
93974
|
+
const typeMetadata = emitHelpers().createMetadataHelper("design:type", typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node, container));
|
|
93929
93975
|
decorators = append(decorators, factory2.createDecorator(typeMetadata));
|
|
93930
93976
|
}
|
|
93931
93977
|
if (shouldAddParamTypesMetadata(node)) {
|
|
@@ -93952,7 +93998,7 @@ function transformTypeScript(context) {
|
|
|
93952
93998
|
/*type*/
|
|
93953
93999
|
void 0,
|
|
93954
94000
|
factory2.createToken(39 /* EqualsGreaterThanToken */),
|
|
93955
|
-
typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node)
|
|
94001
|
+
typeSerializer.serializeTypeOfNode({ currentLexicalScope, currentNameScope: container }, node, container)
|
|
93956
94002
|
));
|
|
93957
94003
|
properties = append(properties, typeProperty);
|
|
93958
94004
|
}
|
|
@@ -97389,7 +97435,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
97389
97435
|
let currentNameScope;
|
|
97390
97436
|
return {
|
|
97391
97437
|
serializeTypeNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeNode, node),
|
|
97392
|
-
serializeTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node),
|
|
97438
|
+
serializeTypeOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeTypeOfNode, node, container),
|
|
97393
97439
|
serializeParameterTypesOfNode: (serializerContext, node, container) => setSerializerContextAnd(serializerContext, serializeParameterTypesOfNode, node, container),
|
|
97394
97440
|
serializeReturnTypeOfNode: (serializerContext, node) => setSerializerContextAnd(serializerContext, serializeReturnTypeOfNode, node)
|
|
97395
97441
|
};
|
|
@@ -97403,18 +97449,18 @@ function createRuntimeTypeSerializer(context) {
|
|
|
97403
97449
|
currentNameScope = savedCurrentNameScope;
|
|
97404
97450
|
return result;
|
|
97405
97451
|
}
|
|
97406
|
-
function getAccessorTypeNode(node) {
|
|
97407
|
-
const accessors =
|
|
97452
|
+
function getAccessorTypeNode(node, container) {
|
|
97453
|
+
const accessors = getAllAccessorDeclarations(container.members, node);
|
|
97408
97454
|
return accessors.setAccessor && getSetAccessorTypeAnnotationNode(accessors.setAccessor) || accessors.getAccessor && getEffectiveReturnTypeNode(accessors.getAccessor);
|
|
97409
97455
|
}
|
|
97410
|
-
function serializeTypeOfNode(node) {
|
|
97456
|
+
function serializeTypeOfNode(node, container) {
|
|
97411
97457
|
switch (node.kind) {
|
|
97412
97458
|
case 172 /* PropertyDeclaration */:
|
|
97413
97459
|
case 169 /* Parameter */:
|
|
97414
97460
|
return serializeTypeNode(node.type);
|
|
97415
97461
|
case 178 /* SetAccessor */:
|
|
97416
97462
|
case 177 /* GetAccessor */:
|
|
97417
|
-
return serializeTypeNode(getAccessorTypeNode(node));
|
|
97463
|
+
return serializeTypeNode(getAccessorTypeNode(node, container));
|
|
97418
97464
|
case 263 /* ClassDeclaration */:
|
|
97419
97465
|
case 231 /* ClassExpression */:
|
|
97420
97466
|
case 174 /* MethodDeclaration */:
|
|
@@ -97437,7 +97483,7 @@ function createRuntimeTypeSerializer(context) {
|
|
|
97437
97483
|
if (parameter.dotDotDotToken) {
|
|
97438
97484
|
expressions.push(serializeTypeNode(getRestParameterElementType(parameter.type)));
|
|
97439
97485
|
} else {
|
|
97440
|
-
expressions.push(serializeTypeOfNode(parameter));
|
|
97486
|
+
expressions.push(serializeTypeOfNode(parameter, container));
|
|
97441
97487
|
}
|
|
97442
97488
|
}
|
|
97443
97489
|
}
|
|
@@ -113827,7 +113873,7 @@ function transformDeclarations(context) {
|
|
|
113827
113873
|
if (!isPrivate) {
|
|
113828
113874
|
const valueParameter = getSetAccessorValueParameter(input);
|
|
113829
113875
|
if (valueParameter) {
|
|
113830
|
-
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input,
|
|
113876
|
+
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
|
|
113831
113877
|
newValueParameter = ensureParameter(
|
|
113832
113878
|
valueParameter,
|
|
113833
113879
|
/*modifierMask*/
|
|
@@ -114113,7 +114159,7 @@ function transformDeclarations(context) {
|
|
|
114113
114159
|
void 0
|
|
114114
114160
|
);
|
|
114115
114161
|
}
|
|
114116
|
-
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input,
|
|
114162
|
+
const accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, getAllAccessorDeclarations(isObjectLiteralExpression(input.parent) ? input.parent.properties : input.parent.members, input));
|
|
114117
114163
|
return cleanup(factory2.updateGetAccessorDeclaration(
|
|
114118
114164
|
input,
|
|
114119
114165
|
ensureModifiers(input),
|
|
@@ -115972,7 +116018,6 @@ var notImplementedResolver = {
|
|
|
115972
116018
|
isLiteralConstDeclaration: notImplemented,
|
|
115973
116019
|
getJsxFactoryEntity: notImplemented,
|
|
115974
116020
|
getJsxFragmentFactoryEntity: notImplemented,
|
|
115975
|
-
getAllAccessorDeclarations: notImplemented,
|
|
115976
116021
|
isBindingCapturedByNode: notImplemented,
|
|
115977
116022
|
getDeclarationStatementsForSourceFile: notImplemented,
|
|
115978
116023
|
isImportRequiredByAugmentation: notImplemented
|
|
@@ -126998,7 +127043,8 @@ function createResolutionCache(resolutionHost, rootDirForResolution, logChangesW
|
|
|
126998
127043
|
impliedFormatPackageJsons.delete(newFile.resolvedPath);
|
|
126999
127044
|
});
|
|
127000
127045
|
impliedFormatPackageJsons.forEach((existing, path) => {
|
|
127001
|
-
|
|
127046
|
+
const newFile = newProgram == null ? void 0 : newProgram.getSourceFileByPath(path);
|
|
127047
|
+
if (!newFile || newFile.resolvedPath !== path) {
|
|
127002
127048
|
existing.forEach((location) => fileWatchesOfAffectingLocations.get(location).files--);
|
|
127003
127049
|
impliedFormatPackageJsons.delete(path);
|
|
127004
127050
|
}
|
|
@@ -159796,10 +159842,7 @@ function getContextualType(previousToken, position, sourceFile, checker) {
|
|
|
159796
159842
|
return isJsxExpression(parent2) && !isJsxElement(parent2.parent) && !isJsxFragment(parent2.parent) ? checker.getContextualTypeForJsxAttribute(parent2.parent) : void 0;
|
|
159797
159843
|
default:
|
|
159798
159844
|
const argInfo = ts_SignatureHelp_exports.getArgumentInfoForCompletions(previousToken, position, sourceFile, checker);
|
|
159799
|
-
return argInfo ? (
|
|
159800
|
-
// At `,`, treat this as the next argument after the comma.
|
|
159801
|
-
checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex + (previousToken.kind === 28 /* CommaToken */ ? 1 : 0))
|
|
159802
|
-
) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? (
|
|
159845
|
+
return argInfo ? checker.getContextualTypeForArgumentAtIndex(argInfo.invocation, argInfo.argumentIndex) : isEqualityOperatorKind(previousToken.kind) && isBinaryExpression(parent2) && isEqualityOperatorKind(parent2.operatorToken.kind) ? (
|
|
159803
159846
|
// completion at `x ===/**/` should be for the right side
|
|
159804
159847
|
checker.getTypeAtLocation(parent2.left)
|
|
159805
159848
|
) : checker.getContextualType(previousToken, 4 /* Completions */) || checker.getContextualType(previousToken);
|
|
@@ -168187,12 +168230,7 @@ function getArgumentOrParameterListInfo(node, position, sourceFile, checker) {
|
|
|
168187
168230
|
if (!info)
|
|
168188
168231
|
return void 0;
|
|
168189
168232
|
const { list, argumentIndex } = info;
|
|
168190
|
-
const argumentCount = getArgumentCount(
|
|
168191
|
-
list,
|
|
168192
|
-
/*ignoreTrailingComma*/
|
|
168193
|
-
isInString(sourceFile, position, node),
|
|
168194
|
-
checker
|
|
168195
|
-
);
|
|
168233
|
+
const argumentCount = getArgumentCount(checker, list);
|
|
168196
168234
|
if (argumentIndex !== 0) {
|
|
168197
168235
|
Debug.assertLessThan(argumentIndex, argumentCount);
|
|
168198
168236
|
}
|
|
@@ -168204,7 +168242,7 @@ function getArgumentOrParameterListAndIndex(node, sourceFile, checker) {
|
|
|
168204
168242
|
return { list: getChildListThatStartsWithOpenerToken(node.parent, node, sourceFile), argumentIndex: 0 };
|
|
168205
168243
|
} else {
|
|
168206
168244
|
const list = findContainingList(node);
|
|
168207
|
-
return list && { list, argumentIndex: getArgumentIndex(list, node
|
|
168245
|
+
return list && { list, argumentIndex: getArgumentIndex(checker, list, node) };
|
|
168208
168246
|
}
|
|
168209
168247
|
}
|
|
168210
168248
|
function getImmediatelyContainingArgumentInfo(node, position, sourceFile, checker) {
|
|
@@ -168334,24 +168372,6 @@ function chooseBetterSymbol(s) {
|
|
|
168334
168372
|
return isFunctionTypeNode(d) ? (_a = tryCast(d.parent, canHaveSymbol)) == null ? void 0 : _a.symbol : void 0;
|
|
168335
168373
|
}) || s : s;
|
|
168336
168374
|
}
|
|
168337
|
-
function getArgumentIndex(argumentsList, node, checker) {
|
|
168338
|
-
const args = argumentsList.getChildren();
|
|
168339
|
-
let argumentIndex = 0;
|
|
168340
|
-
for (let pos = 0; pos < length(args); pos++) {
|
|
168341
|
-
const child = args[pos];
|
|
168342
|
-
if (child === node) {
|
|
168343
|
-
break;
|
|
168344
|
-
}
|
|
168345
|
-
if (isSpreadElement(child)) {
|
|
168346
|
-
argumentIndex = argumentIndex + getSpreadElementCount(child, checker) + (pos > 0 ? pos : 0);
|
|
168347
|
-
} else {
|
|
168348
|
-
if (child.kind !== 28 /* CommaToken */) {
|
|
168349
|
-
argumentIndex++;
|
|
168350
|
-
}
|
|
168351
|
-
}
|
|
168352
|
-
}
|
|
168353
|
-
return argumentIndex;
|
|
168354
|
-
}
|
|
168355
168375
|
function getSpreadElementCount(node, checker) {
|
|
168356
168376
|
const spreadType = checker.getTypeAtLocation(node.expression);
|
|
168357
168377
|
if (checker.isTupleType(spreadType)) {
|
|
@@ -168364,19 +168384,48 @@ function getSpreadElementCount(node, checker) {
|
|
|
168364
168384
|
}
|
|
168365
168385
|
return 0;
|
|
168366
168386
|
}
|
|
168367
|
-
function
|
|
168368
|
-
|
|
168369
|
-
|
|
168370
|
-
|
|
168387
|
+
function getArgumentIndex(checker, argumentsList, node) {
|
|
168388
|
+
return getArgumentIndexOrCount(checker, argumentsList, node);
|
|
168389
|
+
}
|
|
168390
|
+
function getArgumentCount(checker, argumentsList) {
|
|
168391
|
+
return getArgumentIndexOrCount(
|
|
168392
|
+
checker,
|
|
168393
|
+
argumentsList,
|
|
168394
|
+
/*node*/
|
|
168395
|
+
void 0
|
|
168396
|
+
);
|
|
168397
|
+
}
|
|
168398
|
+
function getArgumentIndexOrCount(checker, argumentsList, node) {
|
|
168399
|
+
const args = argumentsList.getChildren();
|
|
168400
|
+
let argumentIndex = 0;
|
|
168401
|
+
let skipComma = false;
|
|
168402
|
+
for (const child of args) {
|
|
168403
|
+
if (node && child === node) {
|
|
168404
|
+
if (!skipComma && child.kind === 28 /* CommaToken */) {
|
|
168405
|
+
argumentIndex++;
|
|
168406
|
+
}
|
|
168407
|
+
return argumentIndex;
|
|
168408
|
+
}
|
|
168371
168409
|
if (isSpreadElement(child)) {
|
|
168372
|
-
|
|
168410
|
+
argumentIndex += getSpreadElementCount(child, checker);
|
|
168411
|
+
skipComma = true;
|
|
168412
|
+
continue;
|
|
168413
|
+
}
|
|
168414
|
+
if (child.kind !== 28 /* CommaToken */) {
|
|
168415
|
+
argumentIndex++;
|
|
168416
|
+
skipComma = true;
|
|
168417
|
+
continue;
|
|
168373
168418
|
}
|
|
168419
|
+
if (skipComma) {
|
|
168420
|
+
skipComma = false;
|
|
168421
|
+
continue;
|
|
168422
|
+
}
|
|
168423
|
+
argumentIndex++;
|
|
168374
168424
|
}
|
|
168375
|
-
|
|
168376
|
-
|
|
168377
|
-
argumentCount++;
|
|
168425
|
+
if (node) {
|
|
168426
|
+
return argumentIndex;
|
|
168378
168427
|
}
|
|
168379
|
-
return
|
|
168428
|
+
return args.length && last(args).kind === 28 /* CommaToken */ ? argumentIndex + 1 : argumentIndex;
|
|
168380
168429
|
}
|
|
168381
168430
|
function getArgumentIndexForTemplatePiece(spanIndex, node, position, sourceFile) {
|
|
168382
168431
|
Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node.");
|
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.5.0-pr-
|
|
5
|
+
"version": "5.5.0-pr-57996-3",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "993643625c1a00ba73e686899d1eaea71c22d11a"
|
|
117
117
|
}
|