6

ts 如何书写 console.log([...'hello'])?

 1 year ago
source link: https://www.v2ex.com/t/885211
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

V2EX  ›  TypeScript

ts 如何书写 console.log([...'hello'])?

  windzzm · 3 小时 55 分钟前 · 401 次点击

es6 可以正常支持,但是在 ts 中这样写会报错

第 1 条附言  ·  3 小时 23 分钟前

tsc 提示 error TS2461: Type '"hello"' is not an array type.
而 ts-node 命令可以正常运行

这是哪里的问题?

第 2 条附言  ·  2 小时 53 分钟前

IfDkQ0BG.gif

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK