Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typings for Typescript [feature request] #5

Closed
erichiller opened this issue May 25, 2016 · 2 comments
Closed

Typings for Typescript [feature request] #5

erichiller opened this issue May 25, 2016 · 2 comments

Comments

@erichiller
Copy link

Typings for Typescript would be tremendous!

@tenry92
Copy link

tenry92 commented Jul 16, 2016

I've created a local definitions file for myself at the moment. It may not conform the guidelines from DefinitelyTyped or whatever, and not 100 % correct / complete yet, but I can work with it for now.

Feel free to update or publish this code.

declare module 'sqlite' {
  class Database {
    open(fileName: string, options?: OpenOptions): Promise<Database>;
    close(): Promise<void>;
    run(query: string, ...params: any[]): Promise<RunExecResult>;
    get(query: string, ...params: any[]): Promise<Object>;
    all(query: string, ...params: any[]): Promise<Object[]>;
    exec(query: string): Promise<Database>;
    each(query: string, ...params: any[]): Promise<Statement>;
  }

  interface OpenOptions {
    mode?: string;
    verbose?: boolean;
  }

  class Statement {
    bind(...params: any[]): Promise<Statement>;
    reset(): Promise<Statement>;
    finalize(): Promise<Statement>;
    run(...params: any[]): Promise<RunExecResult>;
    get(...params: any[]): Promise<Statement>;
    all(...params: any[]): Promise<Statement>;
    each(...params: any[]): Promise<number>;
  }

  interface RunExecResult {
    lastID?: number;
    changes?: number;
  }

  export = new Database;
}

@villesinisalo
Copy link

Seems to be resolved by #21

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

No branches or pull requests

4 participants