mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 17:20:09 +00:00
s3rver: make error optional in callback signature (#40974)
* s3rver: make error potentially null in callback signature * s3rver: returns itself when run is called with a callback * Add signature for close method
This commit is contained in:
9
types/s3rver/index.d.ts
vendored
9
types/s3rver/index.d.ts
vendored
@@ -7,9 +7,6 @@
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
|
||||
import * as http from "http";
|
||||
|
||||
declare class S3rver {
|
||||
constructor(options: S3rverOptions)
|
||||
setPort(port: number): S3rver;
|
||||
@@ -18,8 +15,12 @@ declare class S3rver {
|
||||
setSilent(silent: boolean): S3rver;
|
||||
setIndexDocument(indexDocument: string): S3rver;
|
||||
setErrorDocument(errorDocument: string): S3rver;
|
||||
run(callback: (error: Error, hostname: string, port: number, directory: string) => void): http.Server;
|
||||
run(callback: (error: Error | null, hostname: string, port: number, directory: string) => void): S3rver;
|
||||
run(): Promise<string>;
|
||||
close(): Promise<void>;
|
||||
// Should return S3rver, but doesn't in all cases, currently
|
||||
// See https://github.com/jamhall/s3rver/pull/571
|
||||
close(callback: (error: Error | null) => void): void;
|
||||
}
|
||||
|
||||
interface S3rverOptions {
|
||||
|
||||
@@ -10,6 +10,7 @@ var s3rver = new S3rver({
|
||||
}).run((err, hostname, port, directory) => {});
|
||||
|
||||
s3rver.close();
|
||||
s3rver.close(e => console.log(e));
|
||||
|
||||
// using new options
|
||||
import fs = require('fs');
|
||||
|
||||
Reference in New Issue
Block a user