Skip to content

Commit

Permalink
docs(@remix-run/react): jsdoc for SerializeFrom
Browse files Browse the repository at this point in the history
  • Loading branch information
pcattori committed Aug 17, 2022
1 parent fb5884d commit 377512a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/remix-react/serialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export type TypedResponse<T extends unknown = unknown> = Response & {

type ArbitraryFunction = (...args: any[]) => unknown;

/**
* Infer JSON serialized data type returned by a loader or action.
*
* For example:
* `type LoaderData = SerializeFrom<typeof loader>`
*/
export type SerializeFrom<T extends AppData | ArbitraryFunction> = Serialize<
T extends (...args: any[]) => infer Output
? Awaited<Output> extends TypedResponse<infer U>
Expand Down

0 comments on commit 377512a

Please sign in to comment.