Skip to content

Preserve union types in Combobox option callbacks - #3900

Open
tevinch wants to merge 1 commit into
tailwindlabs:mainfrom
tevinch:fix-combobox-union-types
Open

tevinch wants to merge 1 commit into
tailwindlabs:mainfrom
tevinch:fix-combobox-union-types

Conversation

@tevinch

@tevinch tevinch commented Oct 2, 2026

Copy link
Copy Markdown

Fixes #3897.

A Combobox with a union value type such as string | Option rejects valid by and virtual.disabled callbacks when multiple is a boolean or true. The multiple branch applies NoInfer before EnsureArray, which can collapse the union to its common properties. It can also accept unrelated virtual options.

This follows the use-site approach suggested in the report: apply NoInfer after deriving the array or element type for by, virtual.options and virtual.disabled. Runtime code and the shared EnsureArray helper are unchanged.

The compiler-backed regression uses real Combobox JSX. It covers primitive/object and object/object unions, boolean and literal multiple modes, inferred arrays, incompatible callbacks/options, and option-driven type widening. It fails on the original source and passes with this change using the repository's TypeScript 5.4.3.

Validation:

  • The original consumer fails with two TS2322 errors against npm 2.2.10 and compiles unchanged against the packed correction with TypeScript 5.9.2.
  • Full npm test -- --runInBand: 56 suites, 2,046 tests and 100 snapshots pass; 36 tests skipped. An initial untouched-source run hit a Vue transition timing snapshot; the final full run passes without changing it.
  • Repository formatting passes. React/Vue output built and the packed React declarations compile in a separate NodeNext consumer. An esbuild launcher stalled during the build; rerunning the same ESM compilation with its bundled binary completed it.

@vercel

vercel Bot commented Oct 2, 2026

Copy link
Copy Markdown

@tevinch is attempting to deploy a commit to the Tailwind Labs Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

Combobox by and virtual.disabled reject a correct handler when TValue is a union

1 participant