sindresorhus/type-fest

`EmptyArray` type

Open

#929 ouverte le 6 août 2024

Voir sur GitHub
 (2 commentaires) (0 réactions) (0 assignés)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(",");

Guide contributeur