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

Faker types are incompatible with contract definition for number enums #1395

Closed
artur-ptaszek-mck opened this issue May 22, 2024 · 0 comments · Fixed by #1437
Closed

Faker types are incompatible with contract definition for number enums #1395

artur-ptaszek-mck opened this issue May 22, 2024 · 0 comments · Fixed by #1437
Labels
mock Related to mock generation
Milestone

Comments

@artur-ptaszek-mck
Copy link

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:

@melloware melloware added the mock Related to mock generation label May 22, 2024
@melloware melloware added this to the 6.30.0 milestone Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mock Related to mock generation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants