export interface Documentation { childContext?: Record; composes?: string[]; context?: Record; description?: string; displayName?: string; methods?: MethodDescriptor[]; props?: Record; } export interface MethodParameter { name: string; description?: string; optional: boolean; type?: TypeDescriptor | null; } export interface MethodReturn { description?: string; type: TypeDescriptor | undefined; } export type MethodModifier = 'async' | 'generator' | 'get' | 'set' | 'static'; export interface MethodDescriptor { name: string; description?: string | null; docblock: string | null; modifiers: MethodModifier[]; params: MethodParameter[]; returns: MethodReturn | null; } export interface PropTypeDescriptor { name: 'any' | 'array' | 'arrayOf' | 'bool' | 'custom' | 'element' | 'elementType' | 'enum' | 'exact' | 'func' | 'instanceOf' | 'node' | 'number' | 'object' | 'objectOf' | 'shape' | 'string' | 'symbol' | 'union'; value?: unknown; raw?: string; computed?: boolean; description?: string; required?: boolean; } export interface DefaultValueDescriptor { value: unknown; computed: boolean; } export interface BaseType { required?: boolean; nullable?: boolean; alias?: string; } export interface SimpleType extends BaseType { name: string; raw?: string; } export interface LiteralType extends BaseType { name: 'literal'; value: string; } export interface ElementsType extends BaseType { name: string; raw: string; elements: Array>; } export interface FunctionArgumentType { name: string; type?: TypeDescriptor; rest?: boolean; } export interface FunctionSignatureType extends BaseType { name: 'signature'; type: 'function'; raw: string; signature: { arguments: Array>; return?: TypeDescriptor; }; } export interface TSFunctionSignatureType extends FunctionSignatureType { signature: { arguments: Array>; return?: TypeDescriptor; this?: TypeDescriptor; }; } export interface ObjectSignatureType extends BaseType { name: 'signature'; type: 'object'; raw: string; signature: { properties: Array<{ key: TypeDescriptor | string; value: TypeDescriptor; description?: string; }>; constructor?: TypeDescriptor; }; } export type TypeDescriptor = ElementsType | LiteralType | ObjectSignatureType | SimpleType | T; export interface PropDescriptor { type?: PropTypeDescriptor; flowType?: TypeDescriptor; tsType?: TypeDescriptor; required?: boolean; defaultValue?: DefaultValueDescriptor; description?: string; } export default class DocumentationBuilder { #private; constructor(); addComposes(moduleName: string): void; set(key: string, value: unknown): void; get(key: string): T | null; getPropDescriptor(propName: string): PropDescriptor; getContextDescriptor(propName: string): PropDescriptor; getChildContextDescriptor(propName: string): PropDescriptor; build(): Documentation; }