From 8ebdc9eaa4b05098695b0744c53ad0bd5e50ec54 Mon Sep 17 00:00:00 2001 From: Dimitri Benin Date: Mon, 24 Dec 2018 23:33:59 +0100 Subject: [PATCH] [bs58] Update types to v4 --- types/bs58/bs58-tests.ts | 8 ++++ types/bs58/index.d.ts | 11 ++++++ types/bs58/tsconfig.json | 23 +++++++++++ types/bs58/tslint.json | 3 ++ types/bs58/v3/bs58-tests.ts | 3 +- types/bs58/v3/index.d.ts | 2 +- types/bs58/v3/tsconfig.json | 2 +- types/bs58/v3/tslint.json | 78 +------------------------------------ 8 files changed, 49 insertions(+), 81 deletions(-) create mode 100644 types/bs58/bs58-tests.ts create mode 100644 types/bs58/index.d.ts create mode 100644 types/bs58/tsconfig.json create mode 100644 types/bs58/tslint.json diff --git a/types/bs58/bs58-tests.ts b/types/bs58/bs58-tests.ts new file mode 100644 index 0000000000..f484122683 --- /dev/null +++ b/types/bs58/bs58-tests.ts @@ -0,0 +1,8 @@ +import bs58 = require('bs58'); + +const bytes = Buffer.from('003c176e659bea0f29a3e9bf7880c112b1b31b4dc826268187', 'hex'); +const address = bs58.encode(bytes); +address; // $ExpectType string + +bs58.decode(address); // $ExpectType Buffer +bs58.decodeUnsafe(address); // $ExpectType Buffer | undefined diff --git a/types/bs58/index.d.ts b/types/bs58/index.d.ts new file mode 100644 index 0000000000..2915e15dfe --- /dev/null +++ b/types/bs58/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for bs58 4.0 +// Project: https://github.com/cryptocoinjs/bs58 +// Definitions by: Ilya Mochalov +// BendingBender +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import { BaseConverter } from 'base-x'; + +declare const base58: BaseConverter; + +export = base58; diff --git a/types/bs58/tsconfig.json b/types/bs58/tsconfig.json new file mode 100644 index 0000000000..1f9d6fcc87 --- /dev/null +++ b/types/bs58/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bs58-tests.ts" + ] +} diff --git a/types/bs58/tslint.json b/types/bs58/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/bs58/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/bs58/v3/bs58-tests.ts b/types/bs58/v3/bs58-tests.ts index 5fe3b73675..4b2f7891e7 100644 --- a/types/bs58/v3/bs58-tests.ts +++ b/types/bs58/v3/bs58-tests.ts @@ -1,4 +1,3 @@ - import * as bs58 from 'bs58'; { @@ -8,4 +7,4 @@ import * as bs58 from 'bs58'; encoded = bs58.encode({0: 255, length: 1}); } -let decoded: number[] = bs58.decode('5Q'); +const decoded: number[] = bs58.decode('5Q'); diff --git a/types/bs58/v3/index.d.ts b/types/bs58/v3/index.d.ts index bb0ef823e6..c976588bc1 100644 --- a/types/bs58/v3/index.d.ts +++ b/types/bs58/v3/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bs58 3.0.0 +// Type definitions for bs58 3.0 // Project: https://github.com/cryptocoinjs/bs58 // Definitions by: Ilya Mochalov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/bs58/v3/tsconfig.json b/types/bs58/v3/tsconfig.json index 05d4ae7788..e7f77ce6b4 100644 --- a/types/bs58/v3/tsconfig.json +++ b/types/bs58/v3/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../../", "typeRoots": [ diff --git a/types/bs58/v3/tslint.json b/types/bs58/v3/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/bs58/v3/tslint.json +++ b/types/bs58/v3/tslint.json @@ -1,79 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } + "extends": "dtslint/dt.json" }