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:
Brian Donovan
2018-07-06 10:31:37 -07:00
committed by Mohamed Hegazy
parent 651e050863
commit 5b02b39251
2 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -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) => {
+3 -3
View File
@@ -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>;
}