sindresorhus/type-fest

`EmptyArray` type

開放

#929 建立於 2024年8月6日

 (2 則留言) (0 個反應) (0 位負責人)TypeScript (471 個分叉)batch import
help wantedtype addition

倉庫指標

星標
 (12,328 顆星)
PR 合併指標
 (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(",");

貢獻者指南