dub icon indicating copy to clipboard operation
dub copied to clipboard

fix(ts): preserve EventType literal inference under TS 5.4

Open Hritwik001 opened this issue 1 month ago • 4 comments

Context

Under TypeScript 5.4, chained Zod transforms can widen the \EventType\ literal union to \string.

Fix

  • Defined \EVENT_TYPES\ as a readonly tuple and derived \EventType.
  • Used \z.enum(EVENT_TYPES)\ for the \ ype\ field.
  • No runtime behavior change.

Scope

  • Change is isolated to \pps/web/lib/analytics/get-events.ts.

Notes

  • Local monorepo typechecks show unrelated UI typing noise, but this change is self-contained and verified locally.

Summary by CodeRabbit

  • Refactor

    • Strengthened event type validation for analytics tracking with standardized event categories.
    • Enhanced data filtering to ensure higher quality event records.
    • Improved code structure and maintainability for analytics processing.

    Fixes #3059

Hritwik001 avatar Nov 08 '25 16:11 Hritwik001