How to NoInfer (new TS 5.4 Feature)

Поділитися
Вставка
  • Опубліковано 11 вер 2024
  • TypeScript 5.4 has a new feature to give you more control over how type inference works. Let's check it out!
    My Links
    shaky.sh
    shaky.sh/tools
    #programming #coding #typescript #noinfer #typeinference
    #frontenddeveloper #backenddeveloper #softwareengineer #softwareengineering #softwaredevelopment

КОМЕНТАРІ • 21

  • @andrew-burgess
    @andrew-burgess  Місяць тому

    BTW, here's the code from the last (best, imho) example in the video! Thanks for watching! shaky.sh/pastes/typescript-noinfer/

  • @alexjohnson-bassworship3150
    @alexjohnson-bassworship3150 2 місяці тому +9

    Best NoInfer explanation on UA-cam to date!! Love all your videos, Andrew! Keep 'em coming...

  • @ralacerda12
    @ralacerda12 Місяць тому +2

    What a GREAT lesson. I definitely faced those problems before at work, I'll probably sent it to others tomorrow

  • @elhamzeinodini4828
    @elhamzeinodini4828 Місяць тому

    Best TS channel ever❤

  • @i.j.5513
    @i.j.5513 2 місяці тому +3

    Very nicely explained !👍

  • @offroaders123
    @offroaders123 2 місяці тому

    This video is great! So glad to have this feature in TS now 🔥

  • @hugodsa89
    @hugodsa89 2 місяці тому

    I remember when you started your typescript structural metaprogramming journey. You’ve come far mate. Though I’d probably want a tuple return to maintain order and not have an array with multiple elements of the same string value.
    export namespace Union {
    export type ToIntersection = (
    U extends never ? never : (arg: U) => never
    ) extends (arg: infer I) => void
    ? I
    : never;
    export type ToTuple = Union.ToIntersection<
    T extends never ? never : (t: T) => T
    > extends (_: never) => infer W
    ? [...Union.ToTuple, W]
    : [];
    }

  • @jancijak9385
    @jancijak9385 Місяць тому

    I would follow this video with how to add the NoInfer type as an excluded, not recommended keyword in lint Sonar.

  • @rockNbrain
    @rockNbrain 2 місяці тому

    Great job dude ! 🎉

  • @artyomtaranenko2267
    @artyomtaranenko2267 2 місяці тому

    Need more content with TS

  • @vim55k
    @vim55k Місяць тому

    Great

  • @mettle_x
    @mettle_x 2 місяці тому

    Side note: ma man looks good with the beard.

  • @mme725
    @mme725 Місяць тому

    2:00 ... What if you NoInfer both a and b? What does the linter say then?

  • @MrJ3
    @MrJ3 2 місяці тому

    Very cool!

  • @user-de8ev2bn2d
    @user-de8ev2bn2d 2 місяці тому

    before NoInfer, must know when infer. When?

  • @yazaldefilimone
    @yazaldefilimone 2 місяці тому

    ohhh your fonts is so cool 🥺...what's?

  • @capybara0612
    @capybara0612 Місяць тому

    Shouldn't this be the default?

  • @mahadevovnl
    @mahadevovnl 2 місяці тому +1

    That createMenu function makes absolutely no sense, code wise. It doesn't even create a menu. Why would you ever want to construct anything like that, that way?
    Examples work best with real-life bits of code. This is just confusing because I'm constantly wondering "who would ever write bad code like this?" even if it kinda explains the NoInfer thing :)