Skip to content

Commit

Permalink
fix(data): update Form types in createRouteAction.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
caseybaggz committed Jul 13, 2023
1 parent 8cfe543 commit 3d3a591
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/start/data/createRouteAction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ export type RouteAction<T, U> = [
retry: () => void;
},
((vars: T) => Promise<U>) & {
Form: T extends FormData ? ParentComponent<FormProps> : never;
Form: ParentComponent<FormProps | T>;
url: string;
}
];
export type RouteMultiAction<T, U> = [
Submission<T, U>[] & { pending: Submission<T, U>[] },
((vars: T) => Promise<U>) & {
Form: T extends FormData ? ParentComponent<FormProps> : never;
Form: ParentComponent<FormProps | T>;
url: string;
}
];
Expand Down Expand Up @@ -71,7 +71,7 @@ export function createRouteAction<T, U = void>(
if (reqId === count) {
if (data instanceof Response) {
await handleResponse(data, navigate, options);
} else await handleRefetch(data as any[], options);
} else await handleRefetch(data as unknown as any[], options);
if (!data || isRedirectResponse(data)) setInput(undefined);
else setResult({ data });
}
Expand Down Expand Up @@ -103,7 +103,7 @@ export function createRouteAction<T, U = void>(
{props.children}
</FormImpl>
);
}) as T extends FormData ? ParentComponent<FormProps> : never;
}) as ParentComponent<FormProps | T>;

return [
{
Expand Down Expand Up @@ -187,7 +187,7 @@ export function createRouteMultiAction<T, U = void>(
if (data instanceof Response) {
await handleResponse(data, navigate, options);
data = data.body;
} else await handleRefetch(data as any[], options);
} else await handleRefetch(data as unknown as any[], options);
data ? setResult({ data }) : submission.clear();

return data;
Expand Down Expand Up @@ -224,7 +224,7 @@ export function createRouteMultiAction<T, U = void>(
{props.children}
</FormImpl>
);
}) as T extends FormData ? ParentComponent<FormProps> : never;
}) as ParentComponent<FormProps | T>;

return [
new Proxy<Submission<T, U>[] & { pending: Submission<T, U>[] }>([] as any, {
Expand Down

0 comments on commit 3d3a591

Please sign in to comment.