sindresorhus/type-fest

`EmptyArray` type

Open

#929 opened on Aug 6, 2024

View on GitHub
 (2 comments) (0 reactions) (0 assignees)TypeScript (471 forks)batch import
help wantedtype addition

Repository metrics

Stars
 (12,328 stars)
PR merge metrics
 (Avg merge 3d 5h) (11 merged PRs in 30d)

Description

There is EmptyObject, and I think a EmptyArray type for a strictly empty array would be useful.

One use case of empty array with React to avoid re-renders because of unstable default prop:

const defaultArr = [];
const Component = ({arr = defaultArr}) => arr.join(",");

Contributor guide