You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So declare a constructor function, and then derive a type from it's return-type.
The disconnect here seems to be that, while signals can only be created as an object, only the derived individual properties of the returned type currently have an explicit generic type?
I don't actually need the constructor function, it's only there so I can derive a type - in this simple case, I'd prefer to have the static type only, without the run-time footprint.
Can we have a generic type for this? Something like:
typeTodo=Signals<{title: string,done: boolean}>;
The text was updated successfully, but these errors were encountered:
How do you define a type for a signal-based model?
The best pattern I could find thus far is something like this:
So declare a constructor function, and then derive a type from it's return-type.
The disconnect here seems to be that, while signals can only be created as an object, only the derived individual properties of the returned type currently have an explicit generic type?
https://github.com/heyheyhello/haptic/blob/57f989a1ff1a0c62cfced149056c75646a3c8f63/src/state/index.ts#L274-L275
I don't actually need the constructor function, it's only there so I can derive a type - in this simple case, I'd prefer to have the static type only, without the run-time footprint.
Can we have a generic type for this? Something like:
The text was updated successfully, but these errors were encountered: