-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Make operations work with any
#2170
Conversation
Expect<Equal<typeof getAnyNoAuth, QueryMetadata & ((args: any) => Promise<any>)>>, | ||
Expect<Equal<typeof getAnyAuth, QueryMetadata & ((args: any) => Promise<any>)>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regression tests.
Expect<Equal<typeof getAnyNoAuth, (args: any) => Promise<any>>>, | ||
Expect<Equal<typeof getAnyAuth, (args: any, ctx: { user: AuthUser }) => Promise<any>>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regression tests.
|
||
export const testingAction: TestingAction = async (args, context) => { | ||
// todo(filip): When sorting out the tests, we should also test whether the | ||
// TODO: (Filip) When sorting out the tests, we should also test whether the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed how I write these notes because my editor nicely highlights them if they start with TODO:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some small comments. Make sure to update the e2e tests 👍
This reverts commit a9f6f44.
Steps to reproduce
In
0.14.0-rc1
:any
(either explicitly or because they are using JS). For example:getFoo
has type() => Promise<any>
getFoo
has type() => Promise<any>
if non-authenticated or(ctx: ...) => Promise<any>
if authenticated.Expected behavior:
The types should be
(args: any) => Promise<any>
and(args: any, ctx: ...) => Promise<any>
.Explanation
We wanted to expose void operations as receiving no arguments (#2004).
To do so, we check whether
Input extends void
and act accordingly.Unfortunately,
any
extendsvoid
as well, which made us treat an operation with input of typeany
like it had input of typevoid
.To fix it, we now first check whether the input is of type
any
.