error TS2583: Cannot find name ‘WeakMap’. Do you need to change your target library? Try changing the lib
compiler option to es2015 or later.
problem
test.ts中包含使用 WeakMap,
执行tsc test.ts 时报错:
error TS2583: Cannot find name 'WeakMap'. Do you need to change your target library? Try changing the `lib` compiler option to es2015 or later.
reason
原因是 WeakMap 是 es6 的语法
solution
在命令行显示加上 lib
tsc --lib "es2015","dom" test.ts