variable: vs variable as 在打字稿中>>

问题描述 投票:0回答:1

我是打字稿新手,想知道: <type> vs xxx as <type>有什么不同?以及我该如何知道该在哪里使用?

let abc: any = {}
let abc = {} as any

我是打字稿新手,想知道:vs xxx as 有什么区别?我怎么知道在哪使用哪一个呢? let abc:any = {} let abc = {} as any

typescript typescript2.0 typescript1.8
1个回答
0
投票

第一个称为类型注释,第二个称为类型声明,在这种情况下,这些概念之间没有任何区别。

© www.soinside.com 2019 - 2024. All rights reserved.