TypeScript Got a New Utility Type

Ғылым және технология

I like what the TypeScript team is doing. These updates are to the point, nicely communicated with their blog, and serve a purpose.
TypeScript Playground (select "nightly" for the 5.4): www.typescriptlang.org/play
Great blog article: devblogs.microsoft.com/typesc...
-- my links
Newsletter: www.joshtriedcoding.com/
Discord: / discord
GitHub: github.com/joschan21

Пікірлер: 43

  • @SoreBrain
    @SoreBrain3 ай бұрын

    That little bit of excalidraw really helped to make the point clear.

  • @JohnWasinger

    @JohnWasinger

    3 ай бұрын

    kzread.info/dash/bejne/haB_rLFyYcW6es4.htmlsi=sARuxpmK_2S0qe2v

  • @hyperprotagonist
    @hyperprotagonist3 ай бұрын

    Hello Matt Pocock if he was 30 years younger with hair 👋

  • @user-pq8zg6rx8c

    @user-pq8zg6rx8c

    3 ай бұрын

    Lol he’s not that old😅

  • @hyperprotagonist

    @hyperprotagonist

    3 ай бұрын

    @@user-pq8zg6rx8cI know, but it puts more emphasis on Josh’s baby face.

  • @ludwignagelhus524

    @ludwignagelhus524

    3 ай бұрын

    I think the emphasis falls on Pocock's lack of hair lol

  • @avid459

    @avid459

    3 ай бұрын

    Matt is an old Typescript emperor from the far away , strange, cold and dark English speaking lands, whereas this teenager is our new eastern European local legend. Will he oust the old emperor whose tyranny of not being in support of '.ts' file extension imports is well known or will he join hands with the old emperor. only time will tell.

  • @akam9919

    @akam9919

    2 ай бұрын

    @@hyperprotagonist So...two kills one roast?

  • @juanferrer5885
    @juanferrer58853 ай бұрын

    function configureDevice( allowOs: OS[], defaultOs?: OSDefault ) { //... } this works also great video Josh!

  • @dealloc

    @dealloc

    3 ай бұрын

    Yes that's the "old" way of getting around it. But NoInfer makes it possible without having to deal with additional generics for bookkeeping.

  • @5omebody

    @5omebody

    3 ай бұрын

    @@dealloc note also that previously NoInfer was possible using a user-defined type (and worked in almost all cases): type NoInfer = [T][T extends T ? 0 : never] (it hides the type behind a conditional type, which TS resolves after other inference)

  • @TalhaBalaj
    @TalhaBalaj3 ай бұрын

    love the quick explanations.

  • @FurryDanOriginal
    @FurryDanOriginal3 ай бұрын

    Great video! Very simple examples that showcase the original problem and how these features take care of them.

  • @marusdod3685
    @marusdod36853 ай бұрын

    fuck I really needed this. was pulling my hairs out a month ago because it was just not narrowing down the type

  • @ahammadalipk
    @ahammadalipk3 ай бұрын

    Great video first of all, out of curiosity, would like to know what tool is used for sketching?

  • @nicolasgomez5207

    @nicolasgomez5207

    3 ай бұрын

    Exacalidraw

  • @ahammadalipk

    @ahammadalipk

    3 ай бұрын

    @@nicolasgomez5207 thanks

  • @Fullflexno
    @Fullflexno3 ай бұрын

    Great video! Cool!

  • @fenix2598
    @fenix25983 ай бұрын

    Great Video

  • @riveto_ir
    @riveto_ir3 ай бұрын

    Josh you're not planning on celebrating 100k youtube followers? People kill to get there 🎉😊

  • @seroltech118
    @seroltech1183 ай бұрын

    Thank your for this video. But the second example is soooo complicated. A simple enum type would solve everything. Guys remember, you use Ts to simplify the reading of your code and avoid bugs ? Or to write ambiguous code ?

  • @catte_6376

    @catte_6376

    3 ай бұрын

    no, an enum wouldn't solve anything because the whole point is that the type ("OS") is provided by the user (because the function is generic). the user can obviously then choose to prevent this "ambiguity" through an enum/union by providing the type parameter rather than inferring it, which, for this simple example, is rather inconvenient: ```configureDevice(...)```

  • @nullbeyondo

    @nullbeyondo

    3 ай бұрын

    It is actually very simple if you continued watching and didn't pause the moment you saw "configureDevice" lol. The problem lies in peple thinking it is outside their domain but he was only trying to give a real world example that'd make sense rather than A, B, C, and whatever. And while I could agree a generic example would be certainly simpler, it wouldn't answer the question "Well, what's the point of it?!"; so a real example was needed to open our eyes more into how useful it could be.

  • @akam9919
    @akam99192 ай бұрын

    For those wondering how to get around the bug with NoInfer in the latest version, here is an alternative that does basically the same thing. type NoInfer=[T][T extends any? 0:never]

  • @thekwoka4707
    @thekwoka47073 ай бұрын

    Return a Rounded number, okay well return a number string with 2 decimal points Uh....

  • @jordan9506
    @jordan95063 ай бұрын

    Insta like!

  • @thecodermehedi
    @thecodermehedi3 ай бұрын

    4th view 💪🏻

  • @jatiquep5543

    @jatiquep5543

    3 ай бұрын

    825th view😂

  • @soheilweb
    @soheilweb3 ай бұрын

    First View😅

  • @greendsnow
    @greendsnow3 ай бұрын

    TS is getting more and more complicated. is Dart this complicated? I don't think so.

  • @user-fr2fm3ri3w

    @user-fr2fm3ri3w

    3 ай бұрын

    I know it will sound crazy but nobody’s forcing you to use these features.

  • @bs8028
    @bs80283 ай бұрын

    We don’t need typescript

  • @BayarjavkhlanBatgerel

    @BayarjavkhlanBatgerel

    3 ай бұрын

    only you dont need ts

  • @MichaelChanCY

    @MichaelChanCY

    3 ай бұрын

    You don’t need to use TS if you don’t need it, but nobody is interested in what you need.

  • @bs8028

    @bs8028

    3 ай бұрын

    Give me one thing you can’t do without ts

  • @CrAzZyKiLleR01

    @CrAzZyKiLleR01

    3 ай бұрын

    ​@@bs8028oh wow really? you have to learn a lot...

  • @retrosynthguy

    @retrosynthguy

    3 ай бұрын

    ​@@bs8028 make an application more legible and easy to maintain lol

Келесі