V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
cs3230524
V2EX  ›  Node.js

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

  •  
  •   cs3230524 · Mar 5, 2020 · 5083 views
    This topic created in 2254 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   ·   5998 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 57ms · UTC 03:25 · PVG 11:25 · LAX 20:25 · JFK 23:25
    ♥ Do have faith in what you're doing.