From fc2b1b6d160e2e5dd9875af312c6705f794fdefc Mon Sep 17 00:00:00 2001 From: Arne Schubert Date: Wed, 11 Sep 2019 16:14:30 +0200 Subject: [PATCH] Create a type definition for npm module ssdeep (#38264) --- types/ssdeep/index.d.ts | 10 ++++++++++ types/ssdeep/ssdeep-tests.ts | 8 ++++++++ types/ssdeep/tsconfig.json | 23 +++++++++++++++++++++++ types/ssdeep/tslint.json | 1 + 4 files changed, 42 insertions(+) create mode 100644 types/ssdeep/index.d.ts create mode 100644 types/ssdeep/ssdeep-tests.ts create mode 100644 types/ssdeep/tsconfig.json create mode 100644 types/ssdeep/tslint.json diff --git a/types/ssdeep/index.d.ts b/types/ssdeep/index.d.ts new file mode 100644 index 0000000000..f8ade9f2b2 --- /dev/null +++ b/types/ssdeep/index.d.ts @@ -0,0 +1,10 @@ +// Type definitions for ssdeep 0.1 +// Project: https://github.com/pchaigno/node-ssdeep +// Definitions by: Arne Schubert +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export function compare(hash1: string, hash2: string): number; + +export function hash(content: string): string; + +export function hash_from_file(path: string): string; diff --git a/types/ssdeep/ssdeep-tests.ts b/types/ssdeep/ssdeep-tests.ts new file mode 100644 index 0000000000..cdcbcaf3e8 --- /dev/null +++ b/types/ssdeep/ssdeep-tests.ts @@ -0,0 +1,8 @@ +import { compare, hash, hash_from_file } from 'ssdeep'; + +let str = 'string'; +let num = 123; + +num = compare(str, str); +str = hash(str); +str = hash_from_file(str); diff --git a/types/ssdeep/tsconfig.json b/types/ssdeep/tsconfig.json new file mode 100644 index 0000000000..4360d2906f --- /dev/null +++ b/types/ssdeep/tsconfig.json @@ -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", + "ssdeep-tests.ts" + ] +} diff --git a/types/ssdeep/tslint.json b/types/ssdeep/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/ssdeep/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }