sindresorhus/type-fest

`EmptyArray` type

开放

#929 创建于 2024年8月6日

 (2 条评论) (0 个反应) (0 位负责人)TypeScript (471 个派生)batch import
help wantedtype addition

仓库指标

星标
 (12,328 个星标)
PR 合并指标
 (平均合并 3天 5小时) (30 天内合并 11 个 PR)

描述

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

贡献者指南