-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Add generics for Remix type enhancements #10843
Conversation
🦋 Changeset detectedLatest commit: 25622d5 The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
fef17cb
to
ea5a5f2
Compare
params: AgnosticRouteMatch["params"]; | ||
data: unknown; | ||
handle: unknown; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is now exported from utils.ts
as UIMatch
🤖 Hello there, We just published version Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the light of named tuple elements, I've seen something passing by to do the same for generic elements as well, so I think it would be better to have long names instead
/** | ||
* An entry in a history stack. A location contains information about the | ||
* URL path, as well as possibly some arbitrary state and a key. | ||
*/ | ||
export interface Location extends Path { | ||
export interface Location<S = any> extends Path { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export interface Location<S = any> extends Path { | |
export interface Location<State = any> extends Path { |
/** | ||
* Arguments passed to loader functions | ||
*/ | ||
export interface LoaderFunctionArgs extends DataFunctionArgs {} | ||
export interface LoaderFunctionArgs<C = any> extends DataFunctionArgs<C> {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export interface LoaderFunctionArgs<C = any> extends DataFunctionArgs<C> {} | |
export interface LoaderFunctionArgs<Context = any> extends DataFunctionArgs<Context> {} |
|
||
/** | ||
* Arguments passed to action functions | ||
*/ | ||
export interface ActionFunctionArgs extends DataFunctionArgs {} | ||
export interface ActionFunctionArgs<C = any> extends DataFunctionArgs<C> {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export interface ActionFunctionArgs<C = any> extends DataFunctionArgs<C> {} | |
export interface ActionFunctionArgs<Context = any> extends DataFunctionArgs<Context> {} |
export interface LoaderFunction<C = any> { | ||
(args: LoaderFunctionArgs<C>): Promise<DataFunctionValue> | DataFunctionValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export interface LoaderFunction<C = any> { | |
(args: LoaderFunctionArgs<C>): Promise<DataFunctionValue> | DataFunctionValue; | |
export interface LoaderFunction<Context = any> { | |
(args: LoaderFunctionArgs<Context>): Promise<DataFunctionValue> | DataFunctionValue; |
export interface ActionFunction<C = any> { | ||
(args: ActionFunctionArgs<C>): Promise<DataFunctionValue> | DataFunctionValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export interface ActionFunction<C = any> { | |
(args: ActionFunctionArgs<C>): Promise<DataFunctionValue> | DataFunctionValue; | |
export interface ActionFunction<Context = any> { | |
(args: ActionFunctionArgs<Context>): Promise<DataFunctionValue> | DataFunctionValue; |
@@ -490,6 +493,28 @@ export function matchRoutes< | |||
return matches; | |||
} | |||
|
|||
export interface UIMatch<D = unknown, H = unknown> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export interface UIMatch<D = unknown, H = unknown> { | |
export interface UIMatch<Data = unknown, Handle = unknown> { |
data: D; | ||
handle: H; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data: D; | |
handle: H; | |
data: Data; | |
handle: Handle; |
🤖 Hello there, We just published version Thanks! |
Adding TS generics to support remix-run/remix#7319