-
Notifications
You must be signed in to change notification settings - Fork 201
Open
Description
The signature flatten<T, R>(target: T, ...): R leaves T unconstrained, so TypeScript lets you pass null | undefined. However, at runtime the function expects an object and crashes.
Reproduction: https://playcode.io/2592924
Ideally this is prevented at compile time, by constraining T:
export function flatten<T extends object, R = Record<string, unknown>>(
target: T,
options?: FlattenOptions
): R;
Related: #185
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels