Skip to content

Commit

Permalink
fix(types): types for fieldErrors (#29)
Browse files Browse the repository at this point in the history
* chore: lint fix

* fix: fieldErrors keys autocomplete

* fix: a little more definitive type
  • Loading branch information
barelyhuman authored May 28, 2024
1 parent ce67123 commit c608216
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/atomWithFormControls.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WritableAtom, atom } from 'jotai/vanilla';
import { atom, WritableAtom } from 'jotai/vanilla';
import type {
ExtractTypeOfValidatorValue,
Validator,
Expand All @@ -19,7 +19,7 @@ export type ActionableNext = {
export type FormControls<Keys extends string, Vals> = {
isValid: boolean;
fieldErrors: {
[k: string]: any;
[k in Keys]: string | Error | any;
};
touched: Record<Keys, boolean>;
focused: Record<Keys, boolean>;
Expand Down
2 changes: 1 addition & 1 deletion src/atomWithValidate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { atom } from 'jotai/vanilla';
import type { WritableAtom, SetStateAction } from 'jotai/vanilla';
import type { SetStateAction, WritableAtom } from 'jotai/vanilla';

export type CommonState<Value> = {
value: Value;
Expand Down

0 comments on commit c608216

Please sign in to comment.