Incorrectly loose types for strict object schema for non-string values
- Dominant language
- JavaScript
- Stars
- 21.2k
- Forks
- 1.5k
- Avg merge
- 4h 57m
- Merged PRs (30d)
- 14
Description
#### 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*: 20.0.5
* *module version with issue*: 17.11.0, master branch
* *last module version without issue*:
* *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?
```ts
interface User2 {
id?: number
}
Joi.object({
id: Joi.string().optional()
});
```
#### What was the result you got?
No warning despite id being string
#### What result did you expect?
Typescript warning that string schema is not assignable to number schema
This seems to work as a fix, I would create a PR but I couldn't get the test to work correctly, it still said `Expected an error` even though after the change TypeScript warned about it

Contributor guide
Assessment
This issue has not been assessed yet.