diff --git a/src/structure/keyed.ts b/src/structure/keyed.ts index ef9a102..0b9776a 100644 --- a/src/structure/keyed.ts +++ b/src/structure/keyed.ts @@ -20,7 +20,7 @@ class RefSchema implements ISchema> { this.ref = new Ref(key); } - resolve(): void { + resolveReferences(): void { throw new UnresolvedReferenceError( `Tried to resolve a reference directly. Do it through a RefResolver instead.`, ); @@ -76,7 +76,7 @@ class RefResolve implements IRefResolver { } // Since it's not a RefSchema, we assume it can be resolved. - unstableSchema.resolve(this); + unstableSchema.resolveReferences(this); return unstableSchema; } @@ -98,14 +98,14 @@ export class KeyedSchema< this.innerType = innerResolver(new RefSchema(key)); // Automatically resolving after keyed creation. - this.resolve(new RefResolve()); + this.resolveReferences(new RefResolve()); } - resolve(ctx: IRefResolver): void { + resolveReferences(ctx: IRefResolver): void { if (!ctx.hasKey(this.key)) { ctx.register(this.key, this.innerType); - this.innerType.resolve(ctx); + this.innerType.resolveReferences(ctx); } } diff --git a/src/structure/types.ts b/src/structure/types.ts index 408c8bd..b201da3 100644 --- a/src/structure/types.ts +++ b/src/structure/types.ts @@ -100,7 +100,7 @@ export type PropertyDescription = { export interface ISchema { readonly __unwrapped: TUnwrapped; - resolve(ctx: IRefResolver): void; + resolveReferences(ctx: IRefResolver): void; write(output: ISerialOutput, value: Parsed): void; read(input: ISerialInput): Parsed; measure( @@ -119,7 +119,7 @@ export abstract class Schema implements ISchema { readonly __unwrapped!: TUnwrapped; // eslint-disable-next-line @typescript-eslint/no-unused-vars - resolve(ctx: IRefResolver): void { + resolveReferences(ctx: IRefResolver): void { // override this if you need to resolve internal references. } abstract write(output: ISerialOutput, value: Parsed): void;