diff --git a/index.d.ts b/index.d.ts index cf44d76e9..de3155be6 100644 --- a/index.d.ts +++ b/index.d.ts @@ -54,13 +54,13 @@ export class Client extends events.EventEmitter { connect(callback: EmptyCallback): void; - execute(query: string, params?: ArrayOrObject, options?: QueryOptions): Promise; + execute(query: string, params?: ArrayOrObject, options?: QueryOptions): Promise>; - execute(query: string, params: ArrayOrObject, options: QueryOptions, callback: ValueCallback): void; + execute(query: string, params: ArrayOrObject, options: QueryOptions, callback: ValueCallback>): void; - execute(query: string, params: ArrayOrObject, callback: ValueCallback): void; + execute(query: string, params: ArrayOrObject, callback: ValueCallback>): void; - execute(query: string, callback: ValueCallback): void; + execute(query: string, callback: ValueCallback>): void; executeGraph( traversal: string, @@ -80,34 +80,34 @@ export class Client extends events.EventEmitter { parameters?: { [name: string]: any }, options?: GraphQueryOptions): Promise; - eachRow(query: string, + eachRow(query: string, params: ArrayOrObject, options: QueryOptions, - rowCallback: (n: number, row: types.Row) => void, - callback?: ValueCallback): void; + rowCallback: (n: number, row: types.Row) => void, + callback?: ValueCallback>): void; - eachRow(query: string, + eachRow(query: string, params: ArrayOrObject, - rowCallback: (n: number, row: types.Row) => void, - callback?: ValueCallback): void; + rowCallback: (n: number, row: types.Row) => void, + callback?: ValueCallback>): void; - eachRow(query: string, - rowCallback: (n: number, row: types.Row) => void): void; + eachRow(query: string, + rowCallback: (n: number, row: types.Row) => void): void; stream(query: string, params?: ArrayOrObject, options?: QueryOptions, callback?: EmptyCallback): events.EventEmitter; - batch( + batch( queries: Array, - options?: QueryOptions): Promise; + options?: QueryOptions): Promise>; - batch( + batch( queries: Array, options: QueryOptions, - callback: ValueCallback): void; + callback: ValueCallback>): void; - batch( + batch( queries: Array, - callback: ValueCallback): void; + callback: ValueCallback>): void; shutdown(): Promise; diff --git a/lib/datastax/graph/index.d.ts b/lib/datastax/graph/index.d.ts index b6e860c42..3abb71317 100644 --- a/lib/datastax/graph/index.d.ts +++ b/lib/datastax/graph/index.d.ts @@ -31,7 +31,7 @@ export namespace graph { } class GraphResultSet implements Iterator { - constructor(rs: types.ResultSet); + constructor(rs: types.ResultSet); first(): any; diff --git a/lib/types/index.d.ts b/lib/types/index.d.ts index b03186cf6..8cf4c449d 100644 --- a/lib/types/index.d.ts +++ b/lib/types/index.d.ts @@ -320,7 +320,7 @@ export namespace types { toString(): string; } - interface ResultSet extends Iterable, AsyncIterable { + interface ResultSet extends Iterable>, AsyncIterable> { info: { queriedHost: string, triedHosts: { [key: string]: any; }, @@ -335,9 +335,9 @@ export namespace types { nextPage: (() => void) | null; pageState: string; rowLength: number; - rows: Row[]; + rows: Row[]; - first(): Row; + first(): Row; wasApplied(): boolean; } @@ -349,16 +349,14 @@ export namespace types { add(chunk: Buffer): void; } - interface Row { - get(columnName: string | number): any; + type Row = T & { + get(columnName: K): T[K]; - keys(): string[]; + keys(): (keyof T)[]; - forEach(callback: (row: Row) => void): void; + forEach(callback: (row: Row) => void): void; - values(): any[]; - - [key: string]: any; + values(): T[]; } class TimeUuid extends Uuid { diff --git a/package-lock.json b/package-lock.json index 250f608b1..b3300b2cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1179,4 +1179,4 @@ } } } -} +} \ No newline at end of file