question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[**NOT RESOLVED**][Typing] Nested schemas properties are marked as any

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:4
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
jquensecommented, Sep 30, 2020

types aren’t maintained here currently open an Issue on DT please

4reactions
adil-waqarcommented, Jun 8, 2021

@jquense The issue still persists, even in the latest version of yup.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python jsonschema unable to validate JSON schema ...
Look. remote_os in our data is a string, but it has been defined in the schema as being an object. Remove type: object...
Read more >
Advanced topics on federated entities - Apollo GraphQL Docs
This article describes complex behaviors of federated entities beyond those covered in entity basics. Advanced @key s. A single entity can have multiple...
Read more >
Structuring a complex schema — Understanding JSON ...
When an object contains a $ref property, the object is considered a reference, not a schema. Therefore, any other properties you put in...
Read more >
Setting crawler configuration options - AWS Glue
Remove any metadata that is not set by the crawler. ... such as classification, compression type, or CSV delimiter, mark the table as...
Read more >
Type Constraints - Configuration Language | Terraform
In this case, Terraform will replace any with the exact type of the given value and thus perform no type conversion whatsoever. Optional...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found