Hey Wes, when are you releasing your TypeScript course?
@WesBos
Жыл бұрын
Pretty soon!
@tieTYT
Жыл бұрын
This is a great description. Thank you for keeping it simple, and I want to compliment you on explaining the problem that this keyword solves before showing what it does. A lot of tutorials do it the other way around and it's difficult to know what details are worth paying attention to until you get to the end.
@lucas_sg
Жыл бұрын
I'm already getting that validation with ESLint on VSCode without using `satisfies`
@WesBos
Жыл бұрын
Sorry the error that pops up is eslint, but that’s not what I’m referring to - there is a TS error there too
@alext5497
Жыл бұрын
@@WesBos I don't mind this but doesn't an interface do this but better
@WesBos
Жыл бұрын
@@alext5497 I don’t think so - show me?
@pupfriend
Жыл бұрын
Question, how is this different than doing 'as Settings' or 'as unknown as Settings'?
@darkarie
Жыл бұрын
using as tells typescript that thr type is settings, satifies checks if that is really the type and gives you the error if not
@pupfriend
Жыл бұрын
@@darkarie makes sense, thanks
@Thorax232
Жыл бұрын
oooo, you dropped the word "overlap". "Does it overlap enough?" Even your hand gestures suggest you're thinking of types as "sets" and "unions." Now I'm excited to see the TS course.
@cas818028
Жыл бұрын
What this diff between as and satisfies?
@nomadshiba
Жыл бұрын
`as` changes types of stuff has no similarities. `satisfies` doesnt change the type, it just throws error if it doesnt satisfy the type. they are not similar `satisfies` is similar to, `as const` but with type checking before `satisfies` we had to do something like this function settings(value: T): T { return value } const mySettings = settings({ // ... })
@kalyankumar9663
Жыл бұрын
What is this VSCODE EXTENSION?
@WesBos
Жыл бұрын
Doing which?
@kalyankumar9663
Жыл бұрын
I mean your VS Code theme?
@ebrahimedriss6454
Жыл бұрын
8 Bones
@tieTYT
Жыл бұрын
Question: should this keyword be considered superior and a replacement to defining a type on the left hand side?
@AdrianBrowning
Жыл бұрын
This has finally made satisfies make sense! Thank you!
@LukendoKibubi-iz4ct
Жыл бұрын
Good luck
@GJCORTEZ123-wc5qq
3 ай бұрын
8853irs
@yadusolparterre
Жыл бұрын
Nope, still don't get it. You say "it's okay", but I guess you mean "it's NOT okay"? You say we can "ask" TS, but I guess you mean "tell"? Nah, I don't get it.
@WesBos
Жыл бұрын
Ask and tell are actually different things in typescript. Here we are asking if it works with the type. An assertion is telling typescript - and that’s generally not as type safe
@yadusolparterre
Жыл бұрын
@@WesBos so you are asking ts... And how does ts answer?
@WesBos
Жыл бұрын
@@yadusolparterre it either says “yes this data matches the type you like” or “sorry this data doesn’t match the type you asked. You did something wrong!”
@yadusolparterre
Жыл бұрын
@@WesBos where? The console?
@KenBellows
Жыл бұрын
@@yadusolparterre it says “no” with a TypeScript error or “yes” by not erroring
@nomadshiba
Жыл бұрын
before `satisfies` we had to do something like this function settings(value: T): T { return value } const mySettings = settings({ // ... })
@trappedcat3615
Жыл бұрын
Are we witnessing the end of interface types?
@WesBos
Жыл бұрын
nope - I used Type here because you can't alias with an interface
Пікірлер: 31