vovk 3.0.0-draft.41 → 3.0.0-draft.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/types.d.ts +7 -2
- package/package.json +1 -1
package/client/types.d.ts
CHANGED
|
@@ -32,7 +32,12 @@ export type StreamAsyncIterator<T> = {
|
|
|
32
32
|
};
|
|
33
33
|
type StaticMethodReturn<T extends ControllerStaticMethod> = ReturnType<T> extends NextResponse<infer U> | Promise<NextResponse<infer U>> ? U : ReturnType<T> extends Response | Promise<Response> ? Awaited<ReturnType<T>> : ReturnType<T>;
|
|
34
34
|
type StaticMethodReturnPromise<T extends ControllerStaticMethod> = ToPromise<StaticMethodReturn<T>>;
|
|
35
|
-
type
|
|
35
|
+
type FilterNonMatching<T> = T extends {
|
|
36
|
+
body?: object;
|
|
37
|
+
query?: object;
|
|
38
|
+
params?: object;
|
|
39
|
+
} ? never : T;
|
|
40
|
+
type ClientMethod<T extends (...args: KnownAny[]) => void | object | StreamJSONResponse<STREAM> | Promise<StreamJSONResponse<STREAM>>, OPTS extends Record<string, KnownAny>, STREAM extends KnownAny = unknown> = <R>(options: FilterNonMatching<Prettify<(StaticMethodInput<T> extends {
|
|
36
41
|
body?: undefined | null;
|
|
37
42
|
query?: undefined;
|
|
38
43
|
params?: undefined;
|
|
@@ -42,7 +47,7 @@ type ClientMethod<T extends (...args: KnownAny[]) => void | object | StreamJSONR
|
|
|
42
47
|
params: StaticMethodInput<T>['params'];
|
|
43
48
|
} : unknown : StaticMethodInput<T>) & (Partial<OPTS & {
|
|
44
49
|
transform: (staticMethodReturn: Awaited<StaticMethodReturn<T>>) => R;
|
|
45
|
-
}>)
|
|
50
|
+
}>)>>) => ReturnType<T> extends Promise<StreamJSONResponse<infer U>> | StreamJSONResponse<infer U> | Iterator<infer U> | AsyncIterator<infer U> ? Promise<StreamAsyncIterator<U>> : R extends object ? Promise<R> : StaticMethodReturnPromise<T>;
|
|
46
51
|
type OmitNever<T> = {
|
|
47
52
|
[K in keyof T as T[K] extends never ? never : K]: T[K];
|
|
48
53
|
};
|