react-client-sdk icon indicating copy to clipboard operation
react-client-sdk copied to clipboard

RFC: Add generic type to `useFlags`

Open jamiehaywood opened this issue 3 years ago • 3 comments

Is your feature request related to a problem? Please describe. It would be great to get intellisense when destructuring the flags from useFlags

Describe the solution you'd like To pass a generic to the useFlags hook:

interface Flags {
  featureFlagOne: boolean
}

const { featureFlagOne } = useFlags<Flags>()

jamiehaywood avatar Jul 11 '22 09:07 jamiehaywood

Thank you for requesting this. This makes sense. We'll raise this internally and I'll update this issue when there's one.

yusinto avatar Jul 13 '22 17:07 yusinto

thanks @yusinto - I'm happy to write a PR to support this, just wanted to get validation around the idea.

jamiehaywood avatar Jul 14 '22 14:07 jamiehaywood

@jamiehaywood a PR will be super! Thank you for this.

yusinto avatar Jul 21 '22 18:07 yusinto