我想在打字稿中使用解构,示例代码:
var {first, second} = { first: "one", second: "two" }
console.log(first);
我的编译命令tsc --t es5 destructuring.ts
,
打字稿版本1.6.2
,
IDE 是vs code
.
然后导致三个错误:
destructuring.ts(1,5): error TS1008: Unexpectedtoken; 'identifier' expected.
destructuring.ts(1,21): error TS1008: Unexpected token; 'module, class, interface, enum, import or statement' expected.
destructuring.ts(1,45): error TS1005: ';' expected.
;
在我的桌面(窗口 8.1 x64)中,命令npm -g list
、显示typescript@1.6.2
和命令 tsc --version
显示Version 1.0.3.0
:
但在我的笔记本电脑(Windows 7 x64)中,命令tsc --version
显示message TS6029: Version 1.6.2
: