firebase / firebase/firebase-js-sdk
Typings for Remote Config defaults (`defaultConfig`) are missing JSON values
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 37
Description
### [REQUIRED] Describe your environment
* Operating System version: Windows 11
* Browser version: Chrome 100
* Firebase SDK version: 8 / 9
* Firebase Product: remote config
### [REQUIRED] Describe the problem
Via Firebase Console, we can set a JSON value for a remote config entry.
But in a (typescript) application, there is no way to set a default JSON value as the typings for `defaultConfig` only allow a default config value to be either `string`, `number` or `boolean`.
The issue seems to be in these two places:
- https://github.com/firebase/firebase-js-sdk/blob/1c37b5e965978d796c46ff6b9f52051cf6070751/packages/remote-config-types/index.d.ts#L27
- https://github.com/firebase/firebase-js-sdk/blob/1c37b5e965978d796c46ff6b9f52051cf6070751/packages/firebase/compat/index.d.ts#L1899
#### Steps to reproduce:
Try to set the remote config default value to a JSON value via
```typescript
remoteConfig.defaultConfig = {
"myfeatureflag": {
foo: "bar"
},
}
```
This creates the following Typescript error:
```
Type '{ [x: string]: { foo: string; }; }' is not assignable to type '{ [key: string]: string | number | boolean; }'.
'string' index signatures are incompatible.
Type '{ foo: string; }' is not assignable to type 'string | number | boolean'.ts(2322)
```
#### Relevant Code:
See above
Contributor guide
Assessment
This issue has not been assessed yet.