strata-react 1.3.4 → 1.3.5

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.
@@ -15,12 +15,12 @@ type Params<O, Where extends "path" | "query"> = O extends {
15
15
  };
16
16
  } ? Exclude<V, undefined | never> : never;
17
17
  type Body<O> = O extends {
18
- requestBody?: {
19
- content: {
20
- [j in Json]: infer B;
21
- };
18
+ requestBody?: infer R;
19
+ } ? [NonNullable<R>] extends [never] ? never : NonNullable<R> extends {
20
+ content: {
21
+ [j in Json]: infer B;
22
22
  };
23
- } ? B : never;
23
+ } ? B : never : never;
24
24
  type Answer<O> = O extends {
25
25
  responses: infer R;
26
26
  } ? R extends {
@@ -58,11 +58,10 @@ type Request<O> = (HasKeys<Params<O, "path">> extends true ? {
58
58
  } : {
59
59
  query?: undefined;
60
60
  }) & Omit<RequestInit, "method" | "body">;
61
- type Args<O, WithBody extends boolean> = WithBody extends true ? [Body<O>] extends [never] ? [request?: Request<O>] : HasKeys<Params<O, "path">> extends true ? [request: Request<O> & {
62
- json: Body<O>;
63
- }] : [request: Request<O> & {
61
+ type Optional<O> = [RequiredKeys<Request<O>>] extends [never] ? [request?: Request<O>] : [request: Request<O>];
62
+ type Args<O, WithBody extends boolean> = WithBody extends true ? [Body<O>] extends [never] ? Optional<O> : [request: Request<O> & {
64
63
  json: Body<O>;
65
- }] : [request?: Request<O>];
64
+ }] : Optional<O>;
66
65
  /** A client whose paths, parameters, JSON bodies and answers come from `strata-api-types`' `paths`. */
67
66
  export type TypedApi<P> = {
68
67
  /** The path with the app's base: for an `<img src>`, a download link or an `EventSource`. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strata-react",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "React + Tailwind v4 components that ship structure, behaviour, states and a token contract, and no look: each product brings a theme generated from its own subject.",
5
5
  "repository": {
6
6
  "type": "git",