@jsonjoy.com/json-type
Version:
High-performance JSON Pointer implementation
22 lines (21 loc) • 1.62 kB
TypeScript
import type { Codegen } from '@jsonjoy.com/codegen';
import type { JsExpression } from '@jsonjoy.com/codegen/lib/util/JsExpression';
import type { AnyType, ArrType, BinType, BoolType, ConType, MapType, NumType, ObjType, KeyType, OrType, RefType, StrType, Type } from '../type';
import type { SchemaPath } from './types';
export declare abstract class AbstractCodegen<Fn extends (...deps: any[]) => any = (...deps: unknown[]) => unknown> {
abstract readonly codegen: Codegen<Fn>;
protected abstract onAny(path: SchemaPath, r: JsExpression, type: AnyType): void;
protected abstract onCon(path: SchemaPath, r: JsExpression, type: ConType): void;
protected abstract onBool(path: SchemaPath, r: JsExpression, type: BoolType): void;
protected abstract onNum(path: SchemaPath, r: JsExpression, type: NumType): void;
protected abstract onStr(path: SchemaPath, r: JsExpression, type: StrType): void;
protected abstract onBin(path: SchemaPath, r: JsExpression, type: BinType): void;
protected abstract onArr(path: SchemaPath, r: JsExpression, type: ArrType): void;
protected abstract onObj(path: SchemaPath, r: JsExpression, type: ObjType): void;
protected abstract onKey(path: SchemaPath, r: JsExpression, type: KeyType<any, any>): void;
protected abstract onMap(path: SchemaPath, r: JsExpression, type: MapType): void;
protected abstract onRef(path: SchemaPath, r: JsExpression, type: RefType): void;
protected abstract onOr(path: SchemaPath, r: JsExpression, type: OrType): void;
compile(): Fn;
protected onNode(path: SchemaPath, r: JsExpression, type: Type): void;
}