import { ASTAliasedTypes, ASTEnum, ASTIntersection, ASTNode, ASTObject, ASTUnion, TExtendedTypeKind, Zod2X } from "../../core"; import { IZod2TsOpt } from "./options"; export declare class Zod2Ts extends Zod2X { protected readonly commentKey = "//"; constructor(opt?: IZod2TsOpt); /** * Interfaces are only used as types, so their imports are erased. Classes extend the classes * of other files (layer aliases), which requires the imported file to be loaded first. */ supportsCircularImports(): boolean; protected runAfter(): void; protected runBefore(): void; protected addImportFromFile(filename: string, namespace: string): string; protected getTypeFromExternalNamespace(namespace: string, typeName: string): string; protected addExtendedType(name: string, parentNamespace: string, aliasOf: string, opt?: { type?: "union" | "d-union" | "alias"; isInternal?: boolean; templates?: string; declaredTemplates?: string; }): void; /** * For Layered Modeling. Language options used to declare a type that extends another one. */ protected getExtendedTypeOptions(data: ASTNode, type?: TExtendedTypeKind): { type: TExtendedTypeKind | undefined; templates: string | undefined; declaredTemplates: string | undefined; }; protected getAnyType: () => string; protected getBooleanType: () => string; protected getDateType: () => string; /** Ex: Set */ protected getSetType: (itemType: string) => string; protected getStringType: () => string; /** Ex: [TypeA, TypeB] */ protected getTupleType: (itemsType: string[]) => string; /** Ex: TypeA | TypeB */ protected getUnionType: (itemsType: string[]) => string; /** Ex: TypeA & TypeB */ protected getIntersectionType: (itemsType: string[]) => string; protected getNumberType: () => string; /** Ex: Array> */ protected getArrayType(arrayType: string, arrayDeep: number): string; protected getLiteralStringType(value: string | number, parentEnumNameKey?: [string, string]): string | number; /** Ex: Map */ protected getMapType(keyType: string, valueType: string): string; /** Ex: Record */ protected getRecordType(keyType: string, valueType: string): string; protected transpileAliasedType(data: ASTAliasedTypes): void; /** Ex: * enum { * ItemKey1: 0, // case of nativeEnum * ItemKey2: "ItemValue2" // case of Enum * } */ protected transpileEnum(data: ASTEnum): void; /** Ex: * // Interface output * // Class output if non-object intersection * type TypeC = TypeA & TypeB * * // Class output all-object intersection * class TypeC { * ...attributesTypeA, * ...attributesTypeB * * constructor(data: TypeC) { * ...attributesAssignment * } * } * */ protected transpileIntersection(data: ASTIntersection): void; protected transpileStruct(data: ASTObject): void; /** Ex: * // Interface output * // Class output for Discriminated Union or non-objects union * type TypeC = TypeA | TypeB * * // Class output for all-object Union * class TypeC { * ...attributesTypeA, * ...attributesTypeB * * constructor(data: TypeC) { * ...attributesAssignment * } * } * */ protected transpileUnion(data: ASTUnion): void; /** Ex: * interface MyStruct { * att1: TypeA; * att2?: TypeB; * } * */ private _transpileStructuAsInterface; /** Ex: * class MyStruct { * att1: TypeA; * att2?: TypeB; * * constructor(data: MyStruct) { * this.att1 = data.att1; * this.att2 = data.att2; * } * } * */ private _transpileStructAsClass; /** For Interface/Class attributes. * Ex: attribute1?: TypeA | null */ private _transpileMember; }