Open ceisele-r opened 2 years ago
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Hi @ceisele-r, thanks for the report. I was able to reproduce the behavior now. Let me check what we can do for this issue or bring someone here that can provide more context about it. I’ll update this thread if I have any information to share.
@jbalidiong thanks. After working a bit more with it, I am actually unsure whether JSON values defined in the dashboard end up in the web app as string value (JSON.stringify'ed) and that's the reason why only string | number | boolean
is allowed...
Would be cool if someone could clarify this.
Looking at the code, it seems it's stored locally as whatever type of value you put in (number, string, boolean, JSON object), however if you try to get the value using getValue()
, it will be returned as a string using String()
which, if the value is an object, will be [object Object]
.
It seems reasonable to add a getJSON()
method in the same vein as getNumber()
, getBoolean()
, and we can make this a feature request.
[REQUIRED] Describe your environment
[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 eitherstring
,number
orboolean
.The issue seems to be in these two places:
Steps to reproduce:
Try to set the remote config default value to a JSON value via
This creates the following Typescript error:
Relevant Code:
See above