WIP: A simple cli for daily tangled use cases and AI integration. This is for my personal use right now, but happy if others get mileage from it! :)

fix: make outputJson generic to accept strongly-typed interfaces

outputJson previously required Record<string, unknown>, which forced
callers to either use untyped objects or add a catch-all index signature
to typed interfaces like IssueData. Using a generic T extends object
allows any typed object to be passed while keeping the Record<string,
unknown> cast scoped to pickFields where dynamic key access is actually
needed.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

markbennett.ca 4f9e9fb9 bb60aa2d

verified
+4 -4
+4 -4
src/utils/formatting.ts
··· 45 45 * @param data - The data to output (object or array of objects) 46 46 * @param fields - Comma-separated field names to include; omit for all fields 47 47 */ 48 - export function outputJson( 49 - data: Record<string, unknown> | Record<string, unknown>[], 48 + export function outputJson<T extends object>( 49 + data: T | T[], 50 50 fields?: string 51 51 ): void { 52 52 if (fields) { ··· 57 57 if (Array.isArray(data)) { 58 58 console.log( 59 59 JSON.stringify( 60 - data.map((item) => pickFields(item, fieldList)), 60 + data.map((item) => pickFields(item as Record<string, unknown>, fieldList)), 61 61 null, 62 62 2 63 63 ) 64 64 ); 65 65 } else { 66 - console.log(JSON.stringify(pickFields(data, fieldList), null, 2)); 66 + console.log(JSON.stringify(pickFields(data as Record<string, unknown>, fieldList), null, 2)); 67 67 } 68 68 } else { 69 69 console.log(JSON.stringify(data, null, 2));