-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed as not planned
Labels
Not a DefectThis behavior is one of several equally-correct optionsThis behavior is one of several equally-correct options
Description
Bug Report
π Search Terms
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
β― Playground Link
Playground link with relevant code
π» Code
Considering the following code:
type TypeWithoutTuple<T> = [T, Partial<T>];
type TypeWithTuple<T> = T | [T, Partial<T>];
interface A {
a: number;
b: string;
}
class A { }
const funcNotUsingTupleType = <
T extends readonly unknown[]
>(...args: [...{ [K in keyof T]: TypeWithoutTuple<T[K]> }]) => { }
const funcUsingTupleType = <
T extends readonly unknown[]
>(...args: [...{ [K in keyof T]: TypeWithTuple<T[K]> }]) => { }
funcNotUsingTupleType([new A(), {}]) // infers the typying <[A]>(things_0: ThingNoTuple<A>) => void
funcUsingTupleType([new A(), {}]) // infers the typying <[{}]>(things_0: TypeWithTuple<{}>) => void
π Actual behavior
The same calls to funcNotUsingTupleType
and funcUsingTupleType
have different inferred typyings, even when they are evaluating the same thing.
π Expected behavior
The same calls to funcNotUsingTupleType
and funcUsingTupleType
to have the same inferred typyings.
Metadata
Metadata
Assignees
Labels
Not a DefectThis behavior is one of several equally-correct optionsThis behavior is one of several equally-correct options