firebase-admin-node
firebase-admin-node copied to clipboard
SecretParam TS type is not exported
Describe your environment
- Operating System version: Mac Sonoma 14.3
- Firebase SDK version: v12.0.0
- Firebase Product: Admin SDK for NodeJS
- Node.js version: v18.17.1
- NPM version: 9.8.1
- VSCode version: 1.85.2
- ESLint version: 8.56.0
- @typescript-eslint/eslint-plugin version: 6.20.0
Describe the problem
Using VSCode with ESLint & TypeScript enabled, I am trying to write a function that takes the results of defineSecret()
and does some processing on it to reduce code duplication across my project. The issue is that the datatype returned, SecretParam
, is not exported.
When trying:
import {SecretParam} from 'firebase-functions/params';
VSCode reports:
Module '"firebase-functions/params"' declares 'SecretParam' locally, but it is not exported.ts(2459)
index.d.ts(5, 67): 'SecretParam' is declared here.
TSC errors out with:
error TS2459: Module '"firebase-functions/params"' declares 'SecretParam' locally, but it is not exported.
Relevant Code:
The code below is throwing ESLint errors and fails to compile with tsc
:
import {SecretParam} from 'firebase-functions/params';
export const safeGetConfigJsonVal = (secretKey: SecretParam): Record<string, any> => {
if (!secretKey.value()) {
throw new Error('secretKey.value() is null/undefined');
}
let myConfig;
try {
myConfig = JSON.parse(secretKey.value());
return myConfig;
} catch (ex) {
throw new Error(
`secretKey is not a valid JSON string: ${secretKey.value()}`
);
}
};
Workaround:
Put // @ts-ignore
on the line immediately before the import
line