diff --git a/src/vanilla/utils/atomFamily.ts b/src/vanilla/utils/atomFamily.ts index 3ce5bcbb02..4667354890 100644 --- a/src/vanilla/utils/atomFamily.ts +++ b/src/vanilla/utils/atomFamily.ts @@ -1,6 +1,10 @@ import { type Atom } from '../../vanilla.ts' -type ShouldRemove = (createdAt: number, param: Param) => boolean +/** + * in milliseconds + */ +type CreatedAt = number +type ShouldRemove = (createdAt: CreatedAt, param: Param) => boolean type Cleanup = () => void type Callback = (event: { type: 'CREATE' | 'REMOVE' @@ -29,7 +33,6 @@ export function atomFamily>( initializeAtom: (param: Param) => AtomType, areEqual?: (a: Param, b: Param) => boolean, ) { - type CreatedAt = number // in milliseconds let shouldRemove: ShouldRemove | null = null const atoms: Map = new Map() const listeners = new Set>()