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

users.me types refuse auth parameter #470

Open
huw opened this issue Nov 3, 2023 · 0 comments
Open

users.me types refuse auth parameter #470

huw opened this issue Nov 3, 2023 · 0 comments

Comments

@huw
Copy link
Contributor

huw commented Nov 3, 2023

In api-endpoints.ts, we have:

export type GetSelfParameters = Record<string, never>

The problem is that in TypeScript, the never type infects any types which are joined to it. This means that WithAuth<GetSelfParameters> === Record<string, never> refusing any legitimate parameters. In practice, this means that TypeScript will throw an error for notion.users.me({ auth: AUTH_TOKEN }).

You can fix this by updating your API type generator to emit {} instead of Record<string, never>. It might also be prudent to set the EmptyObject type to {} too, but I haven’t tested that one.

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

1 participant