Jas*_* Yu 2 destructuring typescript
所以我在http://www.typescriptlang.org/play/上玩弄打字稿.发现我们实际上可以执行以下操作直接获取对象的属性/数组元素.
例:
function([first: int, second: int]): int{
return first + second;
}
function([first: any, person: {name: string}]): string{
return name;
}
Run Code Online (Sandbox Code Playgroud)
但是,我无法在网上找到有关这种"模式匹配"特征的任何地方.(我喜欢模式匹配;还有haskell.)
这个功能非常强大.我想知道他们在打字稿中叫什么.这样我就可以进一步阅读.
提前致谢.
| 归档时间: |
|
| 查看次数: |
1355 次 |
| 最近记录: |