From dbd9ce2952c633fe63ebe9a1a03103ce1a218742 Mon Sep 17 00:00:00 2001 From: Behind The Math Date: Sun, 11 Mar 2018 13:19:15 -0400 Subject: [PATCH 1/4] [sqlite3] Add return type for .verbose() --- types/sqlite3/index.d.ts | 17 +++++++++++++++-- types/sqlite3/sqlite3-tests.ts | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index 921845e5a0..1116cc6388 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for sqlite3 3.1 +// Type definitions for sqlite3 3.1.13 // Project: https://github.com/mapbox/node-sqlite3 // Definitions by: Nick Malaguti // Sumant Manne +// Behind The Math // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -85,4 +86,16 @@ export class Database extends events.EventEmitter { on(event: string, listener: (...args: any[]) => void): this; } -export function verbose(): void; +export function verbose(): sqlite3; + +// tslint:disable-next-line:strict-export-declare-modifiers +interface sqlite3 { + OPEN_READONLY: number; + OPEN_READWRITE: number; + OPEN_CREATE: number; + cached: typeof cached; + RunResult: RunResult; + Statement: typeof Statement; + Database: typeof Database; + verbose(): this; +} diff --git a/types/sqlite3/sqlite3-tests.ts b/types/sqlite3/sqlite3-tests.ts index 4ddfa0a502..cc2ace853c 100644 --- a/types/sqlite3/sqlite3-tests.ts +++ b/types/sqlite3/sqlite3-tests.ts @@ -1,5 +1,5 @@ -import sqlite3 = require('sqlite3'); -sqlite3.verbose(); +import * as sqlite from 'sqlite3'; +const sqlite3 = sqlite.verbose(); let db: sqlite3.Database = new sqlite3.Database('chain.sqlite3', () => {}); From 6d7596886844c498730bf91e34287d62a1459689 Mon Sep 17 00:00:00 2001 From: Behind The Math Date: Sun, 11 Mar 2018 16:10:12 -0400 Subject: [PATCH 2/4] Bug fixes --- types/sqlite3/index.d.ts | 2 +- types/sqlite3/sqlite3-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index 1116cc6388..7461cf82b7 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for sqlite3 3.1.13 +// Type definitions for sqlite3 3.1 // Project: https://github.com/mapbox/node-sqlite3 // Definitions by: Nick Malaguti // Sumant Manne diff --git a/types/sqlite3/sqlite3-tests.ts b/types/sqlite3/sqlite3-tests.ts index cc2ace853c..fe897f73ec 100644 --- a/types/sqlite3/sqlite3-tests.ts +++ b/types/sqlite3/sqlite3-tests.ts @@ -1,7 +1,7 @@ import * as sqlite from 'sqlite3'; const sqlite3 = sqlite.verbose(); -let db: sqlite3.Database = new sqlite3.Database('chain.sqlite3', () => {}); +let db: sqlite.Database = new sqlite3.Database('chain.sqlite3', () => {}); function createDb() { console.log("createDb chain"); From b9596736b01e6d583fee5fff16bac43d8342c998 Mon Sep 17 00:00:00 2001 From: Behind The Math Date: Sat, 17 Mar 2018 21:53:04 -0400 Subject: [PATCH 3/4] Fix indentation --- types/sqlite3/index.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index 7461cf82b7..d4fb7c9599 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -90,12 +90,12 @@ export function verbose(): sqlite3; // tslint:disable-next-line:strict-export-declare-modifiers interface sqlite3 { - OPEN_READONLY: number; - OPEN_READWRITE: number; - OPEN_CREATE: number; + OPEN_READONLY: number; + OPEN_READWRITE: number; + OPEN_CREATE: number; cached: typeof cached; RunResult: RunResult; Statement: typeof Statement; Database: typeof Database; - verbose(): this; + verbose(): this; } From 2efa8936a13d2f8273b04d626658e31f06930780 Mon Sep 17 00:00:00 2001 From: Behind The Math Date: Thu, 22 Mar 2018 15:53:25 -0400 Subject: [PATCH 4/4] Remove the need for lint exception --- types/sqlite3/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/sqlite3/index.d.ts b/types/sqlite3/index.d.ts index d4fb7c9599..8b988b5b22 100644 --- a/types/sqlite3/index.d.ts +++ b/types/sqlite3/index.d.ts @@ -88,8 +88,7 @@ export class Database extends events.EventEmitter { export function verbose(): sqlite3; -// tslint:disable-next-line:strict-export-declare-modifiers -interface sqlite3 { +export interface sqlite3 { OPEN_READONLY: number; OPEN_READWRITE: number; OPEN_CREATE: number;