Open mradamczyk opened 6 years ago
@iamdanfox Has this proposal been considered?
:+1: think it looks sensible. Sadly we can't really do opt-in feature flags in this repo because this would allow API producers to ship compilation breaks in a minor release of their API.
The internal publish plugin uses the '301 versioning scheme' to mitigate this, so I think we'd just need to get this right first time and release a 4xx.
Agree that this would be very cool, although slight preference to not provide the of()
method - since this resolves to a noop at runtime it feels unnecessary. Users could just do the cast themselves.
+1 on this issue. We've seen serious bugs that this would have prevented.
Currently, even if a named type in Conjure is distinguishable from a string, a typescript declaration will just have
string
in place of the type. That can easily lead to problems where type A is used instead of type B (which wouldn't happen eg. with conjure generated java).I propose to generate stronger typed interfaces for named strings (aliases, rids, external objects with base-type string). The behavior might require to "opt-in" so that it won't cause a breaking change.
Example - Alias
could produce:
Example - Import
could produce:
With such declarations, we can get much stronger typings:
Moreover, I can imagine such extension for any primitive type, not only string.
I'd be happy to contribute if you think it makes sense.