Skip to content

Commit

Permalink
Fix return type annotations for the random() method
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidTimms authored Jan 8, 2025
1 parent be5a1b3 commit cbcdd5c
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export class Type {
fromString(str: string): any;
inspect(): string;
isValid(val: any, opts?: Partial<IsValidOptions>): boolean;
random(): Type;
random(): unknown;
schema(opts?: Partial<SchemaOptions>): Schema;
toBuffer(value: any): Uint8Array;
toJSON(): object;
Expand Down Expand Up @@ -239,44 +239,44 @@ export namespace types {
class ArrayType extends Type {
constructor(schema: Schema, opts: any);
readonly itemsType: Type;
random(): ArrayType;
random(): unknown[];
}

class BooleanType extends Type { // TODO: Document this on the wiki
constructor();
random(): BooleanType;
random(): boolean;
}

class BytesType extends Type { // TODO: Document this on the wiki
constructor();
random(): BytesType;
random(): Uint8Array;
}

class DoubleType extends Type { // TODO: Document this on the wiki
constructor();
random(): DoubleType;
random(): number;
}

class EnumType extends Type {
constructor(schema: Schema, opts?: any);
readonly symbols: string[];
random(): EnumType;
random(): string;
}

class FixedType extends Type {
constructor(schema: Schema, opts?: any);
readonly size: number;
random(): FixedType;
random(): Uint8Array;
}

class FloatType extends Type {
constructor();
random(): FloatType;
random(): number;
}

class IntType extends Type {
constructor();
random(): IntType;
random(): number;
}

class LogicalType extends Type {
Expand All @@ -286,32 +286,32 @@ export namespace types {
protected _fromValue(val: any): any;
protected _resolve(type: Type): any;
protected _toValue(any: any): any;
random(): LogicalType;
random(): unknown;
}

class LongType extends Type {
constructor();
random(): LongType;
random(): number;
static __with(methods: object, noUnpack?: boolean): LongType;
}

class MapType extends Type {
constructor(schema: Schema, opts?: any);
readonly valuesType: any;
random(): MapType;
random(): Record<string, unknown>;
}

class NullType extends Type { // TODO: Document this on the wiki
constructor();
random(): NullType;
random(): null;
}

class RecordType extends Type {
constructor(schema: Schema, opts?: any);
readonly fields: Field[];
readonly recordConstructor: any; // TODO: typeof Record once Record interface/class exists
field(name: string): Field;
random(): RecordType;
random(): object;
}

class Field {
Expand All @@ -324,18 +324,18 @@ export namespace types {

class StringType extends Type { // TODO: Document this on the wiki
constructor();
random(): StringType;
random(): string;
}

class UnwrappedUnionType extends Type {
constructor(schema: Schema, opts: any);
random(): UnwrappedUnionType;
random(): unknown;
readonly types: Type[];
}

class WrappedUnionType extends Type {
constructor(schema: Schema, opts: any);
random(): WrappedUnionType;
random(): Record<string, unknown>;
readonly types: Type[];
}
}

0 comments on commit cbcdd5c

Please sign in to comment.