跳过导航
In TypeScript, interfaces and types are often interchangeable.
0:00 / 1:19

In TypeScript, interfaces and types are often interchangeable.

Cory House

@housecor16万 位关注者

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

56,144 次观看

In TypeScript, interfaces and types are often interchangeable. But these are 6 features that only work with a type alias. Clip from "TypeScript: Getting Started" on Dometrain

10 条评论

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

  • Cory House 的头像

    @housecor

    Full course with a 20% discount:

    6 个赞

  • Tymek Zapała 的头像

    @tymzap

    Types are great. I do not see any reason to use interfaces - they have less use cases and brings risk of accidental declaration merging to codebase.

    4 个赞

  • Ryu 的头像

    @rmiyazaki3

    Seriously most of what I know about typescript I learned from you and @mattpocockuk

    3 个赞

  • Cory House 的头像

    @housecor

    @mattpocockuk Thanks! And yep Matt is a fantastic teacher

    2 个赞

  • tom byrer 的头像

    @tombyrer

    The thing I hate about TS is that is lots of programming time that is not programming that significantly moves the needle forward. I hope @typescript team will add auto-typing in Phase 3 of their GoLang transition, or some AI wiz makes a small locally hostable model to do this.

    2 个赞

  • Cory House 的头像

    @housecor

    @typescript I find adding types takes little time and tends to “flow” through the code once I’ve delivered the type once. Often mainly need types for the json fetched from APIs

    3 个赞

  • ℤ 的头像

    @technically_zac

    1:19 seconds of 🔥🔥🔥

    1 个赞

  • Cory House 的头像

    @housecor

    Thanks!

    1 个赞

  • Friedrich 的头像

    @FriedrichC109

    That's why I only use types. There is also interfaces merging that can be misleading

    1 个赞

  • Juan Roa 的头像

    @jroadev

    Great tips for such commons workarounds while working with TS!

    1 个赞