diff --git a/types/unique-hash-stream/index.d.ts b/types/unique-hash-stream/index.d.ts new file mode 100644 index 0000000000..71399359d0 --- /dev/null +++ b/types/unique-hash-stream/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for unique-hash-stream 1.0 +// Project: https://github.com/stream-utils/unique-hash-stream +// Definitions by: BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +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; +} diff --git a/types/unique-hash-stream/tsconfig.json b/types/unique-hash-stream/tsconfig.json new file mode 100644 index 0000000000..44d0966096 --- /dev/null +++ b/types/unique-hash-stream/tsconfig.json @@ -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" + ] +} diff --git a/types/unique-hash-stream/tslint.json b/types/unique-hash-stream/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/unique-hash-stream/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/unique-hash-stream/unique-hash-stream-tests.ts b/types/unique-hash-stream/unique-hash-stream-tests.ts new file mode 100644 index 0000000000..3132f99e1d --- /dev/null +++ b/types/unique-hash-stream/unique-hash-stream-tests.ts @@ -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;