Swap CodecArg usage to unknown (#3845)

* Swap CodecArg usage to unknown

* Adjust Constructor defintion
This commit is contained in:
Jaco
2021-08-05 12:27:51 +02:00
committed by GitHub
parent 9961595634
commit a80df7d846
12 changed files with 73 additions and 84 deletions
+2 -8
View File
@@ -100,21 +100,15 @@ export interface Codec {
toU8a (isBare?: BareOpts): Uint8Array;
}
// eslint-disable-next-line no-use-before-define
export type CodecArg = Codec | BigInt | BN | boolean | string | Uint8Array | boolean | number | string | undefined | CodecArgArray | { [index: string]: CodecArg };
// We cannot inline this into CodecArg, TS throws up when building docs
// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface CodecArgArray extends Array<CodecArg> {}
export interface Constructor<T = Codec> {
/**
* @description An internal fallback type (previous generation) if encoding fails
*/
readonly __fallbackType?: string;
// NOTE: We need the any[] here, unknown[] does not work as expected
// eslint-disable-next-line @typescript-eslint/no-explicit-any
new(registry: Registry, ...value: any[]): T;
new(registry: Registry, ...args: any[]): T;
}
export type ConstructorDef<T = Codec> = Record<string, Constructor<T>>;