Override side effect dise function within diInit callback
const userId = dic<number>()const user = dic<{age: number; id: number; name: string;}>()const fetchUser = dise( id => db.query('select * from users where id = $1', [id]), user, userId)diseSet(fetchUser, id => id === 1 ? {age: 30, id: 1, name: 'Alice'} : null)userId(1)await fetchUser()user() // {age: 30, id: 1, name: 'Alice'} Copy
const userId = dic<number>()const user = dic<{age: number; id: number; name: string;}>()const fetchUser = dise( id => db.query('select * from users where id = $1', [id]), user, userId)diseSet(fetchUser, id => id === 1 ? {age: 30, id: 1, name: 'Alice'} : null)userId(1)await fetchUser()user() // {age: 30, id: 1, name: 'Alice'}
Override side effect dise function within diInit callback
Example