Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

[Feature]: Loader data generics #9189

Closed
siric opened this issue Aug 25, 2022 · 2 comments
Closed

[Feature]: Loader data generics #9189

siric opened this issue Aug 25, 2022 · 2 comments
Labels

Comments

@siric
Copy link

siric commented Aug 25, 2022

What is the new or updated feature that you are suggesting?

Instead of returning unknown by default and then typecasting (as seen in one of the examples), prefer generics:

Bad

const data = useLoaderData() as Data

Good

const data = useLoaderData<Data>()

The same should be applied to useRouteLoaderData and useActionData.

Why should this feature be included?

Generics over typecasting.

@siric siric added the feature label Aug 25, 2022
@devpeerapong
Copy link

devpeerapong commented Aug 27, 2022

This will be decided in 6.5

@brophdawg11
Copy link
Contributor

I'm going to convert this to a discussion so it can go through our new Open Development process. Please upvote the new Proposal if you'd like to see this considered!

@remix-run remix-run locked and limited conversation to collaborators Jan 9, 2023
@brophdawg11 brophdawg11 converted this issue into discussion #9854 Jan 9, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
Projects
None yet
Development

No branches or pull requests

3 participants