Global Context type #1853
Answered
by
bombillazo
bombillazo
asked this question in
Q&A
-
Hello, I am trying to follow these instructions on typing the Context but don't know where I need to declare that Global namespace. |
Beta Was this translation helpful? Give feedback.
Answered by
bombillazo
Sep 14, 2021
Replies: 3 comments 10 replies
-
You can define it anywhere. It should work |
Beta Was this translation helpful? Give feedback.
2 replies
-
Don't know what else is required so my context gets Globally typed. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Ok got it to work the following manner:
declare global {
namespace GraphQLModules {
interface GlobalContext {
myProp: string;
}
}
}
const application = createApplication({
...
generates:
path/to/file.ts:
plugins:
- typescript
- typescript-resolvers
config:
contextType: "GraphQLModules.Context"
... After that my resolver context gets typed! :D |
Beta Was this translation helpful? Give feedback.
8 replies
Answer selected by
bombillazo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok got it to work the following manner:
index.ts
file where I create my graphql-modules application.After that my resolver context gets typed! :D