Skip to content

follow-up: widen outputResult signature to accept typed objects instead of Record<string, any> #1803

Description

@carlos-alm

Deferred from PR #1790 review.

Original reviewer comment: #1790 (comment)

Context:
outputResult in src/presentation/result-formatter.ts takes data: Record<string, any>. Because any is involved, most call sites don't strictly need a cast to call it with a typed interface — but roughly 20 call sites across the presentation layer nonetheless carry a defensive data as unknown as Record<string, unknown> cast (e.g. presentation/queries-cli/impact.ts, path.ts, inspect.ts, overview.ts, presentation/triage.ts, presentation/owners.ts, presentation/queries-cli/exports.ts).

Greptile's review of PR #1790 flagged this pattern in presentation/audit.ts — the cast there was in fact unneeded and has been removed directly in that PR (verified clean with tsc --noEmit). The broader ask is to widen outputResult's parameter type (e.g. to object or a proper generic) so the type system can verify these call sites without an escape-hatch cast, and then remove the now-redundant casts across the ~20 remaining call sites.

This touches many files outside the scope of PR #1790 (which is limited to ast-analysis/presentation/extractors/cli quality fixes), so it's tracked here as a follow-up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    follow-upDeferred work from PR reviews that needs tracking

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions