launchdarkly / react-client-sdk

LaunchDarkly Client-side SDK for React.js
Other
79 stars 67 forks source link

RFC: Add generic type to `useFlags` #139

Open jamiehaywood opened 2 years ago

jamiehaywood commented 2 years ago

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>()
yusinto commented 1 year ago

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

jamiehaywood commented 1 year ago

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

yusinto commented 1 year ago

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