Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types-vs-interfaces-in-typescript #28

Open
utterances-bot opened this issue Jan 27, 2023 · 3 comments
Open

types-vs-interfaces-in-typescript #28

utterances-bot opened this issue Jan 27, 2023 · 3 comments

Comments

@utterances-bot
Copy link

Types vs Interfaces in TypeScript | Edvins Antonovs

Learn key differences between types and interfaces in TypeScript

https://edvins.io/types-vs-interfaces-in-typescript

Copy link

Interesting! So can Interface can only be used for objects, but Type cannot be used for objects?

Copy link
Owner

@Chektinchan I've spent some time learning more on a topic and I think the ts documentation nails my whole blog post in 2 senteces.

Type aliases and interfaces are very similar, and in many cases you can choose between them freely. Almost all features of an interface are available in type, the key distinction is that a type cannot be re-opened to add new properties vs an interface which is always extendable.

Copy link

avg206 commented Feb 3, 2023

@ummahusla And even though you can always use ‘&’ sign to extend a type with new properties :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants