Check if value is a Solid signal #2146
Unanswered
magicmatatjahu
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
HI! I am wondering if there's a possibility to check if value passed to function is a Solid signal. As I see, all getter of signal is a bounded
readSignalfunction, however, it's not possible to check the original function from the getter. E.g. Angular provides a functionisSignaland based on that, you can read the state from the signal by calling it or through the functionuntracked- if you want to get out of reactivity system.Background: I'm writing SolidJS integration for my library, and in 99% of cases my API won't need reactivity (because the function result should be 99% static across component), whereas if a signal is used as argument (via a getter reference, not a value) the function result could be changed to a signal (based on TS overload types).
Atm I can do it in this way, to override native
.bindfunction:but it's very ugly solution, because all
.bindcalls in code will have an above side effect and alsorecognizeSignalfunction needs to be called before any previous code.If a similar question has already been asked before, sorry for unnecessary post and would ask for a link to the discussion/issue, thanks!
Beta Was this translation helpful? Give feedback.
All reactions