Skip to content

Commit e32d46c

Browse files
taeold64johnlee
andcommitted
fix: add typesVersions so testing module resolves under classic TypeScript moduleResolution
The exports map in package.json correctly declares the ./testing subpath, but TypeScript's moduleResolution: "node" (the default in most projects) does not read the exports field. This caused `getTestServer` and `getFunction` to appear not found when users imported @google-cloud/functions-framework/testing. Adding typesVersions instructs TypeScript to resolve the testing subpath to ./build/src/testing.d.ts regardless of moduleResolution setting, unblocking users on TypeScript <4.7 or projects that have not yet adopted node16/bundler module resolution. Fixes #594 Co-authored-by: 64JohnLee <64lamei@gmail.com>
1 parent 5f58e79 commit e32d46c

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
"default": "./build/src/testing.js"
1919
}
2020
},
21+
"typesVersions": {
22+
"*": {
23+
"testing": [
24+
"./build/src/testing.d.ts"
25+
]
26+
}
27+
},
2128
"dependencies": {
2229
"@types/express": "^5.0.0",
2330
"body-parser": "^2.2.2",

0 commit comments

Comments
 (0)