@absolutejs/absolute 0.19.0-beta.712 → 0.19.0-beta.713

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.
@@ -4,6 +4,11 @@ import { type StreamingSlotEnhancerOptions } from '../core/responseEnhancers';
4
4
  type AngularPageRenderOptions = StreamingSlotEnhancerOptions & {
5
5
  collectStreamingSlots?: boolean;
6
6
  };
7
+ type IsAny<T> = 0 extends 1 & T ? true : false;
8
+ type HasNoRequiredAngularProps<Props> = IsAny<Props> extends true ? true : keyof Props extends never ? true : false;
9
+ type AngularPageHasOptionalProps<Page> = Page extends {
10
+ factory: (...args: infer Args) => unknown;
11
+ } ? [] extends Args ? true : HasNoRequiredAngularProps<AngularPagePropsOf<Page>> : HasNoRequiredAngularProps<AngularPagePropsOf<Page>>;
7
12
  export type AngularPageRequestInput<Page = {
8
13
  factory: (props: Record<never, never>) => unknown;
9
14
  }> = AngularPageRenderOptions & {
@@ -11,7 +16,7 @@ export type AngularPageRequestInput<Page = {
11
16
  indexPath: string;
12
17
  pagePath: string;
13
18
  providers?: ReadonlyArray<Provider | EnvironmentProviders>;
14
- } & (keyof AngularPagePropsOf<Page> extends never ? {
19
+ } & (AngularPageHasOptionalProps<Page> extends true ? {
15
20
  props?: NoInfer<AngularPagePropsOf<Page>>;
16
21
  } : {
17
22
  props: NoInfer<AngularPagePropsOf<Page>>;
@@ -22,7 +27,7 @@ export type HandleAngularPageRequest = {
22
27
  }>(input: AngularPageRequestInput<Page>): Promise<Response>;
23
28
  <Props extends Record<string, unknown> = Record<never, never>>(Page: AngularPageImporter<Props>, pagePath: string, indexPath: string, headTag: `<head>${string}</head>` | undefined, ...args: AngularPageHandlerArgs<Props>): Promise<Response>;
24
29
  };
25
- type AngularPageHandlerArgs<Props extends Record<string, unknown>> = keyof Props extends never ? [props?: NoInfer<Props>, options?: AngularPageRenderOptions] : [props: NoInfer<Props>, options?: AngularPageRenderOptions];
30
+ type AngularPageHandlerArgs<Props extends Record<string, unknown>> = HasNoRequiredAngularProps<Props> extends true ? [props?: NoInfer<Props>, options?: AngularPageRenderOptions] : [props: NoInfer<Props>, options?: AngularPageRenderOptions];
26
31
  export declare const invalidateAngularSsrCache: () => void;
27
32
  export declare function handleAngularPageRequest<Page = {
28
33
  factory: (props: Record<never, never>) => unknown;
@@ -15,8 +15,8 @@ export type AngularPageImporter<Props extends Record<string, unknown> = Record<s
15
15
  factory: AngularPageFactory<Props>;
16
16
  }>;
17
17
  export type AngularPagePropsOf<Page> = Page extends {
18
- factory: AngularPageFactory<infer Props>;
19
- } ? Props : Page extends AngularPageImporter<infer Props> ? Props : Record<never, never>;
18
+ factory: (...args: infer Args) => unknown;
19
+ } ? Args extends [] ? Record<never, never> : Exclude<Args[0], undefined> extends Record<string, unknown> ? Exclude<Args[0], undefined> : Record<never, never> : Page extends AngularPageImporter<infer Props> ? Props : Record<never, never>;
20
20
  export type CachedRouteData = {
21
21
  props: Record<string, unknown> | undefined;
22
22
  headTag: `<head>${string}</head>`;
package/package.json CHANGED
@@ -336,5 +336,5 @@
336
336
  ]
337
337
  }
338
338
  },
339
- "version": "0.19.0-beta.712"
339
+ "version": "0.19.0-beta.713"
340
340
  }