sindresorhus/type-fest

`EmptyArray` type

Open

#929 建立於 2024年8月6日

在 GitHub 查看
 (2 留言) (0 反應) (0 負責人)TypeScript (12,328 star) (471 fork)batch import
help wantedtype addition

描述

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(",");

貢獻者指南