This is a demo for a TypeScript import issue with:
import { type Context } from '@google-cloud/functions-framework/build/src/functions'Which returns the following error when moduleResolution in tsconfig.json is set to nodenext:
Cannot find module '@google-cloud/functions-framework/build/src/functions' or its corresponding type declarations.ts(2307)
- Clone this repo
- Open in VSCode
- Install the recommended extensions
- Use the integrated TypeScript SDK at
.yarn/sdks/typescriptwhen prompted - Reload or restart VSCode
- Open
src/index.tsand observe the error - Open
tsconfig.jsonand changemoduleResolutiontonode - Observe the error is gone