I am trying to enforce the interface ITest on testObj. However, with yup.ObjectSchema<ITest>, when i try to infer the available parameters with methods.watch(), I am unable to get them. If i remove yup.ObjectSchema<ITest>, then It works. Is there something I am doing wrong? How else do I enforce my schema type while still ensuring that I can infer the types correctly?
With the example code below,
I am trying to enforce the interface
ITest
ontestObj
. However, withyup.ObjectSchema<ITest>
, when i try to infer the available parameters withmethods.watch()
, I am unable to get them. If i removeyup.ObjectSchema<ITest>
, then It works. Is there something I am doing wrong? How else do I enforce my schema type while still ensuring that I can infer the types correctly?SCENARIO 1, WITHOUT
yup.ObjectSchema<ITest>
:SCENARIO 2, WITH
yup.ObjectSchema<ITest>
I lose all type inference.How do I achieve scenario 1 but still have the type enforcement with
yup.ObjectSchema<ITest>
?