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 ドキュメント:
- http://wiki.ecmascript.org/doku.php?id=harmony:typed_objects
- https://github.com/dslomov/typed-objects-es7
これは以前の質問の編集です。