yup: [**NOT RESOLVED**][Typing] Nested schemas properties are marked as any
Describe the bug
This is using the @types/yup
package.
Define the following schema:
export const test = object({
prop: string(),
otherProp: object({
subProp: string(),
})
});
When compiled, this will output a .d.ts
file with the following:
export declare const test: import("yup").ObjectSchema<{
prop: string | undefined;
otherProp: {
subProp: any;
} | undefined;
} | undefined>;
To Reproduce
View the code sandbox.
To rebuild the Typescript, you can open a new terminal and type yarn build
.
https://codesandbox.io/s/yup-type-problem-inxy7
Expected behavior The nested properties are typed properly.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 4
- Comments: 15 (5 by maintainers)
types aren’t maintained here currently open an Issue on DT please
@jquense The issue still persists, even in the latest version of yup.
I updated the codesandbox. There is definitely some weird stuff still in the code: https://codesandbox.io/s/yup-type-problem-inxy7
The latest version of yup has its own types if you follow the docs for TS config this should work fine
Definately, more eyes on that is helpful and appreciated