jotaijs / jotai-form

Form atoms for Jotai
MIT License
135 stars 1 forks source link

Missing some exports from default index (TypeScript) #22

Closed daniel-rodrigue closed 9 months ago

daniel-rodrigue commented 9 months ago

The SyncState, AsyncState and likely others exports from atomWithFormControls and validateAtoms are not re-exported in default index.

As a consequence, if I want to declare an helper type for a string atom in my code, like:

export type StringAtom = WritableAtom<SyncState<string>, [SetStateAction<string>], void>;

for something like the following to hold 2 atoms:

interface Foo {
    name: StringAtom;
    description: StringAtom;
}

I need to import SyncState directly from there:

import { SyncState } from "jotai-form/dist/src/atomWithValidate"; // not great since this could change one day

instead of:

import { atomWithValidate, SyncState } from "jotai-form";

barelyhuman commented 9 months ago

Valid point,

though I'd left them internal because it's a bit of mix and match between the sync and async and then there's derived types from that that'd also need to be exported and anyone writing a utility would have a hard time knowing about each derivation.

That though is a side-effect of the concept of building atop atoms, so I guess most solutions would also involve the derivation.

I'll export them out, one sec

barelyhuman commented 9 months ago

A bump to the latest should ease it for you :) https://github.com/jotaijs/jotai-form/releases/tag/v0.1.4

daniel-rodrigue commented 9 months ago

Woah! You are so fast! This is awesome. Thank you.