rest.ts
rest.ts copied to clipboard
undefined converted to void in POST body types
Let's say my POST query has an optional parameter:
const myBody = {arg: "" as string | undefined}
The driver will instead expect a body of type
{arg: string | void}
This is pretty annoying. I can't tell if it's an unknown bug, or some weird TypeScript thing that you don't have a good workaround for.
This looks like a bug.
Can you provide a practical example where having void instead of undefined causes problems?
Sometimes I want a field to be undefined in the body or response of a REST query. For example, if a certain endpoint is passed an auth token, it should associate the activity with a specific user instead of with an anonymous user. This bug makes that impossible, because undefined !== void.