Skip to content

fix: support exactOptionalPropertyTypes in plugin option types - #707

Merged
farnabaz merged 1 commit into
mainfrom
pr-pov/support-exactoptionalpropertytypes-in-pl-fda0
Oct 29, 2026
Merged

farnabaz merged 1 commit into
mainfrom
pr-pov/support-exactoptionalpropertytypes-in-pl-fda0

Conversation

@farnabaz

Copy link
Copy Markdown
Collaborator

Follow-up to #704 (see #703). #704 added | undefined to optional props in streamdown and remend, but the plugin packages still declared plain prop?: T. With exactOptionalPropertyTypes on, passing a possibly-undefined value to createCodePlugin, createMathPlugin or createMermaidPlugin failed with TS2375/TS2379.

This change only touches types. The implementations already handle undefined through ?? and object spread.

  • @streamdown/code: CodePluginOptions.themes and HighlightOptions.isIncomplete (the second matches what fix: support exactOptionalPropertyTypes in public types #704 did in streamdown/lib/shiki-types.ts)
  • @streamdown/math: MathPluginOptions.errorColor, MathPluginOptions.singleDollarTextMath, MathPlugin.getStyles
  • @streamdown/mermaid: MermaidPluginOptions.config

Optional function parameters such as callback? and getMermaid(config?) are unchanged, because the flag doesn't apply to them. @streamdown/cjk has no options type.

Regression tests: each plugin package now has a tsconfig.exact-optional.json and a type-tests/exact-optional-property-types.ts file, following the pattern from #704. The tests type-check against the built dist declarations. Each package also gets a check-types:exact-optional script, and type-tests is excluded from each package's normal tsconfig. The existing CI step now runs the check for the three plugin packages as well as streamdown. Before the type change, the new tests fail with TS2375/TS2379; after it, they pass.

Includes a patch changeset for @streamdown/code, @streamdown/math and @streamdown/mermaid.

Follow-up to #704 (see #703). #704 added `| undefined` to optional props in `streamdown` and `remend`, but the plugin packages still declared plain `prop?: T`. With `exactOptionalPropertyTypes` on, passing a possibly-`undefined` value to `createCodePlugin`, `createMathPlugin` or `createMermaidPlugin` failed with TS2375/TS2379.

This change only touches types. The implementations already handle `undefined` through `??` and object spread.

- `@streamdown/code`: `CodePluginOptions.themes` and `HighlightOptions.isIncomplete` (the second matches what #704 did in `streamdown/lib/shiki-types.ts`)
- `@streamdown/math`: `MathPluginOptions.errorColor`, `MathPluginOptions.singleDollarTextMath`, `MathPlugin.getStyles`
- `@streamdown/mermaid`: `MermaidPluginOptions.config`

Optional function parameters such as `callback?` and `getMermaid(config?)` are unchanged, because the flag doesn't apply to them. `@streamdown/cjk` has no options type.

**Regression tests:** each plugin package now has a `tsconfig.exact-optional.json` and a `type-tests/exact-optional-property-types.ts` file, following the pattern from #704. The tests type-check against the built `dist` declarations. Each package also gets a `check-types:exact-optional` script, and `type-tests` is excluded from each package's normal tsconfig. The existing CI step now runs the check for the three plugin packages as well as `streamdown`. Before the type change, the new tests fail with TS2375/TS2379; after it, they pass.

Includes a patch changeset for `@streamdown/code`, `@streamdown/math` and `@streamdown/mermaid`.
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
streamdown Ready Ready Preview, v0 Oct 29, 2026 2:24am UTC

@farnabaz
farnabaz marked this pull request as ready for review October 29, 2026 02:23
@farnabaz
farnabaz merged commit 7dcabc6 into main Oct 29, 2026
12 checks passed
@farnabaz
farnabaz deleted the pr-pov/support-exactoptionalpropertytypes-in-pl-fda0 branch October 29, 2026 11:18

This branch was successfully deployed

1 active deployment
Preview — 49b5a739 Deployed Oct 29, 2026 by vercel[bot]
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