Skip to content

fix(api): drop unused @ts-expect-error that breaks CI typecheck - #115

Merged
Hydralerne merged 1 commit into
oblien:mainfrom
shuvamk:fix/api-typecheck-unused-ts-expect-error
Jul 22, 2026
Merged

fix(api): drop unused @ts-expect-error that breaks CI typecheck#115
Hydralerne merged 1 commit into
oblien:mainfrom
shuvamk:fix/api-typecheck-unused-ts-expect-error

Conversation

@shuvamk

@shuvamk shuvamk commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Problem

CI's Typecheck job is failing on main (and therefore on every open PR branched from it):

src/lib/startup/self-edge.test.ts(42,3): error TS2578: Unused '@ts-expect-error' directive.

This started with 3381e54 (#114), which introduced apps/api/src/lib/startup/self-edge.test.ts. The three most recent CI runs on main are red — the Typecheck apps/api step exits 2, which also short-circuits the Typecheck apps/dashboard step so it never runs.

Cause

process.getuid is typed (() => number) | undefined in @types/node 22 (^22.13.0, resolving to 22.19.15), so:

process.getuid = () => 0;

is already valid TypeScript — nothing to suppress. tsc treats a @ts-expect-error that suppresses no error as an error in its own right (TS2578).

The teardown a few lines below already assigns to the same property with no directive, which confirms the assignment type-checks on its own:

afterEach(() => {
  ...
  process.getuid = origGetuid;
});

Fix

Remove the directive, keep the explanatory comment. One line.

Verification

Run against this branch:

  • bun run --cwd apps/api lint → clean, exit 0 (was: TS2578, exit 2)
  • apps/dashboard tsc --noEmit (the CI filter step) → passes
  • bun run test5/5 turbo tasks successful, matching CI's counts exactly:
    • @repo/api 695 passed / 3 skipped
    • @repo/adapters 222 passed
    • @repo/core 89 passed
    • @repo/db 25 passed
    • @repo/dashboard 17 passed
  • The three ensureSelfEdgeInfra tests in the touched file pass unchanged (vitest run src/lib/startup/self-edge.test.ts → 3 passed).

No behavior change — this only unblocks the typecheck gate.

`process.getuid` is typed `(() => number) | undefined` in @types/node 22,
so assigning `() => 0` to it is already valid — the `@ts-expect-error`
above it never suppressed anything. Under `tsc --noEmit` an unused
directive is itself an error (TS2578), so the CI Typecheck job fails:

    src/lib/startup/self-edge.test.ts(42,3): error TS2578:
      Unused '@ts-expect-error' directive.

The teardown on line 55 already assigns to `process.getuid` with no
directive, which confirms the assignment type-checks on its own.

Keep the explanatory comment, drop only the directive. The three
`ensureSelfEdgeInfra` tests still pass unchanged.
@shuvamk

shuvamk commented Jul 22, 2026

Copy link
Copy Markdown
Contributor Author

Quick heads-up now that #118, #120 and #121 have landed — main's Typecheck job is still red, and this PR is the fix for it.

The merge commit for #121 (run 29959055592) failed with the same single error:

src/lib/startup/self-edge.test.ts(42,3): error TS2578: Unused '@ts-expect-error' directive.

Every push to main will keep failing that job until this one-line change goes in, and because the step exits 2 it also short-circuits Typecheck apps/dashboard, so that step never runs at all.

No rush from my side — just flagging it since the red X on the merges above is this and not those changes.

@Hydralerne
Hydralerne merged commit 97e2b03 into oblien:main Jul 22, 2026
@shuvamk
shuvamk deleted the fix/api-typecheck-unused-ts-expect-error branch July 23, 2026 07:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants