-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: IntersectionIncorrect behavior under `T & U` constructsIncorrect behavior under `T & U` constructsHelp WantedYou can do thisYou can do this
Milestone
Description
π Search Terms
array intersection spread any
π Version & Regression Information
- This is the behavior in every version I tried
β― Playground Link
π» Code
type withExtraProps = extractArray<{ name: string } & string[]>;
// ^? any[]
type extractArray<t extends readonly unknown[]> = [...{ [i in keyof t]: t[i] }];π Actual behavior
Inferred as any[] due to an internal error type
π Expected behavior
Inferred as string[]
Additional information about the issue
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: IntersectionIncorrect behavior under `T & U` constructsIncorrect behavior under `T & U` constructsHelp WantedYou can do thisYou can do this