Bump dev (w/ ts-eslint updates) (#5691)

This commit is contained in:
Jaco
2023-08-16 11:00:52 +03:00
committed by GitHub
parent 319535a1e9
commit d8136a8e61
73 changed files with 358 additions and 268 deletions
+2 -4
View File
@@ -10,9 +10,7 @@ import { mapToTypeMap, typesToMap } from '../utils/index.js';
import { Null } from './Null.js';
// export interface, this is used in Enum.with, so required as public by TS
export interface EnumCodecClass<T = Codec> {
new(registry: Registry, value?: any, index?: number): T;
}
export type EnumCodecClass<T = Codec> = new(registry: Registry, value?: any, index?: number) => T;
interface Definition {
def: TypesDef;
@@ -90,7 +88,7 @@ function extractDef (registry: Registry, _def: Record<string, string | CodecClas
function getEntryType (def: TypesDef, checkIdx: number): CodecClass {
const values = Object.values(def);
for (let i = 0; i < values.length; i++) {
for (let i = 0, count = values.length; i < count; i++) {
const { Type, index } = values[i];
if (index === checkIdx) {
+1 -3
View File
@@ -10,9 +10,7 @@ import { decodeU8a, mapToTypeMap, typesToConstructors, typeToConstructor } from
type TupleType = (CodecClass | string);
type TupleTypes = TupleType[] | {
[index: string]: CodecClass | string;
};
type TupleTypes = TupleType[] | Record<string, CodecClass | string>;
type Definition = [CodecClass[], string[]];
+1 -1
View File
@@ -118,7 +118,7 @@ describe('Vec', (): void => {
});
it('exposes a working forEach', (): void => {
const result: { [index: number]: string } = {};
const result: Record<number, string> = {};
vector.forEach((e, i): void => {
result[i] = e.toString();
+1 -1
View File
@@ -9,7 +9,7 @@ import { Raw } from '../native/Raw.js';
/** @internal */
function decodeBitVecU8a (value?: Uint8Array): [number, Uint8Array] {
if (!value || !value.length) {
if (!value?.length) {
return [0, new Uint8Array()];
}
@@ -40,7 +40,7 @@ export class OptionBool extends Option<Bool> {
* @description The length of the value when encoded as a Uint8Array
*/
public override get encodedLength (): number {
return 1;
return 1 | 0;
}
/**
+1 -1
View File
@@ -35,7 +35,7 @@ export class bool extends Boolean implements Codec {
* @description The length of the value when encoded as a Uint8Array
*/
public get encodedLength (): number {
return 1;
return 1 | 0;
}
/**
+1 -1
View File
@@ -42,7 +42,7 @@ export class Json extends Map<string, any> implements Codec {
* @description Always 0, never encodes as a Uint8Array
*/
public get encodedLength (): number {
return 0;
return 0 | 0;
}
/**
+1 -1
View File
@@ -225,7 +225,7 @@ export class Struct<
/**
* @description Returns the a types value by name
*/
public getT <T> (key: string): T {
public getT <T = Codec> (key: string): T {
return super.get(key) as unknown as T;
}