Skip to content

Typescript typing on Joi.string().validate(...) #2753

Description

@Nokel81

Context

  • node version: 14.17.X
  • module version with issue: 17.5.0
  • last module version without issue: 17.5.0
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): standalone
  • any other relevant information:

What are you trying to achieve or the steps to reproduce?

const schema = Joi.string();
const result = schema.validate(getUnknownValue());

if (!result.error) {
  result.value; // typed as `any` but should be `string`
}

What was the result you got?

The result of Joi.string().validate(...) has the field value typed as any.

What result did you expect?

The result of Joi.string().validate(...) has the field value typed as string.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

typesTypeScript type definitions

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions