Skip to content

fix(build): repair three type errors that break pnpm -r build - #942

Merged
ralyodio merged 1 commit into
profullstack:masterfrom
hugoboss23-5:fix/workspace-build-type-errors
Aug 9, 2026
Merged

fix(build): repair three type errors that break pnpm -r build#942
ralyodio merged 1 commit into
profullstack:masterfrom
hugoboss23-5:fix/workspace-build-type-errors

Conversation

@hugoboss23-5

Copy link
Copy Markdown
Contributor

pnpm -r build fails on master today. Three distinct type errors block the
workspace build at three different packages. This fixes all three.

1. packages/bots/core and packages/bot/core — TS2345

Both packages carry a duplicated copy of the same SessionManager. In each, the
local finish callback re-declares its parameter as an inline structural type
with widened primitives:

const finish = (result: {
  type: string;      // AIResult requires the literal "result"
  subtype: string;   // AIResult requires "success" | "error"
  ...
}) => { ... resolve(result); }

AIResult is declared a few lines above in the same file and requires string
literals. A widened string is not assignable to a literal type, so
resolve(result) is rejected.

Fixed by annotating the parameter with the existing AIResult interface rather
than restating its shape. That also deletes a hand-duplicated type which had
already drifted from its source — the drift is what allowed the mismatch, so
removing it prevents a recurrence.

2. packages/bots/signal — TS2322

The object literal in the timestamp-fallback test does not satisfy
IncomingMessage in three ways:

  • groupId: undefined where the interface declares string | null
  • required field isGroup missing
  • excess property raw that is not on the interface

All three corrected, not just the one the compiler reports first. The test's
intent — an out-of-range timestamp falls back to epoch — is unchanged.

Verification

  • tsc -p tsconfig.json --noEmit exits 0 for each affected package, using the
    repo's own pinned typescript@5.9.3 from the lockfile.
  • vitest run packages/bots/signal7 passed (7).
  • Full pnpm -r build now completes green through sites/sh1pt.com build: Done.

No runtime logic changed; the diff is entirely type-level, net -22/+4.

Note on what I deliberately did not include

While investigating I also saw TS2307 Cannot find module for
@profullstack/sh1pt-policy and @profullstack/sh1pt-action-packs in
packages/cli. Those are not bugs — both are real workspace packages
correctly declared workspace:^; the errors only appear when typecheck runs
before those packages are built. Building them first clears it. Excluded from
this PR.

`pnpm -r build` currently fails on master. Three distinct type errors, each
blocking the workspace build at a different package.

1. packages/bots/core and packages/bot/core - TS2345

   Both packages contain a duplicated copy of the same SessionManager. In each,
   the local `finish` callback re-declares its parameter as an inline structural
   type using widened primitives:

       type: string;
       subtype: string;

   but `AIResult` (declared a few lines above in the same file) requires the
   string literals `"result"` and `"success" | "error"`. A widened `string` is
   not assignable to a literal type, so `resolve(result)` is rejected.

   Fixed by annotating the parameter with the existing `AIResult` interface
   instead of restating its shape. This also removes a hand-duplicated type that
   had already drifted from its source, which is what allowed the mismatch.

2. packages/bots/signal - TS2322

   The object literal in the timestamp-fallback test does not satisfy
   `IncomingMessage` in three ways: `groupId: undefined` where the interface
   declares `string | null`, the required `isGroup` field is missing, and an
   excess `raw` property is not part of the interface. Corrected all three
   rather than only the error the compiler reported first. The test's intent
   (out-of-range timestamp falls back to epoch) is unchanged.

Verification
- `tsc -p tsconfig.json --noEmit` exits 0 for each package, using the repo's
  own pinned typescript@5.9.3 from the lockfile.
- `vitest run packages/bots/signal` -> 7 passed (7). Behaviour preserved.
- No runtime logic changed; net -22/+4 lines, entirely type-level.
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.

3 participants