From 4024ad1b37fe5b8839e8151b6b1d703ae4d8da5f Mon Sep 17 00:00:00 2001 From: "Adam A. Zerella" Date: Mon, 25 Feb 2019 14:40:45 +1100 Subject: [PATCH 1/2] Added type defs for CipherBase --- types/cipher-base/cipher-base-tests.ts | 17 +++++++++++++++++ types/cipher-base/index.d.ts | 14 ++++++++++++++ types/cipher-base/tsconfig.json | 25 +++++++++++++++++++++++++ types/cipher-base/tslint.json | 3 +++ 4 files changed, 59 insertions(+) create mode 100644 types/cipher-base/cipher-base-tests.ts create mode 100644 types/cipher-base/index.d.ts create mode 100644 types/cipher-base/tsconfig.json create mode 100644 types/cipher-base/tslint.json diff --git a/types/cipher-base/cipher-base-tests.ts b/types/cipher-base/cipher-base-tests.ts new file mode 100644 index 0000000000..173a72b7f6 --- /dev/null +++ b/types/cipher-base/cipher-base-tests.ts @@ -0,0 +1,17 @@ +import CipherBase from "cipher-base"; + +const buf = new Buffer(1); + +class CipherTest extends CipherBase { + constructor() { + super(); + } + + final() { + return buf; + } + + update(testBuffer: Buffer) { + return testBuffer; + } +} diff --git a/types/cipher-base/index.d.ts b/types/cipher-base/index.d.ts new file mode 100644 index 0000000000..228920ac91 --- /dev/null +++ b/types/cipher-base/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for cipher-base 1.0 +// Project: https://github.com/crypto-browserify/cipher-base +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare abstract class CipherBase { + constructor(hashMode?: string); + abstract final(): Buffer; + abstract update(value: Buffer, inputEnc?: string, outputEnc?: string): Buffer; +} + +export default CipherBase; diff --git a/types/cipher-base/tsconfig.json b/types/cipher-base/tsconfig.json new file mode 100644 index 0000000000..217193ea64 --- /dev/null +++ b/types/cipher-base/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cipher-base-tests.ts" + ] +} diff --git a/types/cipher-base/tslint.json b/types/cipher-base/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/cipher-base/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file From c19c506eb9a6688895537f07267f97d8fbe8e49c Mon Sep 17 00:00:00 2001 From: Adam Zerella Date: Wed, 6 Mar 2019 21:56:07 +1100 Subject: [PATCH 2/2] Updated export type --- types/cipher-base/cipher-base-tests.ts | 2 +- types/cipher-base/index.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/cipher-base/cipher-base-tests.ts b/types/cipher-base/cipher-base-tests.ts index 173a72b7f6..b81238ee98 100644 --- a/types/cipher-base/cipher-base-tests.ts +++ b/types/cipher-base/cipher-base-tests.ts @@ -1,4 +1,4 @@ -import CipherBase from "cipher-base"; +import CipherBase = require("cipher-base"); const buf = new Buffer(1); diff --git a/types/cipher-base/index.d.ts b/types/cipher-base/index.d.ts index 228920ac91..f43ca2cdb9 100644 --- a/types/cipher-base/index.d.ts +++ b/types/cipher-base/index.d.ts @@ -11,4 +11,4 @@ declare abstract class CipherBase { abstract update(value: Buffer, inputEnc?: string, outputEnc?: string): Buffer; } -export default CipherBase; +export = CipherBase;