2.3 Generate Typescript Interfaces
The last step is to generate typescript interfaces from our GraphQL schema. This step is used to enhance the developer experience to strongly type our API.
1. Add dependencies
Install the following dev dependencies:
2. Make your API accessible
Add the following script to the script section of your package.json file:
3. Create the codegen config file
Create a file codegen.yml
in the root directory:
Replace [[API_URL]]
and [[API_KEY]]
with the values relevant to your project.
Last updated