mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
Use void instead of undefined to represent lack of value. (#27106)
Using undefined means async functions must have a `return undefined;` rather than omitting the return value altogether, as would be the most natural thing to do in such functions.
This commit is contained in:
committed by
Mohamed Hegazy
parent
651e050863
commit
5b02b39251
@@ -11,8 +11,8 @@ const factory = {
|
||||
resolve(conn);
|
||||
});
|
||||
},
|
||||
destroy: (conn: Connection): Promise<undefined> => {
|
||||
return new Promise<undefined>(resolve => {
|
||||
destroy: (conn: Connection): Promise<void> => {
|
||||
return new Promise<void>(resolve => {
|
||||
conn.connected = false;
|
||||
resolve();
|
||||
});
|
||||
@@ -53,7 +53,7 @@ pool.acquire()
|
||||
return pool.destroy(conn);
|
||||
}).then(() => {
|
||||
return pool.clear();
|
||||
}).then((results: undefined[]) => {
|
||||
}).then(() => {
|
||||
});
|
||||
|
||||
pool.on('factoryCreateError', (err: Error) => {
|
||||
|
||||
Vendored
+3
-3
@@ -20,14 +20,14 @@ export class Pool<T> extends EventEmitter {
|
||||
acquire(priority?: number): PromiseLike<T>;
|
||||
release(resource: T): void;
|
||||
destroy(resource: T): void;
|
||||
drain(): PromiseLike<undefined>;
|
||||
clear(): PromiseLike<undefined[]>;
|
||||
drain(): PromiseLike<void>;
|
||||
clear(): PromiseLike<void>;
|
||||
use<U>(cb: (resource: T) => U): PromiseLike<U>;
|
||||
}
|
||||
|
||||
export interface Factory<T> {
|
||||
create(): PromiseLike<T>;
|
||||
destroy(client: T): PromiseLike<undefined>;
|
||||
destroy(client: T): PromiseLike<void>;
|
||||
validate?(client: T): PromiseLike<boolean>;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user