X 归档 2024-01-24
Here's a potential API that could make Array.filter properly infer types in TypeScript.
We create a unique symbol called REMOVE, which we use to indicate when an element should be removed.
We create a unique symbol called REMOVE, which we use to indicate when an element should be removed.
这里有一个潜在的 API,可以让 Array.filter 在 TypeScript 中正确推断类型。
我们创建一个名为 REMOVE 的 unique symbol,用它来标记某个元素应当被移除。
我们创建一个名为 REMOVE 的 unique symbol,用它来标记某个元素应当被移除。

