···3535}
3636```
37373838-now restart your TS-server and you should be good to go
3838+now restart your TS-server and you should be good to go, ensure you are using the
3939+workspace version of TypeScript. In VSCode you can do so by clicking the bottom right
4040+when on a TypeScript file or adding a file like [this](https://github.com/0no-co/GraphQLSP/blob/main/packages/example/.vscode/settings.json).
4141+4242+> If you are using VSCode ensure that your editor is using the Workspace Version of TypeScript
4343+4444+### Configuration
4545+4646+**Required**
4747+4848+- `schema` allows you to specify a url, `.json` or `.graphql` file as your schema. If you need to specify headers for your introspection
4949+ you can opt into the object notation i.e. `{ "schema": { "url": "x", "headers": { "Authorization": "y" } }}`
5050+5151+**Optional**
5252+5353+- `template` the shape of your template, by default `gql`
5454+- `templateIsCallExpression` this tells our client that you are using `graphql('doc')`
5555+- `disableTypegen` disables type-generation in general, this could be needed if offset bugs are introduced
5656+- `scalars` allows you to pass an object of scalars that we'll feed into `graphql-code-generator`
5757+- `extraTypes` allows you to specify imports or declare types to help with `scalar` definitions
5858+- `shouldCheckForColocatedFragments` when turned on, this will scan your imports to find
5959+ unused fragments and provide a message notifying you about them
6060+6161+### GraphQL Code Generator client-preset
6262+6363+For folks using the `client-preset` you can ues the following config
6464+6565+```json
6666+{
6767+ "compilerOptions": {
6868+ "plugins": [
6969+ {
7070+ "name": "@0no-co/graphqlsp",
7171+ "schema": "./schema.graphql",
7272+ "disableTypegen": true,
7373+ "templateIsCallExpression": true,
7474+ "template": "graphql"
7575+ }
7676+ ]
7777+ }
7878+}
7979+```
8080+8181+## Fragment masking
8282+8383+When we use a `useQuery` that supports `TypedDocumentNode` it will automatically pick up the typings
8484+from the `query` you provide it. However for fragments this could become a bit more troublesome, the
8585+minimal way of providing typings for a fragment would be the following:
8686+8787+```tsx
8888+import { TypedDocumentNode } from '@graphql-typed-document-node/core';
8989+9090+export const PokemonFields = gql`
9191+ fragment pokemonFields on Pokemon {
9292+ id
9393+ name
9494+ }
9595+` as typeof import('./Pokemon.generated').PokemonFieldsFragmentDoc;
9696+9797+export const Pokemon = props => {
9898+ const pokemon = useFragment(props.pokemon, PokemonFields);
9999+};
100100+101101+export function useFragment<Type>(
102102+ data: any,
103103+ _fragment: TypedDocumentNode<Type>
104104+): Type {
105105+ return data;
106106+}
107107+```
108108+109109+This is mainly needed in cases where this isn't supported out of the box and mainly serves as a way
110110+for you to case your types.
3911140112## Local development
41113