apollo-type-guards
v1.4.3
Published
This binary lets you enhance types generated by Apollo CLI by creating type guards associated with it.
Readme
Apollo Type Guards
This binary lets you enhance types generated by Apollo CLI by creating type guards associated with it.
Install
With npm:
npm install --save-dev apollo-type-guardsWith yarn:
yarn add --dev apollo-type-guardsUsage
- Run
apollo client:codegenCLI to generate types files from your schema - Run
apollo-type-guards --globDir="glob/to/generated/folders" - Depending on you folder structure you should see something like this:
Before :
After:. └── src └── __generated__ ├── QueryOne.ts └── QueryTwo.ts. └── src └── __generated__ ├── guards │ ├── QueryOne.ts │ └── QueryTwo.ts ├── QueryOne.ts └── QueryTwo.ts
