0.2.5 #43
@@ -23,13 +23,9 @@ extends Pipeable.Pipeable {
|
|||||||
readonly canSubmit: Subscribable.Subscribable<boolean, never, never>
|
readonly canSubmit: Subscribable.Subscribable<boolean, never, never>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const FormImplTypeId: unique symbol = Symbol.for("@effect-fc/Form/FormImpl")
|
|
||||||
export type FormImplTypeId = typeof FormImplTypeId
|
|
||||||
|
|
||||||
export class FormImpl<in out P extends readonly PropertyKey[], in out A, in out I = A, in out ER = never, in out EW = never>
|
export class FormImpl<in out P extends readonly PropertyKey[], in out A, in out I = A, in out ER = never, in out EW = never>
|
||||||
extends Pipeable.Class() implements Form<P, A, I, ER, EW> {
|
extends Pipeable.Class() implements Form<P, A, I, ER, EW> {
|
||||||
readonly [FormTypeId]: FormTypeId = FormTypeId
|
readonly [FormTypeId]: FormTypeId = FormTypeId
|
||||||
readonly [FormImplTypeId]: FormImplTypeId = FormImplTypeId
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly path: P,
|
readonly path: P,
|
||||||
@@ -64,9 +60,12 @@ extends Form<readonly [], A, I, never, never> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class RootFormImpl<in out A, in out I = A, in out R = never, in out MA = void, in out ME = never, in out MR = never, in out MP = never>
|
export class RootFormImpl<in out A, in out I = A, in out R = never, in out MA = void, in out ME = never, in out MR = never, in out MP = never>
|
||||||
extends FormImpl<readonly [], A, I> implements RootForm<A, I, R, MA, ME, MR, MP> {
|
extends Pipeable.Class() implements RootForm<A, I, R, MA, ME, MR, MP> {
|
||||||
|
readonly [FormTypeId]: FormTypeId = FormTypeId
|
||||||
readonly [RootFormTypeId]: RootFormTypeId = RootFormTypeId
|
readonly [RootFormTypeId]: RootFormTypeId = RootFormTypeId
|
||||||
|
|
||||||
|
readonly path = [] as const
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
readonly schema: Schema.Schema<A, I, R>,
|
readonly schema: Schema.Schema<A, I, R>,
|
||||||
readonly context: Context.Context<Scope.Scope | R>,
|
readonly context: Context.Context<Scope.Scope | R>,
|
||||||
@@ -85,14 +84,7 @@ extends FormImpl<readonly [], A, I> implements RootForm<A, I, R, MA, ME, MR, MP>
|
|||||||
|
|
||||||
readonly runSemaphore: Effect.Semaphore,
|
readonly runSemaphore: Effect.Semaphore,
|
||||||
) {
|
) {
|
||||||
super(
|
super()
|
||||||
[],
|
|
||||||
value,
|
|
||||||
encodedValue,
|
|
||||||
error,
|
|
||||||
isValidating,
|
|
||||||
canSubmit,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get run(): Effect.Effect<void> {
|
get run(): Effect.Effect<void> {
|
||||||
@@ -166,7 +158,6 @@ extends FormImpl<readonly [], A, I> implements RootForm<A, I, R, MA, ME, MR, MP>
|
|||||||
|
|
||||||
|
|
||||||
export const isForm = (u: unknown): u is Form<readonly PropertyKey[], unknown, unknown> => Predicate.hasProperty(u, FormTypeId)
|
export const isForm = (u: unknown): u is Form<readonly PropertyKey[], unknown, unknown> => Predicate.hasProperty(u, FormTypeId)
|
||||||
export const isFormImpl = (u: unknown): u is FormImpl<readonly PropertyKey[], unknown, unknown> => Predicate.hasProperty(u, FormImplTypeId)
|
|
||||||
export const isRootForm = (u: unknown): u is RootForm<readonly PropertyKey[], unknown, unknown, unknown, unknown, unknown, unknown> => Predicate.hasProperty(u, RootFormTypeId)
|
export const isRootForm = (u: unknown): u is RootForm<readonly PropertyKey[], unknown, unknown, unknown, unknown, unknown, unknown> => Predicate.hasProperty(u, RootFormTypeId)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user