mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-17 12:19:32 -05:00
Fixed tuple types indexed by a type parameter (#51037)
* Fixed tuple types indexed by a type parameter * If only there was a tool to add that missing semicolon for me * Rename to baseConstraint Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
@@ -10090,8 +10090,9 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
// If the parent is a tuple type, the rest element has a tuple type of the
|
||||
// remaining tuple element types. Otherwise, the rest element has an array type with same
|
||||
// element type as the parent type.
|
||||
type = everyType(parentType, isTupleType) ?
|
||||
mapType(parentType, t => sliceTupleType(t as TupleTypeReference, index)) :
|
||||
const baseConstraint = getBaseConstraintOrType(parentType);
|
||||
type = everyType(baseConstraint, isTupleType) ?
|
||||
mapType(baseConstraint, t => sliceTupleType(t as TupleTypeReference, index)) :
|
||||
createArrayType(elementType);
|
||||
}
|
||||
else if (isArrayLikeType(parentType)) {
|
||||
|
||||
Reference in New Issue
Block a user