seagull-js / seagull-cli

The best way to start, develop and deploy Seagull Apps.
https://seagull-js.github.io/seagull-cli/
GNU Lesser General Public License v3.0
2 stars 0 forks source link

autocompletion of static methods from the model class #36

Open Harper04 opened 6 years ago

Harper04 commented 6 years ago

The types definition seems to be correct:

export default class Model {
    static readsPerSecond: number;
    static writesPerSecond: number;
    static all<T extends Model>(this: {
        new (): T;
    }): Promise<T[]>;
    static clear<T extends Model>(): Promise<number>;
    static create<T extends Model>(this: {
        new (): T;
    }, data: any): Promise<T>;
    static find<T extends Model>(this: {
        new (): T;
    }, id: string): Promise<T>;
    static remove<T extends Model>(id: string): Promise<boolean>;
...
}

But for a simple class:

export default class Measurement extends Model {
  @field channel: string
  @field timestamp: number = new Date().getTime()
  @field temperature: number
}

i only get the static variables... image

Harper04 commented 6 years ago

maybe just a typescript bug after all; if you type it typescript is able to identify the method

bildschirmfoto 2018-03-17 um 08 10 49