Bug report
Current behavior
Note how I haven't defined a default value for any of the props below:
function Popup({ open: openProp, defaultOpen, onOpenChange }) {
const [open, setOpen] = useControlled({
controlled: openProp,
default: defaultOpen,
// ...
})
}
When we have an example like this where the types are a union of undefined, the above example excludes undefined from the types so open is boolean when it should be undefined.
Expected behavior
I expected the type system to correctly reflect that open could be undefined here.
Reproducible example
https://stackblitz.com/edit/vitejs-vite-drsu38kk?file=src%2FApp.tsx
Base UI version
Utils version 0.3.1
Which browser are you using?
N/A
Which OS are you using?
N/A
Which assistive tech are you using (if applicable)?
N/A
Bug report
Current behavior
Note how I haven't defined a default value for any of the props below:
When we have an example like this where the types are a union of
undefined, the above example excludesundefinedfrom the types soopenisbooleanwhen it should beundefined.Expected behavior
I expected the type system to correctly reflect that
opencould beundefinedhere.Reproducible example
https://stackblitz.com/edit/vitejs-vite-drsu38kk?file=src%2FApp.tsx
Base UI version
Utils version 0.3.1
Which browser are you using?
N/A
Which OS are you using?
N/A
Which assistive tech are you using (if applicable)?
N/A