Using typescript types after modifying api/src/graphql/*.sdl.ts

Hey @sangheestyle, we keep “meeting” each other on typescript issues :smiley:

So for your shared types we need to do a few things:

  1. Put your shared types at the root of the project (makes sense right?), maybe in @types at the root
    You can call this folder whatever you like ofcourse, just add the same folder to your includes
  2. Modify your web/tsconfig.json and api/tsconfig.json by adding this to your includes:
"include": [
 "src", 
 "../.redwood/**/*", 
+"../@types"
]
  1. Restart TS server in vscode. And your new types should now be available on both web and api sides!

Hope this solves your problem!


PS: Are you building anything cool? Would love to hear a bit more if you’re willing to share

1 Like