mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
add types of http-server (#20394)
* add types of http-server * add strictFunctionTypes * fix lint
This commit is contained in:
parent
0a21515501
commit
b4b8c2f7d3
6
types/http-server/http-server-tests.ts
Normal file
6
types/http-server/http-server-tests.ts
Normal file
@ -0,0 +1,6 @@
|
||||
import { createServer } from "http-server";
|
||||
|
||||
const server = createServer();
|
||||
server.listen(8000);
|
||||
|
||||
server.close();
|
||||
30
types/http-server/index.d.ts
vendored
Normal file
30
types/http-server/index.d.ts
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
// Type definitions for http-server 0.10
|
||||
// Project: https://github.com/indexzero/http-server#readme
|
||||
// Definitions by: York Yao <https://github.com/plantain-00>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as http from "http";
|
||||
import * as https from "https";
|
||||
import { HandleFunction } from "connect";
|
||||
|
||||
export function createServer(options?: Options): http.Server | https.Server;
|
||||
|
||||
export interface Options {
|
||||
root?: string;
|
||||
headers?: { [name: string]: string };
|
||||
cache?: number;
|
||||
showDir?: boolean | "false";
|
||||
autoIndex?: boolean | "false";
|
||||
showDotfiles?: boolean;
|
||||
gzip?: boolean;
|
||||
contentType?: string;
|
||||
ext?: boolean;
|
||||
before?: HandleFunction[];
|
||||
// tslint:disable-next-line prefer-method-signature
|
||||
logFn?: (req: http.IncomingMessage, res: http.ServerResponse, err: Error) => void;
|
||||
cors?: boolean;
|
||||
corsHeaders?: string;
|
||||
robots?: string | true;
|
||||
proxy?: string;
|
||||
https?: https.ServerOptions;
|
||||
}
|
||||
23
types/http-server/tsconfig.json
Normal file
23
types/http-server/tsconfig.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"http-server-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/http-server/tslint.json
Normal file
1
types/http-server/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user