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
In the current implementation of enums we had to introduce some limitations and workarounds, the first one is that instead of using actual enum classes we use normal classes with static final members, then we introduced two annotations TsTypeDef and TsTypeRef and we use those to create type Aliases and assume that all the static final members will exported with the defined type alias, example :
Branded types could also be useful for decorating something that can't just be structurally typed - adding a @TsBranded or the like could signify that any class/interface declared should be already unioned with a unique symbol.
In the current implementation of enums we had to introduce some limitations and workarounds, the first one is that instead of using actual enum classes we use normal classes with static final members, then we introduced two annotations
TsTypeDef
andTsTypeRef
and we use those to create type Aliases and assume that all the static final members will exported with the defined type alias, example :Simulate an enum with constant values :
Which will be exported as
The the enum clients will use it like this
which will be exported like this
The plan with the new Branded types pattern is to introduce a better typing for this, for example
this enum
can be exported to typescript like this
The type definition for this could be something like this :
The text was updated successfully, but these errors were encountered: