-
-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Arrayable
type #270
#935
Conversation
@sindresorhus why was |
@fregante import { Arrayable } from 'type-fest';
type Primitive =
| bigint
| boolean
| null
| number
| string
| symbol
| undefined;
function castArray<Item extends Primitive | Record<PropertyKey, unknown>>(value: Arrayable<Item>): Item[] {
return Array.isArray(value) ? value : [value];
} |
My previous code worked correctly if In your case, it doesn't even support regular class instances, like |
fix #270