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/typescript
when prompted - Reload or restart VSCode
- Open
src/index.ts
and observe the error - Open
tsconfig.json
and changemoduleResolution
tonode
- Observe the error is gone