-
-
Notifications
You must be signed in to change notification settings - Fork 929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic
returns a function, contrary to its Typescript signature (as of v1.7)
#1763
Comments
Dynamic
returns a function, contrary to its Typescript signatureDynamic
returns a function, contrary to its Typescript signature (as of v1.7)
The reason functions were removed from the |
I heard there may be ways to address this differently in TypeScript now. But this is as intended. If you use it directly you need to cast. Since our release this was added to TS which might help us? microsoft/TypeScript#51328 I'm more the than willing to see if there is a way so that we can handle both sides a bit differently but I think that is general approach thing and I am going to close this one as by design for now. |
Ah whoops yeah forgot to close. Got sucked into that (excellent) 5hr stream. Also linking this discussion for any future searchers. |
For reasons [1] [2], I want to invoke
Dynamic
as a function, not as JSX, like so:Typescript says
dynamic
is of typeJSX.Element
, when really it is a function whose name is"bound readSignal"
.More details that are probably not helpful but I spent too long writing to not include.
The same happens if I wrap `Dynamic` in a `createComponent`:This does not occur for ordinary Components:
Playground demoing Typescript errors: https://playground.solidjs.com/anonymous/1eaedcbb-4e59-445b-84cf-00b7792a983c
This change to
Dynamic
was introduced in this v1.7 commit/PR, whenAccessor<JSX.Element>
was removed from the return type andas unknown as JSX.Element
was added. The reasoning for this is unclear to me; the commit comment was "Remove FunctionElement from JSX.Element types". What work would need to be done to not lie to Typescript?The text was updated successfully, but these errors were encountered: