mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 23:07:06 +00:00
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:
committed by
Pranav Senthilnathan
parent
082c406d54
commit
f13238a5d2
@@ -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",
|
||||
|
||||
@@ -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
|
||||
Vendored
-21
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -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');
|
||||
Vendored
-21
@@ -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;
|
||||
}
|
||||
@@ -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"
|
||||
]
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"base-x": "^3.0.6"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@types/base-x": "^1.0.30"
|
||||
}
|
||||
}
|
||||
@@ -15,9 +15,6 @@
|
||||
"paths": {
|
||||
"bs58": [
|
||||
"bs58/v3"
|
||||
],
|
||||
"base-x": [
|
||||
"base-x/v1"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
|
||||
Reference in New Issue
Block a user