mirror of
https://github.com/littensy/charm.git
synced 2026-10-20 17:51:37 +00:00
refactor: use new type solver
This commit is contained in:
parent
748dbc5014
commit
22b440e35f
32 changed files with 169 additions and 155 deletions
|
|
@ -11,7 +11,7 @@ local Vide = require("./Vide")
|
|||
local function useSignalState<State>(getter: () -> State): () -> State
|
||||
local state = Vide.source(getter())
|
||||
|
||||
Vide.cleanup(Charm.listen(getter, state))
|
||||
Vide.cleanup(Charm.listen(getter, state :: (State, State?) -> ()))
|
||||
|
||||
return state
|
||||
end
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ local test = require("../../../tests/test")
|
|||
|
||||
test("tracks signal state", function()
|
||||
local getState, setState = Charm.signal(0)
|
||||
local source
|
||||
local source: () -> number
|
||||
local cleanup = Vide.root(function()
|
||||
source = VideCharm.useSignalState(getState)
|
||||
end)
|
||||
|
|
@ -17,7 +17,7 @@ end)
|
|||
|
||||
test("accepts a selector", function()
|
||||
local getState, setState = Charm.signal(0)
|
||||
local source
|
||||
local source: () -> number
|
||||
local cleanup = Vide.root(function()
|
||||
source = VideCharm.useSignalState(function()
|
||||
return 2 * getState()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue