Skip to content

Typings any key#196

Open
noahgrant wants to merge 2 commits intomainfrom
typings_any_key
Open

Typings any key#196
noahgrant wants to merge 2 commits intomainfrom
typings_any_key

Conversation

@noahgrant
Copy link
Copy Markdown
Owner

Fixes (includes issue number if applicable):

  • Allows the user to type any string as a key in the resource config object—not just a resourceKey—and have the return from useResources typed correctly.
  • Previously this functionality worked in the library but the user would need to apply a few @ts-ignores because TypeScript wouldn't recognize it.

ie, this will work now:

getResources = () => ({
  myResource: {resourceKey: "user"}
});


// ...
const {myResourceModel} = useResources(getResources, {}); // myResourceModel is type userModel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant