The cost extractor utility (src/utils/cost-extractor.ts) uses any types in two places: extractCostFromResult(msg: any) and when iterating over msg.modelUsage as Record<string, any>. Since the function processes Claude SDK response messages, the input shape is known and can be typed with a proper interface. Replacing the any types improves type safety and IDE autocompletion.
Relevant files:
src/utils/cost-extractor.ts — define an interface for the expected message shape and replace any usages
Acceptance criteria:
- No
any types remain in the file
- A new interface (e.g.,
ClaudeResultMessage) defines the expected input shape with optional fields
npm run lint passes (tsc --noEmit with strict mode)
- No runtime behavior change
The cost extractor utility (
src/utils/cost-extractor.ts) usesanytypes in two places:extractCostFromResult(msg: any)and when iterating overmsg.modelUsage as Record<string, any>. Since the function processes Claude SDK response messages, the input shape is known and can be typed with a proper interface. Replacing theanytypes improves type safety and IDE autocompletion.Relevant files:
src/utils/cost-extractor.ts— define an interface for the expected message shape and replaceanyusagesAcceptance criteria:
anytypes remain in the fileClaudeResultMessage) defines the expected input shape with optional fieldsnpm run lintpasses (tsc --noEmit with strict mode)