Skip to content

Instantly share code, notes, and snippets.

@kettanaito
Created November 5, 2021 00:26
Show Gist options
  • Save kettanaito/0fe4202c1a6c84435c339774a6d01ed8 to your computer and use it in GitHub Desktop.
Save kettanaito/0fe4202c1a6c84435c339774a6d01ed8 to your computer and use it in GitHub Desktop.
Annotate context type from "@apollo/client"
declare module '@apollo/client/core' {
export interface DefaultContext {
accessToken: string
}
}
export {}
import { useQuery } from '@apollo/client'
useQuery(query, {
context: {
accessToken: 2 // TypeError: "number" is not assignable to type "string"
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment