I have the following function:
const UseFeature = ({ name }: { name: string }) => {
const features = useContext(FeatureFlags);
if (features === null) {
throw new Error('You must wrap your components in a FeatureProvider.');
}
return Array.isArray(features) ? features.includes(name) : features[name];
};
export default UseFeature;
I call this function on another component :
const hasV1 = UseFeature('v1');
I get this error which I don't understand
Argument of type 'string' is not assignable to parameter of type '{ name: string; }'.
TS2345
Yet 'V1' is indeed a string element.
Have you ever had this problem ?