Skip to content

Commit

Permalink
Allow any object type for useFlags generic
Browse files Browse the repository at this point in the history
Convert to function to allow overrides

Closes #139
  • Loading branch information
ewlsh committed May 8, 2024
1 parent 629c2d9 commit bbf47f9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/useFlags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ import context, { ReactSdkContext } from './context';
*
* @return All the feature flags configured in your LaunchDarkly project
*/
const useFlags = <T extends LDFlagSet = LDFlagSet>(): T => {
// tslint:disable-next-line:no-any
function useFlags<T extends Record<string, any> = LDFlagSet>(): T {
const { flags } = useContext<ReactSdkContext>(context);

return flags as T;
};
}

export default useFlags;

0 comments on commit bbf47f9

Please sign in to comment.