Skip to content

Commit 08fde04

Browse files
committed
feat: allow 'Methods' unknown type.
1 parent aff042a commit 08fde04

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/Typo/app.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ export namespace FibApp {
156156

157157
export interface FibAppORMModel<
158158
PropertyTypes extends Record<string, FxOrmInstance.FieldRuntimeType> = Record<string, FxOrmInstance.FieldRuntimeType>,
159-
Methods extends Record<string, (...args: any) => any> = Record<string, (...args: any) => any>
160-
> extends FxOrmModel.Model<PropertyTypes, Methods> {
159+
Methods extends Record<string, (...args: any) => any> | unknown = Record<string, (...args: any) => any>
160+
> extends FxOrmModel.Model<PropertyTypes, Methods extends unknown ? any : Methods> {
161161
$webx: {
162162
// globally unique class id
163163
readonly cid: number

typings/Typo/app.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export declare namespace FibApp {
117117
};
118118
};
119119
};
120-
interface FibAppORMModel<PropertyTypes extends Record<string, FxOrmInstance.FieldRuntimeType> = Record<string, FxOrmInstance.FieldRuntimeType>, Methods extends Record<string, (...args: any) => any> = Record<string, (...args: any) => any>> extends FxOrmModel.Model<PropertyTypes, Methods> {
120+
interface FibAppORMModel<PropertyTypes extends Record<string, FxOrmInstance.FieldRuntimeType> = Record<string, FxOrmInstance.FieldRuntimeType>, Methods extends Record<string, (...args: any) => any> | unknown = Record<string, (...args: any) => any>> extends FxOrmModel.Model<PropertyTypes, Methods extends unknown ? any : Methods> {
121121
$webx: {
122122
readonly cid: number;
123123
readonly model_name: string;
@@ -311,7 +311,7 @@ export declare namespace FibApp {
311311
app: FibAppClass;
312312
models: GlobalAppModels;
313313
graphql<T = any>(query: FibApp.GraphQLQueryString, req: FibApp.FibAppHttpRequest): T;
314-
define: <T extends Record<string, FxOrmModel.ComplexModelPropertyDefinition>, U extends FibAppOrmModelDefOptions<FxOrmModel.GetPropertiesType<T>>>(name: string, properties: T, opts?: U) => FibAppORMModel<FxOrmModel.GetPropertiesType<T>, Exclude<U['methods'], void>>;
314+
define: <T extends Record<string, FxOrmModel.ComplexModelPropertyDefinition>, U extends FibAppOrmModelDefOptions<FxOrmModel.GetPropertiesType<T>>>(name: string, properties: T, opts?: U) => FibAppORMModel<FxOrmModel.GetPropertiesType<T>, Exclude<U['methods'], void> & Record<string, (...args: any) => any>>;
315315
}
316316
export type FibAppDb = FibAppORM;
317317
export type FibAppFunctionToBeFilter = (FibAppFilterableApiFunction__WithModel | FibAppFilterableApiFunction__NullModel | FibAppOrmModelFunction | FibAppInternalApiFunction);

0 commit comments

Comments
 (0)