42-px / effector-forms

108 stars 16 forks source link

TypeScript broken #5

Closed golovinstan closed 1 year ago

golovinstan commented 3 years ago

image

golovinstan commented 3 years ago

image

aanation commented 3 years ago

@golovinstan form.$values it's generic type FormValues<T>.

Type:

brigadeForm.$values.getState().avarRefereeId

and check type of avarRefereeId

golovinstan commented 3 years ago

combine dont accept brigadeForm.$values.getState()

aanation commented 3 years ago

@golovinstan Let's take a closer look: Screenshot from 2021-01-11 21-08-04

It's generic

golovinstan commented 3 years ago

It's not { cityId: { init: string; rules: Rule<string, any, any>[]; validateOn: ("change" | "blur")[] }, ... }

aanation commented 3 years ago

@golovinstan Yes, because it's GENERIC of { cityId: { init: string; rules: Rule<string, any, any>[]; validateOn: ("change" | "blur")[] },

Effecor-forms infer's the type of form.$values ​​using the generic type FormValues

MyType<AnotherType> and AnotherType are different types.

https://www.typescriptlang.org/docs/handbook/generics.html