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.
@@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)
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 ?
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(...)```
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.
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]
That little bit of excalidraw really helped to make the point clear.
ruclips.net/video/SlKJO91bTJk/видео.htmlsi=sARuxpmK_2S0qe2v
Hello Matt Pocock if he was 30 years younger with hair 👋
Lol he’s not that old😅
@@АндрейЕвстратов-т3нI know, but it puts more emphasis on Josh’s baby face.
I think the emphasis falls on Pocock's lack of hair lol
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.
@@hyperprotagonist So...two kills one roast?
fuck I really needed this. was pulling my hairs out a month ago because it was just not narrowing down the type
function configureDevice(
allowOs: OS[],
defaultOs?: OSDefault
) {
//...
}
this works also
great video Josh!
Yes that's the "old" way of getting around it. But NoInfer makes it possible without having to deal with additional generics for bookkeeping.
@@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)
Great video first of all, out of curiosity, would like to know what tool is used for sketching?
Exacalidraw
@@nicolasgomez5207 thanks
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 ?
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(...)```
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.
Insta like!
4th view 💪🏻
825th view😂
We don’t need typescript
only you dont need ts
You don’t need to use TS if you don’t need it, but nobody is interested in what you need.
Give me one thing you can’t do without ts
@@bs8028oh wow really? you have to learn a lot...
@@bs8028 make an application more legible and easy to maintain lol
TS is getting more and more complicated. is Dart this complicated? I don't think so.
I know it will sound crazy but nobody’s forcing you to use these features.
Josh you're not planning on celebrating 100k youtube followers? People kill to get there 🎉😊
Return a Rounded number, okay well return a number string with 2 decimal points
Uh....
love the quick explanations.
Great video! Cool!
Great Video
Great video! Very simple examples that showcase the original problem and how these features take care of them.
First View😅
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]