FirebaseExtended / FirebaseExtended/reactfire

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

オープン
#511 コメント 0 件 リアクション 1 件 担当者 1 名 @HYACCCINT が担当を希望しています GitHub で見る
feature request v5
主要言語
TypeScript
スター
3.6k
フォーク
403
平均マージ
14時間 53分
マージ済み PR(30日)
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 を短くまとめたダイジェスト。