An Interest In:
Web News this Week
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
- April 13, 2024
- April 12, 2024
April 18, 2024 03:45 am GMT
Original Link: https://dev.to/oleygon/why-in-typescript-creating-an-enum-doesnt-need-a-but-creating-a-new-type-does-42fk
Why in Typescript creating an enum doesn't need a =, but creating a new type does?
To create a new enum
, the syntax is
enum Some { ...}
But to create a new type
, the syntax requires a =
:
type Some = { ...}
I wonder why this =
is needed?
I think it confuses type and value, and other languages are not like this.
For example, in C++, creating a struct
doesn't need a =
.
Original Link: https://dev.to/oleygon/why-in-typescript-creating-an-enum-doesnt-need-a-but-creating-a-new-type-does-42fk
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To