-
Notifications
You must be signed in to change notification settings - Fork 14
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
Nested unions are "untagged" #61
Comments
This change appears to fix it, but I'm probably breaking some other behaviour. Not sure what exactly because it seems there isn't a test for it. export declare type Creators<Record, TaggedRecord, TagProp extends string> = {
- [T in keyof Record]: {} extends Required<UnTagged<Record[T], TagProp>>
+ [T in keyof Record]: {} extends Required<Record[T]>
? ((value?: {}) => TaggedRecord[keyof TaggedRecord])
- : ((value: UnTagged<Record[T], TagProp>) => TaggedRecord[keyof TaggedRecord])
+ : ((value: Record[T]) => TaggedRecord[keyof TaggedRecord]) // error :-)
Action.Nested(wrong);
// no error :-)
Action.Nested(NestedAction.Foo({})); Related:
|
It seems https://github.com/pelotom/unionize/pull/36/files#diff-6b623d6bcf5e7f06c466aa060ec9c4b6R94 However this test was removed recently for some reason: 87456d3 Furthermore, I just tried to revive the test and it seems to be throwing a type error. So, where does this leave us with the issue I described originally? Either:
@pelotom WDYT? |
I honestly cannot remember what |
I just ran into this bug which resulted in a runtime exception. 😢
One known workaround is to force the nested union tag to be different:
However that's a non-option when modelling Redux actions, since the tag must be
type
to conform to the usual Redux action type.The text was updated successfully, but these errors were encountered: