DefinitelyTyped/types/base-x/base-x-tests.ts
2018-12-24 22:56:38 +01:00

11 lines
408 B
TypeScript

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