sindresorhus/type-fest

`EmptyArray` type

Open

#929 geöffnet am 6. Aug. 2024

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (12.328 Stars) (471 Forks)batch import
help wantedtype addition

Beschreibung

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