I have a folder structure like below. I'm trying to share types.ts
between firebase functions and firebase hosting, stored respectively in functions/src/
and src/
.
package.json
tsconfig.json
functions/
- package.json
- tsconfig.json
- src/
--- index.ts
src/
- types.ts
My build process is to run npm run-script build
and then firebase deploy
from the main project directory. This has been working for a while, but with seemingly no changes I'm now receiving the below error when I try to deploy firebase functions.
error TS2307: Cannot find module '../../src/types' or its corresponding type declarations.
I have a vague understanding that the folder structure is being lost after tsc
does its thing. I could just duplicate the types in both spots, but this doesn't seem ideal. How can I share types.ts
between hosting and functions?