Adjust object index typings (#5671)

* Adjust object index typings

* CHANGELOG

* Remove dot-notation overrides

* Align overrides

* Ordering

* Revert lint formatting changes

* Bump common
This commit is contained in:
Jaco
2023-06-11 09:58:20 +03:00
committed by GitHub
parent edde226740
commit c277b3d865
90 changed files with 581 additions and 471 deletions
+3 -3
View File
@@ -21,14 +21,14 @@
"version": "10.8.1",
"main": "index.js",
"dependencies": {
"@polkadot/util": "^12.2.2",
"@polkadot/x-bigint": "^12.2.2",
"@polkadot/util": "^12.3.1",
"@polkadot/x-bigint": "^12.3.1",
"tslib": "^2.5.3"
},
"devDependencies": {
"@polkadot/types": "10.8.1",
"@polkadot/types-augment": "10.8.1",
"@polkadot/types-support": "10.8.1",
"@polkadot/util-crypto": "^12.2.2"
"@polkadot/util-crypto": "^12.3.1"
}
}
+2 -2
View File
@@ -379,8 +379,8 @@ describe('Enum', (): void => {
const type = new Enum(registry, { A: Text, B: U32, C: U32 }).toRawType();
const value = registry.createType(type, { B: 123 });
expect((value as unknown as Record<string, unknown>).isB).toEqual(true);
expect((value as unknown as Record<string, U32>).asB.toNumber()).toEqual(123);
expect((value as unknown as { isB: boolean }).isB).toEqual(true);
expect((value as unknown as { asB: U32 }).asB.toNumber()).toEqual(123);
});
});
+1 -1
View File
@@ -45,7 +45,7 @@ ${formatFixed(micro).padStart(NUM_PAD + PRE_PAD + 1)} μs/op`;
}
export function perf (name: string, count: number, inputs: unknown[][], exec: ExecFn): void {
const test = process.env.GITHUB_REPOSITORY
const test = process.env['GITHUB_REPOSITORY']
? it.skip
: it;
+2 -4
View File
@@ -117,15 +117,13 @@ export interface Codec {
toU8a (isBare?: BareOpts): Uint8Array;
}
export interface CodecClass<T = Codec> {
export interface CodecClass<T = Codec, A extends unknown[] = any[]> {
/**
* @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, ...args: any[]): T;
new(registry: Registry, ...args: A): T;
}
export interface CodecObject<T extends ToString> extends Codec {