Skip to content

Commit

Permalink
Ensure check works when constraint is a union of arrayish types, just…
Browse files Browse the repository at this point in the history
… like in `Promise.all`.
  • Loading branch information
DanielRosenwasser authored Oct 5, 2021
1 parent d8844a7 commit eebb1d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16516,7 +16516,7 @@ namespace ts {
if (t.flags & (TypeFlags.AnyOrUnknown | TypeFlags.InstantiableNonPrimitive | TypeFlags.Object | TypeFlags.Intersection) && t !== wildcardType && !isErrorType(t)) {
if (!type.declaration.nameType) {
let constraint;
if (isArrayType(t) || (t.flags & TypeFlags.Any) && (constraint = getConstraintOfTypeParameter(typeVariable)) && (isArrayType(constraint) || isTupleType(constraint))) {
if (isArrayType(t) || (t.flags & TypeFlags.Any) && (constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, or(isArrayType, isTupleType))) {
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
}
if (isGenericTupleType(t)) {
Expand Down

0 comments on commit eebb1d4

Please sign in to comment.