0.1.4 #5
@@ -15,7 +15,9 @@ extends Pipeable.Pipeable {
|
||||
readonly encodedValueRef: SubscriptionRef.SubscriptionRef<I>,
|
||||
readonly errorRef: SubscriptionRef.SubscriptionRef<Option.Option<ParseResult.ParseError>>,
|
||||
|
||||
makeFieldIssuesSubscribable<P extends PropertyPath.Paths<A>>(path: P): Subscribable.Subscribable<readonly ParseResult.ArrayFormatterIssue[]>
|
||||
makeFieldIssuesSubscribable<const P extends PropertyPath.Paths<A>>(
|
||||
path: P
|
||||
): Subscribable.Subscribable<readonly ParseResult.ArrayFormatterIssue[]>
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +34,7 @@ extends Pipeable.Class() implements Form<A, I, R> {
|
||||
super()
|
||||
}
|
||||
|
||||
makeFieldIssuesSubscribable<P extends PropertyPath.Paths<A>>(path: P) {
|
||||
makeFieldIssuesSubscribable<const P extends PropertyPath.Paths<A>>(path: P) {
|
||||
const filter = Option.match({
|
||||
onSome: (v: ParseResult.ParseError) => Effect.andThen(
|
||||
ParseResult.ArrayFormatter.formatError(v),
|
||||
@@ -82,7 +84,7 @@ export namespace useInput {
|
||||
}
|
||||
|
||||
export const useInput: {
|
||||
<A, I, R, const P extends PropertyPath.Paths<I>>(
|
||||
<A, I, R, const P extends PropertyPath.Paths<NoInfer<I>>>(
|
||||
self: Form<A, I, R>,
|
||||
path: P,
|
||||
options?: useInput.Options,
|
||||
|
||||
@@ -28,7 +28,7 @@ export type Paths<T, D extends number = 5, Seen = never> = readonly [] | (
|
||||
never
|
||||
)
|
||||
|
||||
export type ValueFromPath<T, P extends readonly any[]> = P extends [infer Head, ...infer Tail]
|
||||
export type ValueFromPath<T, P extends readonly any[]> = P extends readonly [infer Head, ...infer Tail]
|
||||
? Head extends keyof T
|
||||
? ValueFromPath<T[Head], Tail>
|
||||
: T extends readonly any[]
|
||||
|
||||
@@ -20,8 +20,8 @@ class RegisterForm extends Effect.Service<RegisterForm>()("RegisterForm", {
|
||||
|
||||
class RegisterPage extends Component.makeUntraced(function* RegisterPage() {
|
||||
const form = yield* RegisterForm
|
||||
const emailInput = yield* Form.useInput(form, ["email"])
|
||||
const passwordInput = yield* Form.useInput(form, ["password"])
|
||||
const emailInput = yield* Form.useInput(form, ["email"], { debounce: "200 millis" })
|
||||
const passwordInput = yield* Form.useInput(form, ["password"], { debounce: "200 millis" })
|
||||
|
||||
yield* useFork(() => Stream.runForEach(form.valueRef.changes, Console.log), [])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user