FirebaseExtended / FirebaseExtended/reactfire

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

Đang mở
#511 0 bình luận 1 reaction 1 người được giao Được @HYACCCINT nhận Xem trên GitHub
feature request v5
Ngôn ngữ chính
TypeScript
Star
3.6k
Fork
403
Merge trung bình
14 giờ 53 phút
Pull request đã merge (30 ngày)
5

Mô tả

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
```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.