正在加载视频...

视频加载失败

🔥 Here's what the new TypeScript 4.9 `Satisfies` Operator is for

75,884 次观看 • 3 年前 •via X (Twitter)

10 条评论

Rachel Leggett 的头像
Rachel Leggett3 年前

Oooo interesting, I feel like this is the kind of thing I'll rarely need but it'll be a huge help the one time I need it

hillarious clinton 的头像
hillarious clinton3 年前

this is a great example

Evan! 的头像
Evan!3 年前

Seems similar to protocols in Swift where you can specify that a generic type must conform to some protocol using ‘where generic: protocol’

Ryan 的头像
Ryan3 年前

This is amazing!

Blessing Adesiji 的头像
Blessing Adesiji3 年前

Really nice video! But how do edit this video to show up like this?

A void 的头像
A void3 年前

The beauty of wes bos tutorial is he always uses the latest method to check the other latest method. Love your way of teaching

N J O N J O 的头像
N J O N J O3 年前

So now we are just going to ignore "as".

Wes Bos 的头像
Wes Bos3 年前

as will assert it into a type - you are telling typescript it's a type. satisfies will *ask* typescript if it satisfies the requirement - and typescript will tell you if it trust. as = trust me bro satisfies = could it be?

Nick Rempel 的头像
Nick Rempel3 年前

Helpful, thanks!

Wes Bos 的头像
Wes Bos3 年前

@_he110w0r1d I don't have any rules on it yet, but I can't see where you could abuse it - its helpful to cut down on type narrowing. We will see as I use it more

相关视频