import { ArrayType, ComplexType, DataType, EnumType, MappedType, MixinType, SimpleType, UnionType } from '@opra/common'; import { CodeBlock } from '../../code-block.js'; import { TsFile } from '../ts-file.js'; import type { TsGenerator } from '../ts-generator.js'; type Intent = 'root' | 'extends' | 'typeDef'; export type generateDataTypeResult = { kind: 'internal'; typeName: string; } | { kind: 'named'; typeName: string; file: TsFile; } | { kind: 'embedded'; code: string; }; /** * Generates TypeScript code for a given data type. * * @param dataType - The data type to generate code for. * @param intent - The generation intent (root, extends, typeDef). * @param currentFile - The current file being generated. * @returns A promise that resolves to the generation result. * @throws {@link TypeError} If currentFile is not provided for embedded generation. */ export declare function generateDataType(this: TsGenerator, dataType: DataType, intent: Intent, currentFile?: TsFile): Promise; /** * Generates the TypeScript type definition for a data type. * * @param currentFile - The current file being generated. * @param dataType - The data type to generate code for. * @param codeBlock - The code block to add the generated code to. * @param intent - The generation intent. * @throws {@link TypeError} If name is required but not provided. */ export declare function _generateTypeCode(this: TsGenerator, currentFile: TsFile, dataType: DataType, codeBlock: CodeBlock, intent?: Intent): Promise; /** * Generates code for an array type. * * @param currentFile - The current file being generated. * @param dataType - The array data type. * @param codeBlock - The code block to add the generated code to. * @param intent - The generation intent. * @throws {@link TypeError} If array type is attempted to be extended. */ export declare function _generateArrayTypeCode(this: TsGenerator, currentFile: TsFile, dataType: ArrayType, codeBlock: CodeBlock, intent?: Intent): Promise; /** * Generates code for a complex type. * * @param currentFile - The current file being generated. * @param dataType - The complex data type. * @param codeBlock - The code block to add the generated code to. * @param intent - The generation intent. */ export declare function _generateComplexTypeCode(this: TsGenerator, currentFile: TsFile, dataType: ComplexType, codeBlock: CodeBlock, intent?: Intent): Promise; /** * Generates code for an enum type. * * @param currentFile - The current file being generated. * @param dataType - The enum data type. * @param codeBlock - The code block to add the generated code to. * @param intent - The generation intent. */ export declare function _generateEnumTypeCode(this: TsGenerator, currentFile: TsFile, dataType: EnumType, codeBlock: CodeBlock, intent?: Intent): Promise; /** * Generates code for a mapped type. * * @param currentFile - The current file being generated. * @param dataType - The mapped data type. * @param codeBlock - The code block to add the generated code to. * @param intent - The generation intent. */ export declare function _generateMappedTypeCode(this: TsGenerator, currentFile: TsFile, dataType: MappedType, codeBlock: CodeBlock, intent?: Intent): Promise; /** * Generates code for a mixin type. * * @param currentFile - The current file being generated. * @param dataType - The mixin data type. * @param codeBlock - The code block to add the generated code to. * @param intent - The generation intent. */ export declare function _generateMixinTypeCode(this: TsGenerator, currentFile: TsFile, dataType: MixinType, codeBlock: CodeBlock, intent?: Intent): Promise; /** * Generates code for a simple type. * * @param currentFile - The current file being generated. * @param dataType - The simple data type. * @param codeBlock - The code block to add the generated code to. * @param intent - The generation intent. */ export declare function _generateSimpleTypeCode(this: TsGenerator, currentFile: TsFile, dataType: SimpleType, codeBlock: CodeBlock, intent?: Intent): Promise; /** * Generates code for a union type. * * @param currentFile - The current file being generated. * @param dataType - The union data type. * @param codeBlock - The code block to add the generated code to. * @param intent - The generation intent. * @throws {@link TypeError} If union type is attempted to be extended. */ export declare function _generateUnionTypeCode(this: TsGenerator, currentFile: TsFile, dataType: UnionType, codeBlock: CodeBlock, intent?: Intent): Promise; export {};