Skip to content

fix(core): restore bundler resolution for source-imported deps - #41885

Merged
kitlangton merged 2 commits into
v2from
fix-core-typecheck
Aug 12, 2026
Merged

fix(core): restore bundler resolution for source-imported deps#41885
kitlangton merged 2 commits into
v2from
fix-core-typecheck

Conversation

@kitlangton

@kitlangton kitlangton commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

What

Restore a green typecheck on v2 by reverting the three NodeNext compiler options added to packages/core/tsconfig.json in 4acdeff (refactor(core): require explicit import extensions), while keeping that commit's ~300 files of explicit .js import extensions.

Before / After

Before: bun typecheck failed repo-wide at v2 HEAD (c217ebe2ad), blocking the pre-push hook for everyone. packages/core imports @opencode-ai/ai and @ff-labs/fff-bun as raw TypeScript sources (their package exports point at src/*.ts), so their files are compiled inside core's program under core's compiler options. With moduleResolution: NodeNext, their extensionless relative imports produce hundreds of TS2835 errors, which cascade into packages/plugin and packages/desktop as TS2305 "has no exported member" failures for Message, SystemPart, CommandInfo, ConnectionInfo, and others.

After: Core resolves modules with the bundler settings from @tsconfig/bun again. The explicit .js extensions in core sources remain valid (TypeScript maps ./agent.js to agent.ts in bundler resolution too), so none of the 300-file refactor is reverted. All 33 packages typecheck.

How

  • packages/core/tsconfig.json: remove "module": "NodeNext", "moduleResolution": "NodeNext", and "allowImportingTsExtensions": false.
  • packages/core/script/migration.ts: emit .js extensions from the renderMigration, renderSchema, and renderRegistry templates. 4acdeff hand-updated the generated schema.gen.ts, migration.gen.ts, and migration files but not the generator, so the database-migration freshness check regenerated old-style imports and failed CI (Current database schema is stale). The templates now reproduce the checked-in files byte for byte.

Scope

  • This does not add tooling to enforce explicit extensions, which was presumably the intent of the flags. Strict NodeNext is not currently feasible while the repo consumes raw-TS dependencies: @ff-labs/fff-bun ships extensionless .ts sources in node_modules, which cannot be edited. Enforcement would need a lint rule (e.g. ESLint import/extensions or a Biome rule) instead of compiler options, or built .d.ts boundaries for source-imported packages. Happy to follow up either way — flagging for @thdxr since 4acdeff landed directly on v2.

Testing

  • bun typecheck at repo root: 33/33 packages pass (previously @opencode-ai/desktop and core itself failed)
  • bun typecheck in packages/core including tsconfig.tests.json
  • bun script/migration.ts --check in packages/core passes with no changes to generated files (fails on v2 HEAD and on the first commit of this branch)

@kitlangton
kitlangton merged commit 3d23c90 into v2 Aug 12, 2026
10 checks passed
@kitlangton
kitlangton deleted the fix-core-typecheck branch August 12, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant