我正在使用这个
const contextPaneTitleText = useFeature("contextPaneTitleText").asString();
这给我带来了错误
类型"contextPaneTitleText"的参数不能分配给类型"keyof Remote config"的参数
这是我的useFeature文件代码
import * as React from "react";
import { fetchAndActivate, getValue } from "firebase/remote-config";
import { remoteConfig } from "../../firebase";
import type { RemoteConfig } from "../../firebase";
type FeatureName = keyof RemoteConfig;
function useFeature(name: FeatureName) {
async function fetchConfig() {
await fetchAndActivate(remoteConfig);
}
React.useEffect(() => {
void fetchConfig();
}, [name]);
// reenable these to use different remote config settings for stage than for prod
// const flagName = ENV === "stage" ? `stage_${name}` : name;
// return getValue(remoteConfig, flagName);
return getValue(remoteConfig, name);
}
export { useFeature };