You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our current implementation has the following issue:
Schema are typed as FormSchema without specifying a generic type argument. example
This means the generic type defaults to FormData, which is just { [key: string]: any }, which causes most of our interactions with the form/library to be untyped (or, more specifically, to have the any type).
Instead, we should be declaring our schema similar to the following:
constschema: FormSchema<DefineStepRule>={//...
And fixing all type errors that result from that.
There also seems to be an issue with the library itself, where providing a type parameter to FormSchema does not narrow the index signature of FormSchema, and so dealing with specific keys in the schema may still be untyped. My naive solution would start with this change:
As mentioned above #60602 addressed the specific issue pointed out here. We still had a few ugly casts in our forms, but those were also addressed in #80842. IMO we're in a great position for now so I'm happy to close this. Thanks for all your help @sebelga !
Our current implementation has the following issue:
Schema are typed as
FormSchema
without specifying a generic type argument. exampleThis means the generic type defaults to
FormData
, which is just{ [key: string]: any }
, which causes most of our interactions with the form/library to be untyped (or, more specifically, to have theany
type).Instead, we should be declaring our schema similar to the following:
And fixing all type errors that result from that.
There also seems to be an issue with the library itself, where providing a type parameter to
FormSchema
does not narrow the index signature ofFormSchema
, and so dealing with specific keys in the schema may still be untyped. My naive solution would start with this change:The text was updated successfully, but these errors were encountered: