CLI: fix TypeScript LSP errors in packages/cli #36

Closed
opened 2026-06-02 02:37:26 +00:00 by xiaoju · 0 comments
Owner

Problem

packages/cli/src/index.ts has multiple pre-existing TypeScript errors visible in LSP. The CLI works fine (runs via bun directly, not tsc --build), but these errors pollute editor diagnostics.

Three categories

1. TS6059/TS6307 — rootDir conflict (bulk of errors)

CLI tsconfig sets rootDir: src, but workspace:* resolution points bun at packages/core/src/ and packages/fs/src/ source files directly. tsc sees them as outside rootDir.

Fix options:

  • Add references to core/fs in CLI tsconfig (proper composite project setup)
  • Or remove rootDir constraint since CLI is bun-executed, not tsc-built

2. TS2379 — exactOptionalPropertyTypes mismatch

resolution: number | undefined is not assignable to resolution?: number under exactOptionalPropertyTypes: true. Affects:

  • renderAsync() calls (~3 sites)
  • renderDirect() calls (~1 site)
  • varStore.tag() call (~1 site)

Fix: Filter out undefined values before passing, or use spread with conditional properties.

3. TS2304 — Cannot find name schemaHash (line ~1043)

A reference to a variable that doesn't exist in scope.

Fix: Likely a leftover from a refactor — find the intended variable and fix the reference.

Notes

  • None of these affect runtime (bun ignores type errors)
  • All are pre-existing, not introduced by recent PRs
  • Fixing these would make editor experience much cleaner
## Problem `packages/cli/src/index.ts` has multiple pre-existing TypeScript errors visible in LSP. The CLI works fine (runs via `bun` directly, not `tsc --build`), but these errors pollute editor diagnostics. ## Three categories ### 1. TS6059/TS6307 — rootDir conflict (bulk of errors) CLI tsconfig sets `rootDir: src`, but `workspace:*` resolution points bun at `packages/core/src/` and `packages/fs/src/` source files directly. tsc sees them as outside rootDir. **Fix options:** - Add `references` to core/fs in CLI tsconfig (proper composite project setup) - Or remove rootDir constraint since CLI is bun-executed, not tsc-built ### 2. TS2379 — exactOptionalPropertyTypes mismatch `resolution: number | undefined` is not assignable to `resolution?: number` under `exactOptionalPropertyTypes: true`. Affects: - `renderAsync()` calls (~3 sites) - `renderDirect()` calls (~1 site) - `varStore.tag()` call (~1 site) **Fix:** Filter out undefined values before passing, or use spread with conditional properties. ### 3. TS2304 — `Cannot find name schemaHash` (line ~1043) A reference to a variable that doesn't exist in scope. **Fix:** Likely a leftover from a refactor — find the intended variable and fix the reference. ## Notes - None of these affect runtime (bun ignores type errors) - All are pre-existing, not introduced by recent PRs - Fixing these would make editor experience much cleaner
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/ocas#36