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

贡献者指南