mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
[unique-hash-stream] add typings
This commit is contained in:
16
types/unique-hash-stream/index.d.ts
vendored
Normal file
16
types/unique-hash-stream/index.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// Type definitions for unique-hash-stream 1.0
|
||||
// Project: https://github.com/stream-utils/unique-hash-stream
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
import { Transform } from 'stream';
|
||||
|
||||
export = UniqueFactory;
|
||||
|
||||
declare function UniqueFactory(hashingFn?: (doc: any) => string): Transform;
|
||||
|
||||
declare namespace UniqueFactory {
|
||||
const Unique: typeof Transform;
|
||||
function calculate(doc: any): string;
|
||||
}
|
||||
22
types/unique-hash-stream/tsconfig.json
Normal file
22
types/unique-hash-stream/tsconfig.json
Normal 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",
|
||||
"unique-hash-stream-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/unique-hash-stream/tslint.json
Normal file
1
types/unique-hash-stream/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
12
types/unique-hash-stream/unique-hash-stream-tests.ts
Normal file
12
types/unique-hash-stream/unique-hash-stream-tests.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import unique = require('unique-hash-stream');
|
||||
|
||||
const stream = unique();
|
||||
unique(doc => {
|
||||
doc; // $ExpectType any
|
||||
return 'foo';
|
||||
});
|
||||
stream; // $ExpectType Transform
|
||||
unique.Unique; // $ExpectType typeof Transform
|
||||
unique.calculate; // $ExpectType (doc: any) => string
|
||||
|
||||
stream instanceof unique.Unique;
|
||||
Reference in New Issue
Block a user