You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is related to my plugin https://github.com/Sytten/nexus-shield
So I am trying to define a new objectType property and I honestly tried very hard to make it work, but the TypeName always gets overwritten by the incoming interface that you put as an input and the whole thing blows up to a basic string making the rest of the typing go down the toilet :)
So basically the generated code is:
interfaceNexusGenPluginTypeConfig<TypeNameextendsstring>{/** * Default authorization rule to execute on all fields of this object */shield?: ShieldRule<TypeName,any>}
When I define the rules in the fields, I have no problem and the typing flows from the objectType into the ShieldRule, but for some reason in the object type it doesn't and it takes the string as the type.
Problem:
Similar situation for field (but works correctly):
It also works fine if I just accept a function like:
interfaceNexusGenPluginTypeConfig<TypeNameextendsstring>{/** * Default authorization rule to execute on all fields of this object */shield?: (root: RootValue<TypeName>,args: ArgsValue<TypeName,FieldName>,ctx: GetGen<'context'>,info: GraphQLResolveInfo)=>ShieldRuleResult|Promise<ShieldRuleResult>;}
But that is not really what I want to do because I miss some configuration.
Any idea is appreciated, maybe this is not doable with the current state of typescript :/
I might have to switch to a more function interface instead of OO based like I have currently.
The text was updated successfully, but these errors were encountered:
This is related to my plugin https://github.com/Sytten/nexus-shield
So I am trying to define a new
objectType
property and I honestly tried very hard to make it work, but theTypeName
always gets overwritten by the incoming interface that you put as an input and the whole thing blows up to a basicstring
making the rest of the typing go down the toilet :)So basically the generated code is:
And I generate the interface using:
When I define the rules in the fields, I have no problem and the typing flows from the
objectType
into theShieldRule
, but for some reason in the object type it doesn't and it takes thestring
as the type.Problem:
Similar situation for field (but works correctly):
It also works fine if I just accept a function like:
But that is not really what I want to do because I miss some configuration.
Any idea is appreciated, maybe this is not doable with the current state of typescript :/
I might have to switch to a more function interface instead of OO based like I have currently.
The text was updated successfully, but these errors were encountered: