Skip to content

fix: support exactOptionalPropertyTypes in public types - #704

Merged
farnabaz merged 2 commits into
vercel:mainfrom
sleitor:fix-703
Oct 29, 2026
Merged

farnabaz merged 2 commits into
vercel:mainfrom
sleitor:fix-703

Conversation

@sleitor

@sleitor sleitor commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #703

Summary

Projects with exactOptionalPropertyTypes enabled couldn't forward a possibly-undefined value to <Streamdown>'s optional props (e.g. isAnimating={streaming} where streaming?: boolean) because they were declared as prop?: T rather than prop?: T | undefined.

This adds | undefined to the optional properties of the public types. It is types-only and a no-op for consumers without the flag.

  • packages/streamdown/index.tsx: StreamdownProps, ControlsConfig / CopyControlConfig, LinkSafetyConfig, MermaidOptions, StreamdownContextType, BlockProps
  • lib/plugin-types.ts, lib/shiki-types.ts: highlighter/plugin/theme types, PluginConfig, CustomRendererProps
  • lib/markdown.ts (Options, Components), lib/animate.ts (AnimateOptions), lib/icon-context.tsx (IconComponent)
  • packages/remend/src/index.ts: RemendOptions / RemendHandler (passed through the remend prop)

Type test

Adds packages/streamdown/type-tests/exact-optional-property-types.tsx plus tsconfig.exact-optional.json, run via pnpm check-types:exact-optional in packages/streamdown. It type-checks forwarding undefined to optional props against the built .d.ts with exactOptionalPropertyTypes: true.

Test plan

  • pnpm biome check passes
  • pnpm test passes (1310 tests)
  • pnpm check-types:exact-optional passes
  • Changeset added

@vercel

vercel Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

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

A member of the Team first needs to authorize it.

@farnabaz farnabaz left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks

@farnabaz
farnabaz merged commit ae6fa3b into vercel:main Oct 29, 2026
7 of 8 checks passed
@sleitor
sleitor deleted the fix-703 branch October 29, 2026 03:51
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.

Support exactOptionalPropertyTypes

2 participants