Closed hayes closed 5 years ago
No worries, that's why I did a prerelease so I could run it through all our testing. Will you be able to fix or do I need to make time to look at it?
Still trying to fully understand the issue. I'll update in a few minutes when I have a better idea of how to fix it.
it looks like it may actually be related to strict unions
@kevin-greene-ck I think the solution is that for unions I need to change the generated code from:
const obj: TypeName = {...};
to
const obj = {...} as TypeName;
does that sound reasonable?
the issue was actually that the compiler can't know that only one of the props is set for the unions type when it's reconstructing it from the args object.
It would be simpler to do the same thing for both structs and unions
@kevin-greene-ck I did not test my change well enough. Just did a little more testing and realized I made a bad assumption.
The underlying issue is that the args interface has optional fields, but does not accept undefined as a value:
{ foo: undefined }
is not assignable to{ foo?: string }
.