Skip to content

Commit

Permalink
fix(types): PrimitiveAtom extends PrimitiveAtom is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
MiroslavPetrik committed Mar 6, 2024
1 parent 621ac4a commit edf45c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/atoms/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export * from "./list-atom";
export * from "./extendAtom";
export * from "./types";
2 changes: 1 addition & 1 deletion src/atoms/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Atom, PrimitiveAtom } from "jotai";

export type ExtendFieldAtom<Value, State> =
FieldAtom<Value> extends Atom<infer DefaultState>
? PrimitiveAtom<DefaultState & State> // fieldAtom is in practice writable - PrimitiveAtom
? Atom<DefaultState & State>
: never;

export type PrimitiveFormAtom<Fields extends FormFields> =
Expand Down

0 comments on commit edf45c1

Please sign in to comment.