[unique-hash-stream] add typings

This commit is contained in:
Dimitri Benin
2017-08-18 13:30:12 +02:00
parent 7ad5650b35
commit c10d419da7
4 changed files with 51 additions and 0 deletions

16
types/unique-hash-stream/index.d.ts vendored Normal file
View 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;
}

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",
"unique-hash-stream-tests.ts"
]
}

View File

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

View 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;