mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-02 06:29:40 +08:00
feat(types/cloneable-readable): add new types (#25570)
This commit is contained in:
11
types/cloneable-readable/cloneable-readable-tests.ts
Normal file
11
types/cloneable-readable/cloneable-readable-tests.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { PassThrough } from 'stream';
|
||||
import cloneable = require('cloneable-readable');
|
||||
|
||||
const ps = new PassThrough(); // $ExpectType PassThrough
|
||||
const cl = cloneable(ps); // $ExpectType Cloneable<PassThrough>
|
||||
|
||||
process.stdin.pipe(cl.clone()).pipe(process.stderr);
|
||||
process.stdin.pipe(cl).pipe(process.stdout);
|
||||
|
||||
cloneable.isCloneable(ps); // $ExpectType boolean
|
||||
cloneable.isCloneable(cl); // $ExpectType boolean
|
||||
17
types/cloneable-readable/index.d.ts
vendored
Normal file
17
types/cloneable-readable/index.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Type definitions for cloneable-readable 1.1
|
||||
// Project: https://github.com/mcollina/cloneable-readable#readme
|
||||
// Definitions by: Nikita Volodin <https://github.com/qlonik>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
/// <reference types="node"/>
|
||||
|
||||
import { Readable } from 'stream';
|
||||
|
||||
type Cloneable<T> = T & { clone(): Cloneable<T> };
|
||||
interface CloneableFn {
|
||||
<T extends Readable>(x: T): Cloneable<T>;
|
||||
isCloneable(x: Readable): boolean;
|
||||
}
|
||||
declare const cloneable: CloneableFn;
|
||||
export = cloneable;
|
||||
23
types/cloneable-readable/tsconfig.json
Normal file
23
types/cloneable-readable/tsconfig.json
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"cloneable-readable-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/cloneable-readable/tslint.json
Normal file
1
types/cloneable-readable/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user