Created
November 5, 2021 00:26
-
-
Save kettanaito/0fe4202c1a6c84435c339774a6d01ed8 to your computer and use it in GitHub Desktop.
Annotate context type from "@apollo/client"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module '@apollo/client/core' { | |
export interface DefaultContext { | |
accessToken: string | |
} | |
} | |
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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