UNPKG

@jsonjoy.com/json-type

Version:

High-performance JSON Pointer implementation

23 lines (22 loc) 886 B
import { Codegen } from '@jsonjoy.com/util/lib/codegen'; import type { TypeSystem } from '../../system'; import type { Type } from '../../type'; import type { json_string } from '@jsonjoy.com/util/lib/json-brand'; export type JsonEncoderFn = <T>(value: T) => json_string<T>; export interface JsonTextEncoderCodegenContextOptions { /** Type for which to generate the encoder. */ type: Type; /** Type system to use for alias and validator resolution. */ system?: TypeSystem; name?: string; } export declare class JsonTextEncoderCodegenContext { readonly options: JsonTextEncoderCodegenContextOptions; readonly codegen: Codegen<JsonEncoderFn>; constructor(options: JsonTextEncoderCodegenContextOptions); js(js: string): void; writeText(str: string): void; protected base64Linked: boolean; linkBase64(): void; compile(): JsonEncoderFn; }