Skip to content

Commit fc7006c

Browse files
Update LKG
1 parent b45a418 commit fc7006c

File tree

3 files changed

+69
-63
lines changed

3 files changed

+69
-63
lines changed

lib/tsc.js

+23-21
Original file line numberDiff line numberDiff line change
@@ -55321,13 +55321,16 @@ function createTypeChecker(host) {
5532155321
const constraint = getConstraintTypeFromMappedType(type);
5532255322
if (constraint.flags & 4194304 /* Index */) {
5532355323
const baseConstraint = getBaseConstraintOfType(constraint.type);
55324-
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
55324+
if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
5532555325
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
5532655326
}
5532755327
}
5532855328
}
5532955329
return type;
5533055330
}
55331+
function isArrayOrTupleOrIntersection(type) {
55332+
return !!(type.flags & 2097152 /* Intersection */) && every(type.types, isArrayOrTupleType);
55333+
}
5533155334
function isMappedTypeGenericIndexedAccess(type) {
5533255335
let objectType;
5533355336
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
@@ -59698,29 +59701,28 @@ function createTypeChecker(host) {
5969859701
if (typeVariable) {
5969959702
const mappedTypeVariable = instantiateType(typeVariable, mapper);
5970059703
if (typeVariable !== mappedTypeVariable) {
59701-
return mapTypeWithAlias(
59702-
getReducedType(mappedTypeVariable),
59703-
(t) => {
59704-
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
59705-
if (!type.declaration.nameType) {
59706-
let constraint;
59707-
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
59708-
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
59709-
}
59710-
if (isTupleType(t)) {
59711-
return instantiateMappedTupleType(t, type, typeVariable, mapper);
59712-
}
59713-
}
59714-
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
59715-
}
59716-
return t;
59717-
},
59718-
aliasSymbol,
59719-
aliasTypeArguments
59720-
);
59704+
return mapTypeWithAlias(getReducedType(mappedTypeVariable), instantiateConstituent, aliasSymbol, aliasTypeArguments);
5972159705
}
5972259706
}
5972359707
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
59708+
function instantiateConstituent(t) {
59709+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
59710+
if (!type.declaration.nameType) {
59711+
let constraint;
59712+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
59713+
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
59714+
}
59715+
if (isTupleType(t)) {
59716+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
59717+
}
59718+
if (isArrayOrTupleOrIntersection(t)) {
59719+
return getIntersectionType(map(t.types, instantiateConstituent));
59720+
}
59721+
}
59722+
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
59723+
}
59724+
return t;
59725+
}
5972459726
}
5972559727
function getModifiedReadonlyState(state, modifiers) {
5972659728
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;

lib/tsserver.js

+23-21
Original file line numberDiff line numberDiff line change
@@ -60065,13 +60065,16 @@ function createTypeChecker(host) {
6006560065
const constraint = getConstraintTypeFromMappedType(type);
6006660066
if (constraint.flags & 4194304 /* Index */) {
6006760067
const baseConstraint = getBaseConstraintOfType(constraint.type);
60068-
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
60068+
if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
6006960069
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
6007060070
}
6007160071
}
6007260072
}
6007360073
return type;
6007460074
}
60075+
function isArrayOrTupleOrIntersection(type) {
60076+
return !!(type.flags & 2097152 /* Intersection */) && every(type.types, isArrayOrTupleType);
60077+
}
6007560078
function isMappedTypeGenericIndexedAccess(type) {
6007660079
let objectType;
6007760080
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
@@ -64442,29 +64445,28 @@ function createTypeChecker(host) {
6444264445
if (typeVariable) {
6444364446
const mappedTypeVariable = instantiateType(typeVariable, mapper);
6444464447
if (typeVariable !== mappedTypeVariable) {
64445-
return mapTypeWithAlias(
64446-
getReducedType(mappedTypeVariable),
64447-
(t) => {
64448-
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
64449-
if (!type.declaration.nameType) {
64450-
let constraint;
64451-
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
64452-
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
64453-
}
64454-
if (isTupleType(t)) {
64455-
return instantiateMappedTupleType(t, type, typeVariable, mapper);
64456-
}
64457-
}
64458-
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
64459-
}
64460-
return t;
64461-
},
64462-
aliasSymbol,
64463-
aliasTypeArguments
64464-
);
64448+
return mapTypeWithAlias(getReducedType(mappedTypeVariable), instantiateConstituent, aliasSymbol, aliasTypeArguments);
6446564449
}
6446664450
}
6446764451
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
64452+
function instantiateConstituent(t) {
64453+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
64454+
if (!type.declaration.nameType) {
64455+
let constraint;
64456+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
64457+
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
64458+
}
64459+
if (isTupleType(t)) {
64460+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
64461+
}
64462+
if (isArrayOrTupleOrIntersection(t)) {
64463+
return getIntersectionType(map(t.types, instantiateConstituent));
64464+
}
64465+
}
64466+
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
64467+
}
64468+
return t;
64469+
}
6446864470
}
6446964471
function getModifiedReadonlyState(state, modifiers) {
6447064472
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;

lib/typescript.js

+23-21
Original file line numberDiff line numberDiff line change
@@ -57820,13 +57820,16 @@ ${lanes.join("\n")}
5782057820
const constraint = getConstraintTypeFromMappedType(type);
5782157821
if (constraint.flags & 4194304 /* Index */) {
5782257822
const baseConstraint = getBaseConstraintOfType(constraint.type);
57823-
if (baseConstraint && everyType(baseConstraint, isArrayOrTupleType)) {
57823+
if (baseConstraint && everyType(baseConstraint, (t) => isArrayOrTupleType(t) || isArrayOrTupleOrIntersection(t))) {
5782457824
return instantiateType(target, prependTypeMapping(typeVariable, baseConstraint, type.mapper));
5782557825
}
5782657826
}
5782757827
}
5782857828
return type;
5782957829
}
57830+
function isArrayOrTupleOrIntersection(type) {
57831+
return !!(type.flags & 2097152 /* Intersection */) && every(type.types, isArrayOrTupleType);
57832+
}
5783057833
function isMappedTypeGenericIndexedAccess(type) {
5783157834
let objectType;
5783257835
return !!(type.flags & 8388608 /* IndexedAccess */ && getObjectFlags(objectType = type.objectType) & 32 /* Mapped */ && !isGenericMappedType(objectType) && isGenericIndexType(type.indexType) && !(getMappedTypeModifiers(objectType) & 8 /* ExcludeOptional */) && !objectType.declaration.nameType);
@@ -62197,29 +62200,28 @@ ${lanes.join("\n")}
6219762200
if (typeVariable) {
6219862201
const mappedTypeVariable = instantiateType(typeVariable, mapper);
6219962202
if (typeVariable !== mappedTypeVariable) {
62200-
return mapTypeWithAlias(
62201-
getReducedType(mappedTypeVariable),
62202-
(t) => {
62203-
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
62204-
if (!type.declaration.nameType) {
62205-
let constraint;
62206-
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
62207-
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
62208-
}
62209-
if (isTupleType(t)) {
62210-
return instantiateMappedTupleType(t, type, typeVariable, mapper);
62211-
}
62212-
}
62213-
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
62214-
}
62215-
return t;
62216-
},
62217-
aliasSymbol,
62218-
aliasTypeArguments
62219-
);
62203+
return mapTypeWithAlias(getReducedType(mappedTypeVariable), instantiateConstituent, aliasSymbol, aliasTypeArguments);
6222062204
}
6222162205
}
6222262206
return instantiateType(getConstraintTypeFromMappedType(type), mapper) === wildcardType ? wildcardType : instantiateAnonymousType(type, mapper, aliasSymbol, aliasTypeArguments);
62207+
function instantiateConstituent(t) {
62208+
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
62209+
if (!type.declaration.nameType) {
62210+
let constraint;
62211+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, isArrayOrTupleType)) {
62212+
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
62213+
}
62214+
if (isTupleType(t)) {
62215+
return instantiateMappedTupleType(t, type, typeVariable, mapper);
62216+
}
62217+
if (isArrayOrTupleOrIntersection(t)) {
62218+
return getIntersectionType(map(t.types, instantiateConstituent));
62219+
}
62220+
}
62221+
return instantiateAnonymousType(type, prependTypeMapping(typeVariable, t, mapper));
62222+
}
62223+
return t;
62224+
}
6222362225
}
6222462226
function getModifiedReadonlyState(state, modifiers) {
6222562227
return modifiers & 1 /* IncludeReadonly */ ? true : modifiers & 2 /* ExcludeReadonly */ ? false : state;

0 commit comments

Comments
 (0)