Skip to content

fix: ship bongo/client types - #86

Merged
lukeed merged 2 commits into
mainfrom
fix/package-types
Oct 23, 2026
Merged

lukeed merged 2 commits into
mainfrom
fix/package-types

Conversation

@lukeed

@lukeed lukeed commented Oct 23, 2026

Copy link
Copy Markdown
Owner

tsc failed on a new site from create-bongo, with no change to the template. The installed packages gave 6 errors.

Causes and changes

  1. bongo/client had no types in the package. client.d.ts re-exported from ./src/client/index, and src/ is not in files. So client, navigate, on, and off had no types, and ({ to }) in the template's main.ts was an implicit any. client.d.ts now declares the API itself, as index.d.ts does. A new type test, src/client/types.test.ts, makes bunx tsc -p . fail when the declarations and src/client disagree.
  2. index.d.ts uses Buffer and BufferEncoding ($assets.load), so it needs Node types. TypeScript 6 and later load no @types package unless types lists it, so an installed @types/node alone does not help. The template adds @types/node@^24, as engines asks for Node 24, and sets "types": ["node"].
  3. Shiki's types use Symbol.dispose. That is not in the es2024 or es2025 lib, but @types/node declares it, so (2) fixes this too. The template target goes from es2023 to es2024. es2025 would need TypeScript 6 or later, and the template does not install TypeScript, so the user's editor decides the version.

Not changed

Test plan

  • bun test (858 pass), bunx tsc -p ., bunx tsc -p build, bun run build
  • The type test fails when one type in client.d.ts changes, such as prefetch without 'tap'
  • By hand: I packed @bongo/bongo and @bongo/markdown, scaffolded a site with create-bongo, and installed the tarballs. On main, tsc gives 6 errors. With this branch, tsc is clean and bongo build passes.

@lukeed lukeed changed the title fix: ship bongo/client types fix: ship bongo/client types Oct 23, 2026
@lukeed
lukeed merged commit 6a64ada into main Oct 23, 2026
4 checks passed
@lukeed
lukeed deleted the fix/package-types branch October 23, 2026 00:35
@lukeed lukeed mentioned this pull request Oct 23, 2026
6 tasks done
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.

1 participant