orval
orval copied to clipboard
Faker types are incompatible with contract definition for number enums
What are the steps to reproduce this issue?
- Create a contract with the following property:
{
"type": "number",
"enum": [
2
],
"nullable": true
}
- Faker produces the following:
type: faker.helpers.arrayElement([
faker.number.int({ min: undefined, max: undefined }),
null,
]),
- Which then leads to this Typescript error
typescript: Type 'number | null' is not assignable to type 'EnumType'.
Type 'number' is not assignable to type 'EnumType'. [2322]
What happens?
…
What were you expecting to happen?
Not having a Typescript error
Any logs, error output, etc?
…
Any other comments?
…
What versions are you using?
Operating System: macOS Package Version: 6.29.1 Browser Version: …