Skip to content
This repository has been archived by the owner on Feb 10, 2022. It is now read-only.

Type definition for intellisense #207

Open
wesleycoder opened this issue Jan 31, 2018 · 1 comment
Open

Type definition for intellisense #207

wesleycoder opened this issue Jan 31, 2018 · 1 comment

Comments

@wesleycoder
Copy link

I use VSCode and i supports intellisense.
But Mongorito doesn't expose type definitions yet.

So I'm requesting it here.

You could expose it through the DefinitelyTyped project

@adieuadieu
Copy link
Contributor

adieuadieu commented Jan 31, 2018

Here's an incomplete head start:

declare module 'mongorito' {
  export const DBRef
  export const ObjectId
  export const Database

  export class Model {
    constructor(initialData: { [key: string]: any })
    public get(field?: string): any
    public set(field: string | any, value?: any): any
    public save(fields?: { [key: string]: any }): Promise<any>
    public collection(): string
    public static query(
      method: string,
      queries: ReadonlyArray<any>,
    ): Promise<any>
    public static include(fields?: ReadonlyArray<string>): any
    public static find(query?: { [key: string]: any }): Promise<Model>
    public static findOne(query?: { [key: string]: any }): Promise<Model>
    public static findById(id: ObjectId): Promise<Model>
  }
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants