Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IMPROVEMENT] Improve types within routes #109

Merged
merged 1 commit into from
Mar 20, 2022

Conversation

vedovelli
Copy link
Contributor

@vedovelli vedovelli commented Mar 20, 2022

Problem

CleanShot 2022-03-20 at 19 50 13

When using useLoaderData() hook, we are not receiving strongly typed objects.

Solution

CleanShot 2022-03-20 at 19 50 28

This PR introduces a new type LoaderData which is used in 2 different places within routes:

  • To type the return of the loader function. Plus, we are now using Remix's utility json() to generate a JSON Response;
  • To type the return of the hook useLoaderData().

@vercel
Copy link

vercel bot commented Mar 20, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/willianjusten/nba-remix/6tkjTGxqrLMxbBQe7GHwPmMLEPr8
✅ Preview: https://nba-remix-git-fork-vedovelli-improve-typings-willianjusten.vercel.app

@vedovelli vedovelli changed the title Improve typings within routes [IMPROVEMENT] Improve typings within routes Mar 20, 2022
@vedovelli vedovelli changed the title [IMPROVEMENT] Improve typings within routes [IMPROVEMENT] Improve types within routes Mar 20, 2022
@willianjusten
Copy link
Owner

Hey! Glad to see you here =)
That was something that I pointed on #14 that I wanted to address, thanks for fixing it!

@willianjusten willianjusten merged commit a8b39cc into willianjusten:main Mar 20, 2022
@adeonir
Copy link
Collaborator

adeonir commented Mar 21, 2022

Thanks @vedovelli, very good!

@vedovelli
Copy link
Contributor Author

🚀

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.

3 participants