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

enhancement: Export additional types from @remix-run/react #2876

Merged
merged 1 commit into from
May 27, 2022

Conversation

chaance
Copy link
Collaborator

@chaance chaance commented Apr 19, 2022

This PR exposes additional types that are helpful when passing values via context or props.

Complex return types from functions should be exposed directly IMO. Usage is a little simpler than relying on ReturnType<typeof someFunc>, and in the case of generics like Fetcher and FetcherWithComponents it is necessary.

// instead of this...
type Ctx = {
  fetcher: ReturnType<typeof useFetcher>;
  location: ReturnType<typeof useLocation>;
};

// ...I can do this
type Ctx = {
  fetcher: FetcherWithComponents<SomeData>;
  location: Location;
};

@chaance chaance changed the title enhancement: export additional types enhancement: Export additional types from @remix-run/react Apr 19, 2022
@ryanflorence ryanflorence merged commit c5d6cd2 into dev May 27, 2022
@ryanflorence ryanflorence deleted the chance/export-types branch May 27, 2022 12:36
@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version v0.0.0-nightly-c5d6cd2-20220528 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

justjavac pushed a commit to justjavac/remix that referenced this pull request Jun 11, 2022
@github-actions
Copy link
Contributor

🤖 Hello there,

We just published version v1.6.0 which includes this pull request. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

@mikeybinns
Copy link
Contributor

Another good type to export would be Transition, instead of ReturnType<typeof useTransition>.
I used to be able to import it from import type { Transition } from "@remix-run/react/transition"; but this is no longer possible, and there's no export for @remix-run/react.

I'm not sure if you can update this PR with this very similar request or if I should make a new one, let me know 😄

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

Successfully merging this pull request may close these issues.

None yet

4 participants