跳转到内容

IoUnit

当你需要复用类型结构时使用此类型别名。

IoUnit<T>
NameType
get() => T
set(next: T | ((prev: T) => T)) => void
snapshot() => T
subscribe(fn: (v: T) => void) => IoUnsubscribe
subscribeUpdate(fn: (u: IoUpdate) => void) => IoUnsubscribe
reset() => void
import type { IoUnit } from '@iostore/store';
let value!: IoUnit;
console.log(value);
  • 避免在用户文档中展开过于复杂的类型细节。
  • 调整类型别名时注意下游兼容性。
  • packages/io/src/lib/utils/types/types.ts