/** * RED Phase Tests for exactOptionalPropertyTypes Violations * * This file documents TypeScript violations found when `exactOptionalPropertyTypes: true` * is enabled in tsconfig.base.json. This setting enforces proper distinction between: * * - `{ prop?: T }` - property can be MISSING or have type T (cannot be explicitly undefined) * - `{ prop?: T | undefined }` - property can be MISSING, have type T, or be explicitly undefined * * The violations occur when code explicitly assigns `undefined` to optional properties * that don't have `| undefined` in their type definition. * * ## Violation Summary (61 exactOptionalPropertyTypes errors across 18 files): * * ### By Error Code: * - TS2375: Object literal type not assignable (return statements, variable assignments) * - TS2379: Argument type not assignable (function call arguments) * - TS2412: Direct assignment of undefined to optional property * * ### By File (files with exactOptionalPropertyTypes violations): * * 1. src/cdc/batch-processor.ts (2 errors) * - Lines 397, 416: newRow/oldRow handling * * 2. src/cdc/circuit-breaker.ts (1 error) * - Line 290: CircuitBreakerStats with lastFailure/lastSuccess * * 3. src/cdc/debug-utils.ts (2 errors) * - Lines 203, 499: EventLogEntry and SubscriptionSnapshot * * 4. src/cdc/errors.ts (11 errors) * - Lines 85-89, 200-201, 353, 377, 384, 391, 400: subscriptionId, suggestion, context * * 5. src/cdc/health-monitor.ts (6 errors) * - Lines 176, 268, 331, 418, 419: checkTimer, lastEventAt, lastFailureAt * * 6. src/cdc/logger.ts (5 errors) * - Lines 258, 333, 337, 341, 345: LogEntry subscriptionId/context/error * * 7. src/cdc/react-hooks.ts (3 errors) * - Lines 195, 409, 548: events/filter/resumeFrom/healthStatus * * 8. src/cdc/state-machine.ts (2 errors) * - Lines 306, 313: context in error options and StateTransition * * 9. src/cdc/stream-manager.ts (1 error) * - Line 880: RowChange with newRow/oldRow/changedColumns * * 10. src/cli/commands/migrate-dashboard.ts (2 errors) * - Lines 339, 356: limit parameter * * 11. src/client.ts (1 error) * - Line 620: RpcTransportConfig with apiKey/WebSocket/connectTimeout * * 12. src/middleware.ts (1 error) * - Line 767: QueryTrace with parentSpanId/error * * 13. src/migrations/progress-api.ts (1 error) * - Line 181: string | undefined assignment * * 14. src/pool.ts (1 error) * - Line 195: Date assignment * * 15. src/retention.ts (7 errors) * - Lines 630, 1043, 1091, 1507, 1553, 1592, 1612: RetentionPolicy, LegalHold, etc. * * 16. src/transport/cdc-sse.ts (4 errors) * - Lines 549, 550, 552, 554: Row newRow/oldRow * * 17. src/transport/cdc-ws.ts (3 errors) * - Lines 180, 539, 690: config and CDCChangeEvent * * 18. src/transports/cdc-sse.ts (4 errors) * - Lines 384, 385, 387, 389: Row newRow/oldRow * * ## Fix Patterns for GREEN Phase: * * Pattern 1: Add `| undefined` to interface property type * BEFORE: `prop?: T` * AFTER: `prop?: T | undefined` * * Pattern 2: Omit property when value is undefined (spread with conditional) * BEFORE: `{ prop: maybeUndefined }` * AFTER: `{ ...(maybeUndefined !== undefined && { prop: maybeUndefined }) }` * * Pattern 3: Type narrow before assignment * BEFORE: `obj.prop = value` (where value may be undefined) * AFTER: `if (value !== undefined) { obj.prop = value }` * * @see https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes */ export {}; //# sourceMappingURL=exact-optional-types.test.d.ts.map