-
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
Reactions are currently unavailable
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