跳过导航
I STILL get so many folks misunderstanding the difference between:
0:00 / 3:54

I STILL get so many folks misunderstanding the difference between:

Matt Pocock

@mattpocockuk25万 位关注者

在 X 上查看
608 个赞下载原帖

32,246 次观看

I STILL get so many folks misunderstanding the difference between: Pick, Omit Exclude, Extract They should be called: PickFromObject, OmitFromObject ExcludeFromUnion, ExtractFromUnion Here's a breakdown:

10 条评论

评论来自 X (Twitter) 上的原帖

  • Matt Pocock 的头像

    @mattpocockuk

    Here's my course - it's 30% off right now

    3 个赞

  • Théo LUDWIG 的头像

    @theoludwig_

    I always end up copy/pasting the stricter version in my projects and never use the original one: export type OmitStrict<T, K extends keyof T> = Omit<T, K> export type PickStrict<T, K extends keyof T> = Pick<T, K>

    3 个赞

  • Matt Pocock 的头像

    @mattpocockuk

    Pick is already strict, FYI

    4 个赞

  • Shelton Louis 的头像

    @SheltonLouisX

    You're right!

    2 个赞

  • onurhan 的头像

    @Onurhan1337

    I can recommend an interactive article about difference between Pick and Omit

    2 个赞

  • Jacky Hu 的头像

    @ChiahauHu

    🙋‍♂️ type Album = { // ... artist: string // ... } what's diff between 1. Pick<Album, 'artist'> 2. Album['artist'] thanks 🙏

    1 个赞

  • Matt Pocock 的头像

    @mattpocockuk

    type Album = { artist: string }; Album['artist']; // string Pick<Album, 'artist'>; // { artist: string }

    6 个赞

  • marc niclas 的头像

    @niclas_hermann

    Nah mate, too many characters

    1 个赞

  • Matt Pocock 的头像

    @mattpocockuk

    It's only me in the video

    11 个赞

  • Suumiboor 的头像

    @suumiboor

    It's a weird multi-level almost set-like thing that syntax... would love to see something cleaner, at least that's my current understanding.