Skip to content

Commit

Permalink
fix: add undefined initial value to Atom definition
Browse files Browse the repository at this point in the history
  • Loading branch information
rtritto committed Jul 20, 2024
1 parent debff8b commit 65fd147
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/vanilla/atom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ export function atom<Value, Args extends unknown[], Result>(
// read-only derived atom
export function atom<Value>(read: Read<Value>): Atom<Value>

// Value with default as initial value
export function atom<Value = undefined>(
read: Read<Value | undefined>,
): Atom<Value | undefined>

// write-only derived atom
export function atom<Value, Args extends unknown[], Result>(
initialValue: Value,
Expand Down

0 comments on commit 65fd147

Please sign in to comment.