diff --git a/spec/v1/config.spec.ts b/spec/v1/config.spec.ts index 45d51f09c..764e1a05b 100644 --- a/spec/v1/config.spec.ts +++ b/spec/v1/config.spec.ts @@ -26,11 +26,14 @@ import { config } from "../../src/v1/config"; describe("config()", () => { it("throws an error with migration guidance", () => { - expect(config).to.throw( + expect(() => { + // @ts-expect-error - config is deprecated and typed as never to cause a build error + config(); + }).to.throw( Error, "functions.config() has been removed in firebase-functions v7. " + "Migrate to environment parameters using the params module. " + "Migration guide: https://firebase.google.com/docs/functions/config-env#migrate-config" ); }); -}); +}); \ No newline at end of file diff --git a/src/v1/config.ts b/src/v1/config.ts index 6b1522f33..b50ce7b31 100644 --- a/src/v1/config.ts +++ b/src/v1/config.ts @@ -27,10 +27,10 @@ export { firebaseConfig } from "../common/config"; * Migrate to environment parameters using the `params` module immediately. * Migration guide: https://firebase.google.com/docs/functions/config-env#migrate-config */ -export function config(): Record { +export const config: never = (() => { throw new Error( "functions.config() has been removed in firebase-functions v7. " + "Migrate to environment parameters using the params module. " + "Migration guide: https://firebase.google.com/docs/functions/config-env#migrate-config" ); -} +}) as never;