mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
p-fifo: initial definition (#39095)
This commit is contained in:
committed by
Andrew Branch
parent
39224d9428
commit
cc3e615168
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// Type definitions for p-fifo 1.0
|
||||
// Project: https://github.com/alanshaw/p-fifo
|
||||
// Definitions by: Junxiao Shi <https://github.com/yoursunny>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
export = PFifo;
|
||||
|
||||
declare class PFifo<T> {
|
||||
constructor();
|
||||
push(chunk: T): Promise<void>;
|
||||
shift(): Promise<T>;
|
||||
isEmpty(): boolean;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import Fifo = require("p-fifo");
|
||||
|
||||
const fifo = new Fifo<string>();
|
||||
|
||||
(async () => {
|
||||
// $ExpectType void
|
||||
await fifo.push("a");
|
||||
|
||||
// $ExpectError
|
||||
fifo.push(true);
|
||||
|
||||
// $ExpectType string
|
||||
await fifo.shift();
|
||||
})();
|
||||
|
||||
// $ExpectType boolean
|
||||
fifo.isEmpty();
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user