[express-cluster]: Add types

This commit is contained in:
Miloslav Nenadal 2017-11-10 14:59:14 +01:00
parent 68cd19ffcf
commit f8d259f70b
4 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,6 @@
import * as cluster from 'express-cluster';
() => {
cluster(worker => {}, {count: 5});
cluster({count: 5}, worker => {});
};

26
types/express-cluster/index.d.ts vendored Normal file
View File

@ -0,0 +1,26 @@
// Type definitions for express-cluster 0.0
// Project: https://github.com/Flipboard/express-cluster
// Definitions by: Miloslav Nenadál <https://github.com/nenadalm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import * as cluster from 'cluster';
interface Config {
count?: number;
respawn?: boolean;
verbose?: boolean;
workerListener?(): void;
outputStream?: NodeJS.WritableStream;
}
type WorkerFunction = (worker: cluster.Worker) => void;
interface Cluster {
(fn: WorkerFunction, config: Config): void;
(config: Config, fn: WorkerFunction): void;
}
declare const c: Cluster;
export = c;

View File

@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"express-cluster-tests.ts"
]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }