UNPKG

@tachui/devtools

Version:

Development & debugging tools for tachUI framework

176 lines 4.79 kB
/** * Enhanced Error Messages and Developer Experience * * Provides better error messages, debugging aids, and developer-friendly * error reporting for the TachUI framework. */ import type { Modifier } from '@tachui/core'; import type { ComponentInstance } from '@tachui/core'; /** * Enhanced error with developer-friendly context */ export interface EnhancedTachUIError extends Error { code: string; category: 'modifier' | 'component' | 'runtime' | 'reactive' | 'validation'; severity: 'warning' | 'error' | 'fatal'; component?: string; suggestion: string; documentation?: string; examples?: string[]; relatedErrors?: string[]; } /** * Developer experience error factory */ export declare class DeveloperErrorFactory { /** * Create modifier validation error */ static modifierValidationError(modifier: string, issue: string, component?: ComponentInstance): EnhancedTachUIError; /** * Create component validation error */ static componentValidationError(componentType: string, prop: string, expectedType: string, actualValue: any): EnhancedTachUIError; /** * Create reactive system error */ static reactiveSystemError(operation: string, issue: string, context?: string): EnhancedTachUIError; /** * Create runtime error */ static runtimeError(operation: string, issue: string, component?: string): EnhancedTachUIError; /** * Get modifier-specific suggestion */ private static getModifierSuggestion; /** * Get modifier examples */ private static getModifierExamples; /** * Get component examples */ private static getComponentExamples; /** * Get type conversion suggestion */ private static getTypeConversionSuggestion; /** * Get reactive system suggestion */ private static getReactiveSuggestion; /** * Get reactive examples */ private static getReactiveExamples; /** * Get runtime suggestion */ private static getRuntimeSuggestion; } /** * Enhanced warning system */ export declare class DeveloperWarnings { private static warningsSeen; /** * Warn about deprecated API usage */ static deprecation(oldAPI: string, newAPI: string, component?: string, willBeRemovedIn?: string): void; /** * Warn about performance issues */ static performance(issue: string, suggestion: string, component?: string): void; /** * Warn about accessibility issues */ static accessibility(issue: string, suggestion: string, component?: string): void; /** * Clear warning cache (for testing) */ static clearWarnings(): void; /** * Get count of unique warnings shown */ static getWarningCount(): number; } /** * Type validation helpers */ export declare class TypeValidation { /** * Validate component props with enhanced error messages */ static validateComponentProps<T extends Record<string, any>>(componentType: string, props: T, schema: Record<keyof T, { type: string; required?: boolean; validator?: (value: any) => boolean; message?: string; }>): void; /** * Validate type */ private static validateType; /** * Validate modifier combination */ static validateModifierCombination(modifiers: Modifier[]): void; } /** * Formatted error message type */ export interface FormattedErrorMessage { code: string; message: string; suggestion: string; severity: 'warning' | 'error' | 'fatal'; component?: string; documentation?: string; examples?: string[]; template?: { severity: string; message: string; }; error?: { message: string; }; } /** * Developer experience utilities */ export declare class DeveloperExperienceUtils { /** * Format error message for better developer experience */ static formatError(error: EnhancedTachUIError): FormattedErrorMessage; /** * Get statistics about developer experience features */ static getStatistics(): { errorCount: number; warningCount: number; suggestionCount: number; }; /** * Get suggestions for a diagnostic */ static getSuggestions(_code: string, _data?: any): any[]; /** * Test developer experience features */ static test(): Promise<void>; } /** * Development mode utilities */ export declare const devMode: { /** * Enable enhanced error reporting in development */ enableEnhancedErrors(): void; /** * Log component tree for debugging */ logComponentTree(root: any, depth?: number): void; }; //# sourceMappingURL=enhanced-errors.d.ts.map