Closed shyakadavis closed 1 month ago
Hmm... just noticed similar issues also exist in:
Avatar:
Error: Type '{ delayMs: number | undefined; class: string; }' is not assignable to type 'AvatarProps' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Type '{ delayMs: number | undefined; class: string; }' is not assignable to type '{ delayMs?: number; loadingStatus?: "loading" | "loaded" | "error" | undefined; onLoadingStatusChange?: OnChangeFn<"loading" | "loaded" | "error"> | undefined; asChild?: boolean | undefined; el?: HTMLDivElement | undefined; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'delayMs' are incompatible.
Type 'number | undefined' is not assignable to type 'number'.
Type 'undefined' is not assignable to type 'number'. (ts)
Command:
Error: Type '{ class: string; value: string | undefined; }' is not assignable to type 'CommandProps' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Type '{ class: string; value: string | undefined; }' is not assignable to type '{ state?: Writable<State>; label?: string; shouldFilter?: boolean; filter?: (value: string, search: string) => number; value?: string; onValueChange?: (value: string) => void; loop?: boolean; ids?: Partial<...>; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'value' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'. (ts)
Command-Dialog:
Error: Type '{ value: string | undefined; class: string; }' is not assignable to type 'CommandProps' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Type '{ value: string | undefined; class: string; }' is not assignable to type '{ state?: Writable<State>; label?: string; shouldFilter?: boolean; filter?: (value: string, search: string) => number; value?: string; onValueChange?: (value: string) => void; loop?: boolean; ids?: Partial<...>; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'value' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'. (ts)
Select-Item:
Error: Type '{ value: unknown; disabled: boolean | undefined; label: string | undefined; class: string; }' is not assignable to type 'SelectItemProps' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Type '{ value: unknown; disabled: boolean | undefined; label: string | undefined; class: string; }' is not assignable to type '{ value: unknown; label?: string; disabled?: boolean; asChild?: boolean | undefined; el?: HTMLDivElement | undefined; }' with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined' to the types of the target's properties.
Types of property 'label' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'. (ts)
For now, I'll just turn off "exactOptionalPropertyTypes": false
.
Please let me know if I can help with this.
Thanks.
Cc: @Stadly
I've created a pull requeset in Melt UI that should fix most (probably all) of these: https://github.com/melt-ui/melt-ui/pull/1256. Feel free to give it an upvote :)
Yeah @shyakadavis this tsconfig option kinda sucks with Svelte 4 due to how the types are handled with optional props. This should be irrelevant with the Svelte 5 version.
Describe the bug
This could be a follow-up to #621
Right now, when assigning this
orientation
propto
<SeparatorPrimitive.Root />
, you get the error:Would have opened a P.R, but noticed the separator types come from Melt (https://github.com/huntabyte/bits-ui/blob/main/packages/bits-ui/src/lib/bits/separator/types.ts), so please feel free to close if it's an upstream issue.
Thanks.
Reproduction
N/A
Logs
No response
System Info
Severity
annoyance