Hacker News new | ask | show | jobs
by SebastianKra 381 days ago
There's an issue when integrating Signals (or Stores) directly into templates. TypeScript becomes unable to track how bindings relate to each other.

This is described in the Solid documentation: https://docs.solidjs.com/configuration/typescript#control-fl...

In my experience with data-binding, these instances of disabling the typesystem accumulated, and became a frequent source of bugs.

So even though I hope for Signals to catch on, I believe the best way of connection to them will still be React:

  function Output({ userSignal }) {
    const user = useSignal(userSignal)
    if (!user) return <span>No user found</span>
    return <span>{user.firstName} {user.lastName}</span> /* TypeScript knows that user must be defined */
  }