@autobe/agent
Version:
AI backend server code generator
37 lines (36 loc) • 1.68 kB
TypeScript
import { IAutoBeTypeScriptCompileResult } from "@autobe/interface";
/**
* Generates concise TS2339-specific hints for Prisma relation field access
* errors.
*
* Parses TS2339 "Property 'X' does not exist on type 'Y'" diagnostics,
* deduplicates by property name, and returns a short explanation.
*
* Handles both simple type names (e.g., `shopping_sales`) and inline Prisma
* GetPayload types (e.g., `{ id: string; body: string; ... }`).
*
* Returns empty string if no TS2339 diagnostics are found.
*/
export declare function generateTS2339Hints(diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[]): string;
/**
* Extracts "Did you mean 'X'?" suggestions from TS2353/TS2339 diagnostics.
*
* The TypeScript compiler provides these suggestions when a property name is
* close to a valid one (e.g., `owner_member` → `ownerMember`).
*/
export declare function extractDidYouMeanHints(diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[]): Array<{
wrong: string;
suggested: string;
}>;
/**
* Generates hints for TS1360 "Property 'X' is missing in type" errors.
*
* TS1360 fires exclusively on `satisfies` expressions, so the expectedType is
* always the single type the developer explicitly chose — no union branch
* ambiguity. TS2322 "missing property" errors are intentionally excluded
* because they report failures against ALL branches of a union type (e.g.,
* `CreateInput | UncheckedCreateInput`), producing misleading hints.
*
* Returns empty string if no TS1360 "missing property" diagnostics are found.
*/
export declare function generateMissingPropertyHints(diagnostics: IAutoBeTypeScriptCompileResult.IDiagnostic[]): string;