apollo-type-guard

1.0.0 • Public • Published

Apollo Types Guard

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-types-guard

With yarn:

yarn add --dev apollo-types-guard

Usage

  • Run apollo client:codegen CLI to generate types files from your schema
  • Run
    apollo-types-guard --globDir="glob/to/generated/folders"
    
  • Depending on you folder structure you should see something like this:
    Before :
    .
    └── src
        └── __generated__
            ├── QueryOne.ts
            └── QueryTwo.ts
    
    After:
    .
    └── src
        └── __generated__
            ├── guards
            │   ├── QueryOne.ts
            │   └── QueryTwo.ts
            ├── QueryOne.ts
            └── QueryTwo.ts
    

Readme

Keywords

none

Package Sidebar

Install

npm i apollo-type-guard

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

27.2 kB

Total Files

25

Last publish

Collaborators

  • chibikookie