Skip to content

fix: stop requiring shiki for type-checking streamdown#565

Open
ghostyfreak wants to merge 1 commit into
vercel:mainfrom
ghostyfreak:fix/shiki-types-no-devdep
Open

fix: stop requiring shiki for type-checking streamdown#565
ghostyfreak wants to merge 1 commit into
vercel:mainfrom
ghostyfreak:fix/shiki-types-no-devdep

Conversation

@ghostyfreak

Copy link
Copy Markdown

Description

streamdown re-exported BundledLanguage, BundledTheme, and ThemeRegistrationAny from shiki in its published type declarations, but shiki was only a devDependency. Consumers who install streamdown and run tsc (especially with skipLibCheck: false) hit:

Cannot find module 'shiki' or its corresponding type declarations.

even when they never use Shiki directly. Runtime highlighting already lives in @streamdown/code (which correctly depends on shiki); core streamdown only needed those types for its plugin API.

This PR defines local structural types for the re-exports so published .d.ts files no longer import from shiki.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Performance improvement
  • Refactoring (no functional changes)

Related Issues

Fixes #562

Changes Made

  • Add lib/shiki-types.ts with local BundledLanguage, BundledTheme, and ThemeRegistrationAny types
  • Re-export those types from plugin-types / package entry instead of from "shiki"
  • Remove unused shiki devDependency from streamdown
  • Use method syntax on CodeHighlighterPlugin so plugins from @streamdown/code (narrower Shiki language/theme unions) remain assignable
  • Add changeset (patch)

Testing

  • All existing tests pass
  • Manually tested the changes

Verification

  1. Unit tests: pnpm --filter streamdown test — 982 tests passed
  2. Build: pnpm --filter streamdown build — published dist/index.d.ts has no from 'shiki' import
  3. Consumer pack test (reproduces Type declarations import from shiki, but shiki is only a devDependency #562):
    • Packed the fixed package and installed it in a fresh app without shiki
    • tsc with skipLibCheck: false no longer reports Cannot find module 'shiki'
    • Against published streamdown@2.5.0 under the same config, the shiki module errors still appear
  4. Plugin assignability: packed streamdown + @streamdown/code and confirmed <Streamdown plugins={{ code }} /> type-checks

Checklist

  • My code follows the project's code style
  • I have performed a self-review of my own code
  • My changes generate no new warnings or errors
  • New and existing unit tests pass locally with my changes
  • I have created a changeset (pnpm changeset)

Changeset

  • I have created a changeset for these changes

Additional Notes

BundledLanguage / BundledTheme are intentionally widened to string on the core package surface. Precise Shiki unions remain available from @streamdown/code / shiki for apps that install the highlighter plugin. This avoids pulling the large shiki package into every streamdown consumer solely for types.

Re-exported BundledLanguage, BundledTheme, and ThemeRegistrationAny from
local structural types instead of importing them from shiki. Consumers no
longer need to install shiki solely to satisfy TypeScript when using the
published declarations.

Runtime highlighting remains in @streamdown/code, which still depends on
shiki. CodeHighlighterPlugin methods use method syntax so plugins with
narrower Shiki unions stay assignable.

Fixes vercel#562
@vercel

vercel Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

@ghostyfreak is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

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.

Type declarations import from shiki, but shiki is only a devDependency

1 participant