sindresorhus/type-fest

`EmptyArray` type

Open

#929 opened on Aug 6, 2024

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

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