Skip to content
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

fix(typings): incompatible type issue for nested strict object schemas #2785

Closed
wants to merge 1 commit into from

Conversation

LeoAso
Copy link

@LeoAso LeoAso commented May 21, 2022

The type issue that prevented strict object schemas from being nested has been resolved. The following is no longer incorrectly flagged as an error.

interface ObjType {
  firstName: string;
  lastName: string;
  nestedObject: {
    middleName: string;
  }
}

// no errors
Joi.object<ObjType, true>({
  firstName: Joi.string(),
  lastName: Joi.string(),
  nestedObject: Joi.object<ObjType['nestedObject'], true>({
    middleName: Joi.string()
  })
})

This PR fixes #2764.

@phillip-kil
Copy link

@LeoAso What is the state of this? We are heavily relying on this and have a lot of workarounds we'd like to get rid of :)

@LeoAso
Copy link
Author

LeoAso commented Aug 3, 2022

@phillip-kil It seems the maintainers haven't gotten around to reviewing it yet.

@Marsup
Copy link
Collaborator

Marsup commented Aug 20, 2022

This looks fine, although, would you mind adding tests in this file to avoid any further regression?

@Marsup Marsup self-assigned this Sep 12, 2022
@Marsup Marsup self-requested a review September 12, 2022 22:48
@Marsup Marsup added bug Bug or defect types TypeScript type definitions labels Sep 12, 2022
@Marsup Marsup added this to the 17.6.1 milestone Sep 17, 2022
@Marsup
Copy link
Collaborator

Marsup commented Sep 17, 2022

Superseded by #2836, thanks for doing the initial work though!

@Marsup Marsup closed this Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug or defect types TypeScript type definitions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incompatible type expected for object schemas nested in strict object schemas
3 participants