From e32d46ca21b09d1064ab4f737f0ea4ba778d671d Mon Sep 17 00:00:00 2001 From: Daniel Lee Date: Mon, 22 Jun 2026 18:57:10 +0000 Subject: [PATCH] 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> --- package.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/package.json b/package.json index 1c002ecb..527235b8 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,13 @@ "default": "./build/src/testing.js" } }, + "typesVersions": { + "*": { + "testing": [ + "./build/src/testing.d.ts" + ] + } + }, "dependencies": { "@types/express": "^5.0.0", "body-parser": "^2.2.2",