Skip to content

Commit 12b2936

Browse files
removed pubspec upg
1 parent 66a2949 commit 12b2936

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/kit/types/index.d.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@ export type AwaitedProperties<input extends Record<string, any> | void> = input
3535
? input
3636
: unknown;
3737

38-
export type AwaitedActions<T extends Record<string, (...args: any) => any>> = {
39-
[Key in keyof T]: OptionalUnion<UnpackValidationError<Awaited<ReturnType<T[Key]>>>>;
40-
}[keyof T];
41-
42-
type OptionalUnion<U, A = Partial<Record<keyof UnionToIntersection<U>, never>>> = U extends unknown
43-
? Omit<A, keyof U> & U
44-
: never;
45-
46-
type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any
47-
? R
48-
: never;
38+
export type AwaitedActions<T extends Record<string, (...args: any) => any>> = Expand<
39+
{
40+
[Key in keyof T]: OptionalUnion<UnpackValidationError<Awaited<ReturnType<T[Key]>>>>;
41+
}[keyof T]
42+
>;
43+
44+
type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
45+
type OptionalUnion<
46+
U extends Record<string, unknown>,
47+
A extends keyof U = U extends U ? keyof U : never
48+
> = U extends unknown ? { [P in Exclude<A, keyof U>]?: never } & U : never;
4949

5050
// Needs to be here, else ActionData will be resolved to unknown - probably because of "d.ts file imports .js file" in combination with allowJs
5151
interface ValidationError<T extends Record<string, unknown> | undefined = undefined> {

0 commit comments

Comments
 (0)