/** * XsdToTypeScript — XSD → TypeScript interface generator * ───────────────────────────────────────────────────────── * Generates TypeScript interfaces / type aliases from a compiled SchemaModel. * * Supported mappings * ────────────────── * xs:element with complexType → interface * xs:element with simpleType → type alias * xs:complexType (named) → interface * xs:simpleType (named) → type alias * xs:sequence / xs:choice / xs:all → interface members * attributes → interface members (optional or required) * xs:list / xs:union → TypeScript union types * built-in xs: types → TypeScript primitives * minOccurs=0 → optional (?) * maxOccurs=unbounded → Array * * Usage * ───── * import { generateTypeScript, XsdToTypeScript } from 'xml-xsd-engine/codegen'; * * const ts = generateTypeScript(schema); * // ts is a string of TypeScript source code */ import { SchemaModel } from '../schema/SchemaModel'; export interface XsdToTypeScriptOptions { /** * Header comment prepended to generated output. * Default: auto-generated notice. */ header?: string; /** * When true, emit `export` modifier on each declaration. * Default: true */ exportAll?: boolean; /** * Prefix added to every interface/type name. * Default: '' */ typePrefix?: string; /** * Suffix added to every interface/type name. * Default: '' */ typeSuffix?: string; /** * When true, use `type` aliases instead of `interface` for complex types. * Default: false (prefer `interface`) */ useTypeAlias?: boolean; /** * When true, include JSDoc comments with the XSD type name. * Default: true */ jsdoc?: boolean; /** * Number of spaces per indent level. * Default: 2 */ indent?: number; /** * When true, skip built-in XSD simple types (xs:string, xs:integer, …). * Default: true */ skipBuiltins?: boolean; /** * Custom type mapping: XSD type name → TypeScript type string. * Overrides the built-in mapping table. */ typeMap?: Record; } export declare class XsdToTypeScript { private schema; private opts; private typeMap; private emitted; private lines; constructor(schema: SchemaModel, options?: XsdToTypeScriptOptions); generate(): string; private _emitSimpleType; private _emitComplexType; private _emitElementDecl; private _emitParticle; private _simpleTypeToTs; private _resolveTypeName; private _elementDeclToTs; private _attrTypeToTs; private _tsTypeName; private _safeName; } /** * Generate TypeScript interfaces / type aliases from a SchemaModel. * * @example * ```ts * import { parseXsd, generateTypeScript } from 'xml-xsd-engine'; * const schema = parseXsd(xsdSource); * const ts = generateTypeScript(schema, { typePrefix: 'I' }); * console.log(ts); * ``` */ export declare function generateTypeScript(schema: SchemaModel, options?: XsdToTypeScriptOptions): string; /** * P2: Stream TypeScript code generation as an `AsyncIterable`. * Each yielded chunk is a complete top-level declaration (interface or type alias). * Use this for large schemas to avoid holding the entire output in memory. * * @example * ```ts * import { createWriteStream } from 'fs'; * const out = createWriteStream('types.ts'); * for await (const chunk of generateTypeScriptStream(schema)) { * out.write(chunk); * } * out.end(); * ``` */ export declare function generateTypeScriptStream(schema: SchemaModel, options?: XsdToTypeScriptOptions): AsyncGenerator; //# sourceMappingURL=XsdToTypeScript.d.ts.map