diff --git a/types/p-fifo/index.d.ts b/types/p-fifo/index.d.ts new file mode 100644 index 0000000000..3344efe225 --- /dev/null +++ b/types/p-fifo/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for p-fifo 1.0 +// Project: https://github.com/alanshaw/p-fifo +// Definitions by: Junxiao Shi +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +export = PFifo; + +declare class PFifo { + constructor(); + push(chunk: T): Promise; + shift(): Promise; + isEmpty(): boolean; +} diff --git a/types/p-fifo/p-fifo-tests.ts b/types/p-fifo/p-fifo-tests.ts new file mode 100644 index 0000000000..9769280db4 --- /dev/null +++ b/types/p-fifo/p-fifo-tests.ts @@ -0,0 +1,17 @@ +import Fifo = require("p-fifo"); + +const fifo = new Fifo(); + +(async () => { + // $ExpectType void + await fifo.push("a"); + + // $ExpectError + fifo.push(true); + + // $ExpectType string + await fifo.shift(); +})(); + +// $ExpectType boolean +fifo.isEmpty(); diff --git a/types/p-fifo/tsconfig.json b/types/p-fifo/tsconfig.json new file mode 100644 index 0000000000..f2e88f4ae1 --- /dev/null +++ b/types/p-fifo/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "p-fifo-tests.ts" + ] +} diff --git a/types/p-fifo/tslint.json b/types/p-fifo/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/p-fifo/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }