how TypeScript 5.5 makes safer types in fewer keystrokes

Поделиться
HTML-код
  • Опубликовано: 21 июн 2024
  • TS 5.5 Announcment: devblogs.microsoft.com/typesc...
    My Links
    shaky.sh
    shaky.sh/tools
    #programming #coding #typescript #javascript
    #frontenddeveloper #backenddeveloper #softwareengineer #softwareengineering #softwaredevelopment
  • НаукаНаука

Комментарии • 11

  • @keyserj
    @keyserj 16 дней назад +1

    Ooh this is quite nice to have indeed! I recently subscribed to the TypeScript devblogs, but I found myself not spending the time to read those... so I particularly appreciate the summary of the features you find useful. Cheers

  • @astrotoolau
    @astrotoolau 17 дней назад +2

    This is amazing! I wasn't expecting all that from v5.5, just one would have sufficed lol
    Thanks for keeping us updated :)

  • @flygonfiasco9751
    @flygonfiasco9751 16 дней назад

    Fick Giving that predicate narrowing is such a blessing, that’s bitten me like 3 different times over the past year.

  • @xelspeth
    @xelspeth 14 дней назад +1

    I'm pretty sure obj[key] is not inferred because obj[key] can change after a call even of obj and key stay the same

    • @andrew-burgess
      @andrew-burgess  13 дней назад

      Hmm, how do you mean? Wouldn't that mean this new behavior can introduce bugs?

    • @xelspeth
      @xelspeth 13 дней назад

      @@andrew-burgess in a simple if(typeof === string) it can't (unless you use getters in which case normal variables could change, too [look up a == 1 && a == 2 && a == 3])
      But f.ex.
      if(obj[key] === 'hello') {await someLongCall(); console.log(obj[key])} could change in another function but I believe they caught that with the current implementation

  • @user-vd3ph6zh8q
    @user-vd3ph6zh8q 12 дней назад

    Anybody ever told you, you look like Toby Maguire? Lol

  • @AlexanderYaremchuk
    @AlexanderYaremchuk 11 дней назад

    !== null doesn't work to infer out undefined it only infers out nulls.
    last version works fine: typeof n === 'number'

    • @andrew-burgess
      @andrew-burgess  11 дней назад

      Ah yep, I was specifically doing !=, which coerces undefined to null. But yeah, the typeof way is best for this one.

  • @ash1kh
    @ash1kh 9 дней назад

    I think I will wait for typescript 9.0 when I don't have to type anything and it will be type safe. 😂😂😂😂 Telepathy compiler.