Skip to content

[FEATURE] Using a remote config value with a generic type #511

Description

@louis030195

When using JSON in remote config parameter, we have to parse by ourselves the JSON, could be cleaner with generic type?

Current usage

interface MyAwesomeRemoteConfigParameter {
    buttonColor: "blue" | "red";
    autoDestruction: boolean;
}

const {data: myParamJsonString} = useRemoteConfigString("my_awesome_remote_config_parameter");
const myParam: MyAwesomeRemoteConfigParameter | undefined = myParamJsonString ? 
    JSON.parse(myParamJsonString) :
    undefined;

Desired usage

interface MyAwesomeRemoteConfigParameter {
    buttonColor: "blue" | "red";
    autoDestruction: boolean;
}

const {data: myParam} = useRemoteConfigValue<MyAwesomeRemoteConfigParameter>("my_awesome_remote_config_parameter");
// myParam is parsed with MyAwesomeRemoteConfigParameter interface

Metadata

Metadata

Assignees

Labels

feature requestNew feature or enhancement request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions