diff --git a/packages/util-crypto/src/base32/helpers.ts b/packages/util-crypto/src/base32/helpers.ts index 2ccc1f0e8..d66a8c137 100644 --- a/packages/util-crypto/src/base32/helpers.ts +++ b/packages/util-crypto/src/base32/helpers.ts @@ -1,19 +1,12 @@ // Copyright 2017-2021 @polkadot/util-crypto authors & contributors // SPDX-License-Identifier: Apache-2.0 +import type { U8aLike } from '@polkadot/util/types'; + import { assert, u8aToU8a } from '@polkadot/util'; -// NOTE: Work around a TS issue. These are re-defined like in @polkadot/util/types -// since without it the import -// -// import type { U8aLike } from '@polkadot/util/types'; -// -// ends up in the build-generated code as -// -// impor("../../../util/src/types").U8aLike -// -// eslint-disable-next-line @typescript-eslint/ban-types -type U8aLike = number[] | Buffer | Uint8Array | string | String; +// re-export the type so *.d.ts files don't have ../src imports +export type { U8aLike } from '@polkadot/util/types'; interface Coder { decode: (value: string) => Uint8Array; diff --git a/packages/util-crypto/src/helpers.ts b/packages/util-crypto/src/helpers.ts index 4634ca2bb..2381f4803 100644 --- a/packages/util-crypto/src/helpers.ts +++ b/packages/util-crypto/src/helpers.ts @@ -6,6 +6,9 @@ import type { HexString } from '@polkadot/util/types'; import { hasBigInt, u8aToHex, u8aToU8a } from '@polkadot/util'; import { isReady } from '@polkadot/wasm-crypto'; +// re-export so TS *.d.ts generation is correct +export type { HexString } from '@polkadot/util/types'; + interface DualHash { 256: (u8a: Uint8Array) => Uint8Array; 512: (u8a: Uint8Array) => Uint8Array;