ITADN

Unsafe return type of `sample`-function

#1614Closedtorgesla 创建于 2026-02-11
T
torgeslacommented
The return-type of the `sample`-function is incorrect for the edge case of an empty collection. ```ts import { sample } from "es-toolkit/array" function foo(input: string[]){ return sample(input) } const result: string = foo([]) // => undefined ```
关闭于 2026-03-02 1 条评论