Skip to content
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

undefined converted to void in POST body types #25

Open
asktree opened this issue Jul 16, 2020 · 2 comments
Open

undefined converted to void in POST body types #25

asktree opened this issue Jul 16, 2020 · 2 comments

Comments

@asktree
Copy link

asktree commented Jul 16, 2020

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.

@hmil
Copy link
Owner

hmil commented Jul 16, 2020

This looks like a bug.

Can you provide a practical example where having void instead of undefined causes problems?

@asktree
Copy link
Author

asktree commented Jul 21, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants