Skip to content

Commit

Permalink
Merge pull request #29 from BeeMargarida/ms/options-typing
Browse files Browse the repository at this point in the history
feat: options types
  • Loading branch information
joamag committed Feb 12, 2021
2 parents 2daa42b + ff09a03 commit 40db09f
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions types/data/model.d.ts
@@ -1,7 +1,23 @@
export interface Options {
readonly fields?: string[];
readonly eager?: boolean;
readonly eagerL?: boolean;
readonly map?: boolean;
readonly rules?: boolean;
readonly meta?: boolean;
readonly build?: boolean;
readonly fill?: boolean;
readonly resolveA?: boolean;
readonly skip?: number;
readonly limit?: number;
readonly sort?: unknown[][];
readonly raiseE?: boolean;
}

export declare class Model {
static niw<T = Model>(this: { new (): T }): T;
static find<T = Model>(this: { new (): T }, params?: Record<string, unknown>): T[];
static get<T = Model>(this: { new (): T }, params?: Record<string, unknown>): T;
static find<T = Model>(this: { new (): T }, params?: Options): T[];
static get<T = Model>(this: { new (): T }, params?: Options): T;

constructor(options?: { fill?: boolean });
apply<T = Model>(this: T, model: Record<string, unknown>): Promise<T>;
Expand All @@ -16,7 +32,7 @@ export declare class Model {
}
): Promise<T>;

reload<T = Model>(this: T, params?: Record<string, unknown>): Promise<T>;
reload<T = Model>(this: T, params?: Options): Promise<T>;

validate(): Promise<void>;
_validate(): IterableIterator<Error>;
Expand Down

0 comments on commit 40db09f

Please sign in to comment.