sindresorhus/type-fest

`EmptyArray` type

Offen

#929 geöffnet am 06.08.2024

 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)TypeScript (471 Forks)batch import
help wantedtype addition

Repository-Metriken

Stars
 (12.328 Sterne)
PR-Merge-Metriken
 (PR-Metriken ausstehend)

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