-
-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Explicit form types introduced on v3.6.0 #1083
Comments
Hi @afmfe-iul! You've found the correct suspect here - #1003. And yes, as a current workaround, casting the form to Now, let's get to the errors step by step:
I'd love to hear your suggestions here: @afmfe-iul, @wadamek65, @kestarumper, @Monteth. |
Ad. 3: I'm also not sure, because even though a passed validation should ensure the model to be present there in most cases, there are situations where that is not true, for example in custom bridges. Maybe another approach would be to not try to type this at all and instead force the user to? Like make it an |
Small update: we'll keep it the way it is for a little more time and discuss it internally once again. Especially as we're already discussing v4. If you have any ideas or points about this topic - do let us know here. |
Hey @radekmie and @wadamek65 ! Thanks for the explanation on each point and for the update. Unfortunately I don't have suggestions on how to solve these issues (my knowledge of your source code is not deep), however generics is something we use frequently on our project and are used to deal with with other packages, it would be an awesome first step away from the current fix. For us types are essential, they greatly increase our confidence and speed, so we try to have as little as possible occurrences of PS- For context, currently we have 22 forms, some with 20-30 fields and conditions, all using |
Hey there!
On our project we use uniforms and TypeScript (v4.5.4) extensively and last week we upgraded
uniforms
/uniforms-semantic
/uniforms-bridge-json-schema
from v3.5.5 to version v3.7.0, which caused a couple of type errors. After going through the changelog we found out that very likely #1003 (from v3.6.0) is where the issues started.Specifically we are getting errors on
AutoForm
prop types:className
is not a valid prop, however adding one works;onChangeModel
is not a valid prop;onSubmit
is of type(model: DeepPartial<Model>) => void | Promise<any>
, however we always assumed that it would be(model: Model) => void | Promise<any>
because if you passed validation (and you typed everything correctly) by the time you reach submission your model would be matching the required type.Here is a simple example on CodeSandbox (however sometimes the compiler errors don't show because their compiler is fixed at 4.4.4 it seems). If you try this example outside CodeSandbox, with TS 4.5.4, you might get the same results as we.
Currently the workaround we are using is the one sugest on the FAQ (use of
any
).Would love to get your thoughts on the points above!
The text was updated successfully, but these errors were encountered: