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
It seems like the context types are hanlded incorrectly.
According to the apollo documentation the context function that is passed to the plugin should receive web server's context and return some custom user context.
When I do this:
interfaceMyContext{user: {id: number}}app.use(apollo<'/graphql',MyContext>({typeDefs: schema,
resolvers,context: async(elysiaContext: Context)=>{consttoken=elysiaContext?.headers?.get('Authorization')constuser=parseUser(token)return{
user
}}}))
I expect elysiaContext to be Context type from Elysia. But If I don't provide any type like that
app.use(apollo<'/graphql'>({
...
elysiaContext argument will have Apollo BaseContext type which is an empty object by default
But if I log the elysiaContext object it has request field and many more:
It seems like the context types are hanlded incorrectly.
According to the apollo documentation the context function that is passed to the plugin should receive web server's context and return some custom user context.
When I do this:
I expect elysiaContext to be
Context
type from Elysia. But If I don't provide any type like thatelysiaContext argument will have Apollo
BaseContext
type which is an empty object by defaultBut if I log the elysiaContext object it has
request
field and many more:What is that? Where does it come from?
I think the types could use a refactor here. Do you need help with that?
The text was updated successfully, but these errors were encountered: