Below is the .d.ts
types that I use.
I'm a newbie with TS, so, maybe is a better way to write it.
declare module "vue-api-query" { import { AxiosInstance, AxiosRequestConfig, AxiosPromise } from "axios"; type ThisClass<InstanceType extends Model> = { new (...args: any[]): InstanceType; }; type Constructor<T> = new (...args: any[]) => T; interface Class<T> { super(...args: any[]): T; } export class Model { constructor(...args: any[]); super: Constructor<this>; static $http: AxiosInstance; $http: AxiosInstance; mutations?: object; /** * Settings */ endpoint(): string; resource(): string; primaryKey(): string; getPrimaryKey(): string; baseURL(): string; request(config: AxiosRequestConfig): AxiosPromise<any>; _from(url: string): void; /** * Query */ append<T extends Model>(this: ThisClass<T>, ...args: any[]): T; custom<T extends Model>(this: ThisClass<T>, ...args: any[]): T; include<T extends Model>(this: ThisClass<T>, ...args: any[]): T; select<T extends Model>(this: ThisClass<T>, ...args: any[]): T; orderBy<T extends Model>(this: ThisClass<T>, ...args: any[]): T; where<T extends Model>(this: ThisClass<T>, field: string, value: any): T; whereIn<T extends Model>( this: ThisClass<T>, field: string, array: any[] ): T; limit<T extends Model>(this: ThisClass<T>, value: number): T; page<T extends Model>(this: ThisClass<T>, value: number): T; params<T extends Model>(this: ThisClass<T>, payload: object): T; for<T extends Model>(this: ThisClass<T>, ...args: any[]): T; hasMany<T>(model: T): T; /** * Results */ $find(identifier: number | string): any; $first(): any; $get(): any; find<T extends Model>( this: ThisClass<T>, identifier: number | string ): Promise<T>; first<T extends Model>(this: ThisClass<T>): Promise<T>; get<T extends Model>(this: ThisClass<T>): Promise<T[]>; delete(): Promise<any>; save<T extends Model>(this: ThisClass<T>): Promise<T>; attach(params: object): Promise<any>; sync(params: object): Promise<any>; /** * Helpers */ hasId(): boolean; isValidId(id: any): boolean; parameterNames(): any; static $find(id: number | string): any; static $first(): any; static $get(): any; static append<T extends Model>(this: ThisClass<T>, ...args: any[]): T; static custom<T extends Model>(this: ThisClass<T>, ...args: any[]): T; static find(id: number | string): Model; static first<T extends Model>(this: ThisClass<T>): T; static get(): any; static include(...args: any[]): Model; static instance<T extends Model>(this: ThisClass<T>): T; static limit(value: any): Model; static orderBy(...args: any[]): Model; static page(value: any): Model; static params<T extends Model>(this: ThisClass<T>, payload: object): T; static select<T extends Model>(this: ThisClass<T>, ...args: any[]): T; static where<T extends Model>( this: ThisClass<T>, field: string, value: any ): T; static whereIn<T extends Model>( this: ThisClass<T>, field: string, array: any[] ): T; } }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4