You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was hoping if there was a way to extends enums. Like in the example.
Use Cases
It would be really helpful for code reuse. And reduce errors.
I am not able to get this functionality, it would be really helpful if there exists a workaround for the same.
Search Terms
enums
Suggestion
I was hoping if there was a way to extends enums. Like in the example.
Use Cases
It would be really helpful for code reuse. And reduce errors.
I am not able to get this functionality, it would be really helpful if there exists a workaround for the same.
Examples
http://www.typescriptlang.org/play/#src=enum%20someEnum%20%7B%0D%0A%20%20%20%20a%20%3D%20'Some%20String'%2C%0D%0A%20%20%20%20b%20%3D%202%2C%0D%0A%7D%3B%0D%0A%0D%0Aenum%20extendedEnum%20%7B%0D%0A%20%20%20%20c%20%3D%20'string'%2C%0D%0A%20%20%20%20b%20%3D%20someEnum.b%20%2F%2F%20Gives%20Error%0D%0A%7D%0D%0A%0D%0Atype%20someEnumType%3CT%20extends%20someEnum%3E%20%3D%20T%20extends%20someEnum.a%20%3F%20string%20%3A%0D%0A%20%20%20%20T%20extends%20someEnum.b%20%3F%20number%20%3A%20never%3B%0D%0A%0D%0Atype%20extendedEnumType%3CT%20extends%20extendedEnum%3E%20%3D%0D%0A%20%20%20%20T%20extends%20extendedEnum.c%20%3F%20string%3A%20%20%20%20%20%20%20%20%20%20%2F%2F%20Gives%20Error%0D%0A%20%20%20%20T%20extends%20extendedEnum.b%20%3F%20number%20%3A%20never%3B%20%20%2F%2F%20Gives%20Error
Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: