Microsoft/TypeScript
Vedi su GitHubError type on spreading array with additional props
Open
#59.849 aperta il 4 set 2024
BugDomain: IntersectionHelp Wanted
Metriche repository
- Star
- (48.455 star)
- Metriche merge PR
- (Merge medio 6g 17h) (9 PR mergiate in 30 g)
Descrizione
🔎 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
@Andarist mentioned this could be related to https://github.com/microsoft/TypeScript/issues/59260