orval icon indicating copy to clipboard operation
orval copied to clipboard

Faker types are incompatible with contract definition for number enums

Open artur-ptaszek-mck opened this issue 9 months ago • 0 comments

What are the steps to reproduce this issue?

  1. Create a contract with the following property:
{
  "type": "number",
  "enum": [
    2
  ],
  "nullable": true
}
  1. Faker produces the following:
type: faker.helpers.arrayElement([
  faker.number.int({ min: undefined, max: undefined }),
  null,
]),
  1. 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:

artur-ptaszek-mck avatar May 22 '24 09:05 artur-ptaszek-mck