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

Typing issues with attempt() #2857

Closed
schw4rzlicht opened this issue Oct 6, 2022 · 1 comment · Fixed by #2860
Closed

Typing issues with attempt() #2857

schw4rzlicht opened this issue Oct 6, 2022 · 1 comment · Fixed by #2860
Assignees
Labels
support Questions, discussions, and general support types TypeScript type definitions
Milestone

Comments

@schw4rzlicht
Copy link

schw4rzlicht commented Oct 6, 2022

Support plan

  • is this issue currently blocking your project? (yes/no): no
  • is this issue affecting a production system? (yes/no): no

Context

  • node version: 14.19.3
  • module version with issue: 17.6.1 / 17.6.2
  • last module version without issue: 17.6.0
  • environment (e.g. node, browser, native): node
  • used with (e.g. hapi application, another framework, standalone, ...): ?
  • any other relevant information: n/a

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

let apiKey: string | undefined = "someString";
apiKey = Joi.attempt(apiKey, Joi.string().optional().label("apiKey"));

What was the result you got?

TS2322: Type 'unknown' is not assignable to type 'string | undefined'.

What result did you expect?

No TS errors.

I suspect the changes from #2797 to be the root cause.

@schw4rzlicht schw4rzlicht added the support Questions, discussions, and general support label Oct 6, 2022
schw4rzlicht added a commit to LOUD-GmbH/diggithy-sdk that referenced this issue Oct 6, 2022
@bozolia
Copy link

bozolia commented Oct 10, 2022

Same issue, upgrading joi version from ^17.6.0 → ^17.6.2 made my project not to compile.

@Marsup Marsup self-assigned this Oct 11, 2022
@Marsup Marsup added this to the 17.6.3 milestone Oct 11, 2022
@Marsup Marsup added the types TypeScript type definitions label Oct 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Questions, discussions, and general support types TypeScript type definitions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants