Open GiyoMoon opened 9 months ago
Currently combineProps
is just using the MergeProps
type from solid, so mergeProps
has the same issue from what I see: https://playground.solidjs.com/anonymous/06bd1b95-c609-4d66-93ef-656ee931fba2
Also it's interesting how the same code has no problems without jsx:
I get the same error for compineProps
, even in .ts file, if I slightly change the function signature:
// from
export function combineProps<T extends [] | MaybeAccessor<PropsInput>[]>(...sources: T): MergeProps<T>
// to
export function combineProps<T extends unknown[]>(...sources: T): MergeProps<T>
Which shouldn't change anything
Ok it has nothing to do with MaybeAccessor<PropsInput>
part, the same difference is also between unknown[]
and [] | unknown[]
, where the latter just makes the type to be inferred as a tuple.
Overwriting the children
prop in combineProps
rather than jsx seems to fix it.
Which is probalby a better way in general, because it doesn't cause another mergeProps
to be compiled in to handle the overwritting.
const merged = combineProps(props, {
get children(){
return <div>children</div>
}
})
return <Dynamic {...merged}/>
Maybe this should be reopened on solidjs repo as well. Although the usage seems incorrect, because of mentioned issue with multiple mergeProps
.
Describe the bug
I noticed that
combineProps
throws a type error when upgrading to typescript 5.3. In typescript <=5.2, the same code worked without issues.Minimal Reproduction Link
https://github.com/GiyoMoon/solid-primitives-type-error