base-x: Provides its own types (#39654)

* base-x: Provides its own types

* add @types/base-x to bs58/v3
This commit is contained in:
Alexander T
2019-11-15 12:41:20 -08:00
committed by Pranav Senthilnathan
parent 082c406d54
commit f13238a5d2
12 changed files with 18 additions and 124 deletions
+6
View File
@@ -258,6 +258,12 @@
"sourceRepoURL": "http://www.babylonjs.com/",
"asOfVersion": "2.4.1"
},
{
"libraryName": "base-x",
"typingsPackageName": "base-x",
"sourceRepoURL": "https://github.com/cryptocoinjs/base-x",
"asOfVersion": "3.0.6"
},
{
"libraryName": "baconjs",
"typingsPackageName": "baconjs",
-10
View File
@@ -1,10 +0,0 @@
import * as baseX from 'base-x';
const BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
const bs58 = baseX(BASE58);
const decoded = bs58.decode('5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr');
decoded; // $ExpectType Buffer
bs58.decodeUnsafe('5Kd3NBUAdUnhyzenEwVLy9pBKxSwXvE9FMPyR4UKZvpe6E3AgLr'); // $ExpectType Buffer | undefined
bs58.encode(decoded); // $ExpectType string
-21
View File
@@ -1,21 +0,0 @@
// Type definitions for base-x 3.0
// Project: https://github.com/cryptocoinjs/base-x
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
// BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Buffer } from 'buffer';
export = baseX;
declare function baseX(ALPHABET: string): baseX.BaseConverter;
declare namespace baseX {
interface BaseConverter {
encode(buffer: Buffer): string;
decodeUnsafe(string: string): Buffer | undefined;
decode(string: string): Buffer;
}
}
-23
View File
@@ -1,23 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"base-x-tests.ts"
]
}
-3
View File
@@ -1,3 +0,0 @@
{
"extends": "dtslint/dt.json"
}
-12
View File
@@ -1,12 +0,0 @@
import * as basex from 'base-x';
const bs16 = basex('0123456789ABCDEF');
{
let encoded: string;
encoded = bs16.encode([255]);
encoded = bs16.encode({0: 255, length: 1});
}
const decoded: number[] = bs16.decode('FF');
-21
View File
@@ -1,21 +0,0 @@
// Type definitions for base-x 1.0
// Project: https://github.com/cryptocoinjs/base-x
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var BaseX: BaseX.Base;
export = BaseX;
declare namespace BaseX {
interface EncodeBuffer {
[index: number]: number;
length: number;
}
interface BaseConverter {
encode: (buffer: EncodeBuffer) => string;
decode: (string: string) => number[];
}
type Base = (ALPHABET: string) => BaseConverter;
}
-28
View File
@@ -1,28 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"paths": {
"base-x": [
"base-x/v1"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"base-x-tests.ts"
]
}
-3
View File
@@ -1,3 +0,0 @@
{
"extends": "dtslint/dt.json"
}
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"base-x": "^3.0.6"
}
}
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"@types/base-x": "^1.0.30"
}
}
-3
View File
@@ -15,9 +15,6 @@
"paths": {
"bs58": [
"bs58/v3"
],
"base-x": [
"base-x/v1"
]
},
"types": [],