Skip to content

Consider enabling exactOptionalPropertyTypes in tsconfig #37

@chiptus

Description

@chiptus

Background

exactOptionalPropertyTypes is a TypeScript strictness flag. It changes optional properties so that name?: string means the key may be absent — but you can no longer explicitly assign undefined to it.

type T = { name?: string };
const a: T = { name: undefined }; // OK today, ERROR with the flag
const b: T = {};                  // OK either way

This catches the genuine distinction between "key absent" and "key explicitly undefined", which matters for Object.keys(), spreads, in checks, etc.

Why it's a separate task

  • It is repo-wide hardening: enabling it would surface type errors across many files, not a localized change.
  • It conflicts with patterns already in the codebase. For example, the mutation payloads in useUpdateSet.ts / useUpdateArtist.ts build a single object literal that assigns possibly-undefined values directly (relying on JSON serialization to drop them). With the flag on, those would need to go back to conditional/guarded construction.

Suggested approach

  1. Enable exactOptionalPropertyTypes in tsconfig.app.json.
  2. Run pnpm run typecheck, triage the resulting errors.
  3. Fix incrementally, or decide it is not worth the churn.

Context

Came up during PR #34 review while refactoring set/artist mutation payloads. Tracking separately so the decision is deliberate rather than bundled into an unrelated PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions