allow sync methods in SetupModule
MODIFY
packages/app-utils/src/types.d.ts
packages/app-utils/src/types.d.ts
@@ -23,12 +23,6 @@ export interface PageResponse extends EndpointResponse {
dependencies: Record<string, EndpointResponse>;
}
-export interface SetupModule {
- prepare?: (headers: Headers) => Promise<{ context: any, headers: Headers }>;
- getSession?: (context: any) => Promise<any>;
- setSession?: (context: any, session: any) => Promise<any>;
-}
-
export interface SSRComponentModule {
default: SSRComponent;
}
@@ -41,6 +35,12 @@ export interface SSRComponent {
}
}
+export interface SetupModule<Context = any, Session = any> {
+ prepare?: (headers: Headers) => Promise<{ context: Context, headers: Headers }>;
+ getSession?: (context: Context) => Promise<Session> | Session;
+ setSession?: (context: Context, session: Session) => Promise<Session> | Session;
+}
+
export interface RenderOptions {
only_prerender: boolean; // TODO this shouldn't really be part of the public API
static_dir: string;

allow sync methods in SetupModule