cs3230524
V2EX  ›  Node.js

"for...of" 语句的左侧不能使用类型批注。ts(2483)

  •  
  •   cs3230524 · Mar 5, 2020 · 5139 views
    This topic created in 2289 days ago, the information mentioned may be changed or developed.
    我循环 map,不能指定数据类型?那咋玩儿
    2 replies    2020-03-05 12:37:45 +08:00
    vcfvct
        1
    vcfvct  
       Mar 5, 2020 via Android
    类型应该可以 infer 吧,不用指定
    coolcoffee
        2
    coolcoffee  
       Mar 5, 2020
    左侧类型是取决数组类型吧,提前声明好数组类型。或者在循环内部加一个临时变量去定义成自己想要的类型。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   886 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 20:55 · PVG 04:55 · LAX 13:55 · JFK 16:55
    ♥ Do have faith in what you're doing.