mirror of
https://github.com/knex/knex.git
synced 2025-12-30 08:37:26 +00:00
fix: mistyping of stream (#4400)
This commit is contained in:
parent
c2b558e79b
commit
767f32e6c9
3
types/index.d.ts
vendored
3
types/index.d.ts
vendored
@ -1737,13 +1737,12 @@ export declare namespace Knex {
|
||||
connection(connection: any): this;
|
||||
debug(enabled: boolean): this;
|
||||
transacting(trx: Transaction): this;
|
||||
stream(): AsyncIterable<ArrayMember<T>>;
|
||||
stream(handler: (readable: stream.PassThrough) => any): Promise<any>;
|
||||
stream(
|
||||
options: Readonly<{ [key: string]: any }>,
|
||||
handler: (readable: stream.PassThrough) => any
|
||||
): Promise<any>;
|
||||
stream(options?: Readonly<{ [key: string]: any }>): stream.PassThrough;
|
||||
stream(options?: Readonly<{ [key: string]: any }>): stream.PassThrough & AsyncIterable<ArrayMember<T>>;
|
||||
pipe<T extends NodeJS.WritableStream>(
|
||||
writable: T,
|
||||
options?: Readonly<{ [key: string]: any }>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
import { knex, Knex } from 'knex';
|
||||
import { PassThrough } from 'stream';
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
@ -132,9 +133,12 @@ const main = async () => {
|
||||
[ null ]
|
||||
);
|
||||
|
||||
// $ExpectType AsyncIterable<User>
|
||||
// $ExpectType PassThrough & AsyncIterable<User>
|
||||
knexInstance<User>('users').select('*').stream();
|
||||
|
||||
// $ExpectType PassThrough
|
||||
knexInstance<User>('users').select('*').stream().pipe(new PassThrough());
|
||||
|
||||
// $ExpectType User[]
|
||||
await knexInstance<User>('user').where('name', ['a', 'b', 'c']);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user