// PATTERN TIER: fixture — scaffolding that pins a bug or drives the // runtime. Do not copy from this file. Tiers: packages/patterns/index.md import { generateObject, JSONSchema, pattern, Reactive } from "commonfabric"; interface Email { id: string; content: string; } interface ExtractedData { summary: string; } // Generic building block - T is a type parameter function BuildingBlock(emails: Reactive, schema: JSONSchema) { // This is the problematic case: generateObject where T is a type parameter // The result is Reactive where T is unresolved const analyses = emails.map((email: Email) => { const analysis = generateObject({ prompt: email.content, schema, }); return { email, analysis, result: analysis.result, // Reactive - T is a type parameter! }; }); return { analyses }; } // Pattern that uses the building block export default pattern(({ emails }: { emails: Reactive }) => { const data = BuildingBlock(emails, { type: "object" }); return { data }; });