Closed Stadly closed 7 months ago
This is not the best solution. What if you don't want a transition at all?
This can be handled locally in your project if important to you, but the defaults will stay as they are.
That's a good point - <TooltipContent transition={undefined}>
should of course be allowed. The problem is then that bits-ui does not allow transition
to be undefined
.
That can be changed here: https://github.com/huntabyte/bits-ui/blob/c245c996aa6f1779178560fc9cff16dfdef3a399/src/lib/internal/types.ts#L106
transition?: T;
needs to be changed to transition?: T | undefined;
for bits-ui to to allow transition={undefined}
when exactOptionalPropertyTypes
is turned on.
What do you think?
Describe the bug
With Exact Optional Property Types enabled, the TypeScript checks fail for many components.
Let's take
tooltip-content.svelte
as an example.$$Props["transition"]
includesundefined
, sincetransition
is optional in$$Props
. This means thattransition
can beundefined
. This results in an error since<TooltipPrimitive.Content transition={undefined}>
is not allowed.I think the best solution might be to wrap the type with
NonNullable
:Reproduction
https://stackblitz.com/edit/github-ztpytl?file=src%2Flib%2Fcomponents%2Fui%2Ftooltip%2Ftooltip-content.svelte
Run
npm run check
. Then all components with the issue will be listed.Logs
No response
System Info
Severity
annoyance