-
Notifications
You must be signed in to change notification settings - Fork 6
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
Allow default to be set on the objectType #50
Comments
Partially fixed by #59, but it breaks the typing and I still have no idea why. |
@lewebsimple Not sure how good you are with advanced typescript but I could use a hand on that one if you have time. |
@Sytten hmmm I'm no TypeScript wizard so I compared your code to the official fieldAuthorizePlugin which should be similar in scope. At first glance, the corresponding types So maybe using the Also, I fail to see the difference between |
It also occurs to me that the generated type differ from what you state in the other issue: This is what you wrote:
This is what I get in my project:
where Should it be Update : |
Yeah I tried to simplify it, the |
Did you base your code off of the official fieldAuthorize plugin ? |
Similar yes, but I reused the class based system of graphql-shield. I did my best on the TS trickery (some of it is explained at the end of the README), but this last problem I really have no clue. I would need better AST debugging tooling to understand why the compiler cant infer the parameter on object but can on the resolvers. |
Im getting this error when using shield on objectType + Here's the typing im using declare global {
interface NexusGenPluginFieldConfig<
TypeName extends string,
FieldName extends string
> {
shield?: FieldShieldResolver<TypeName, FieldName>;
}
interface NexusGenPluginTypeConfig<TypeName extends string> {
shield?: ObjectTypeShieldResolver<TypeName>;
}
} |
I am not really sure why the typing is broken. I don't have a lot of time to work that, so if it is important for you I would suggest you take a look at the code (will review PRs). |
Just a note for later, with the new in/out keyword for typescript there is probably a way to force the compiler to understand that the type used is an |
It would be nice to be able to set a default rule on the object type with overrides on each field that defines one.
The text was updated successfully, but these errors were encountered: