1

为 ES2016 提出的类型化对象可以用于约束参数的 API 吗?

例如:

function foo(options){
  // I want to guarantee that `options` has a single string property `bar`.
  // Can typed objects help me with this?
}

ECMA 文档:

这是对较早问题的编辑。

4

0 回答 0