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
I have a similar use case to the one described here #3052
Currently I'm using the fieldContextTypes option available in the plugin, but in my option it could be better to implement a
an option that allow to extend the context in some way if a directive is present in a filed. In this case, if you have several field with a specific directive, you do not have to manually map each field in the fieldContextTypes option.
// context.ts// This resolver context is used for all fieldsexportinterfaceContext{someData: number}// This type function should be used for fields with `isLoggedIn` directiveexporttypeLoggedContext<Context=any>=Context&{user: User}
This should generate a Context of type LoggedContext<Context> on fields with directive isLoggedIn
Describe alternatives you've considered
An alternative is using fieldContextTypes but you need to manually extend fields and does not work well if you have a huge project.
The text was updated successfully, but these errors were encountered:
I have a similar use case to the one described here #3052
Currently I'm using the
fieldContextTypes
option available in the plugin, but in my option it could be better to implement aan option that allow to extend the context in some way if a directive is present in a filed. In this case, if you have several field with a specific directive, you do not have to manually map each field in the
fieldContextTypes
option.Example
Describe the solution you'd like
This should generate a Context of type
LoggedContext<Context>
on fields with directiveisLoggedIn
Describe alternatives you've considered
An alternative is using
fieldContextTypes
but you need to manually extend fields and does not work well if you have a huge project.The text was updated successfully, but these errors were encountered: