dub
dub copied to clipboard
fix(ts): preserve EventType literal inference under TS 5.4
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