Repository navigation
fix: support exactOptionalPropertyTypes in plugin option types - #707
Merged
farnabaz merged 1 commit intoOct 29, 2026
Merged
Conversation
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`.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
farnabaz
marked this pull request as ready for review
October 29, 2026 02:23
farnabaz
deleted the
pr-pov/support-exactoptionalpropertytypes-in-pl-fda0
branch
October 29, 2026 11:18
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #704 (see #703). #704 added
| undefinedto optional props instreamdownandremend, but the plugin packages still declared plainprop?: T. WithexactOptionalPropertyTypeson, passing a possibly-undefinedvalue tocreateCodePlugin,createMathPluginorcreateMermaidPluginfailed with TS2375/TS2379.This change only touches types. The implementations already handle
undefinedthrough??and object spread.@streamdown/code:CodePluginOptions.themesandHighlightOptions.isIncomplete(the second matches what fix: support exactOptionalPropertyTypes in public types #704 did instreamdown/lib/shiki-types.ts)@streamdown/math:MathPluginOptions.errorColor,MathPluginOptions.singleDollarTextMath,MathPlugin.getStyles@streamdown/mermaid:MermaidPluginOptions.configOptional function parameters such as
callback?andgetMermaid(config?)are unchanged, because the flag doesn't apply to them.@streamdown/cjkhas no options type.Regression tests: each plugin package now has a
tsconfig.exact-optional.jsonand atype-tests/exact-optional-property-types.tsfile, following the pattern from #704. The tests type-check against the builtdistdeclarations. Each package also gets acheck-types:exact-optionalscript, andtype-testsis excluded from each package's normal tsconfig. The existing CI step now runs the check for the three plugin packages as well asstreamdown. Before the type change, the new tests fail with TS2375/TS2379; after it, they pass.Includes a patch changeset for
@streamdown/code,@streamdown/mathand@streamdown/mermaid.