FirebaseExtended / FirebaseExtended/reactfire

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

未关闭
#511 0 条评论 1 个 reaction 已指派 1 人 已被 @HYACCCINT 认领 在 GitHub 查看
feature request v5
主要语言
TypeScript
星标
3.6k
派生
403
平均合并
14 小时 53 分钟
30 天内合并 PR
5

描述

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

## Current usage
```ts
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
```ts
interface MyAwesomeRemoteConfigParameter {
buttonColor: "blue" | "red";
autoDestruction: boolean;
}

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。