Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Typings any key#196

Open
noahgrant wants to merge 2 commits into
mainnoahgrant/resourcerer:mainfrom
typings_any_keynoahgrant/resourcerer:typings_any_keyCopy head branch name to clipboard
Open

Typings any key#196
noahgrant wants to merge 2 commits into
mainnoahgrant/resourcerer:mainfrom
typings_any_keynoahgrant/resourcerer:typings_any_keyCopy head branch name to clipboard

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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.