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

TS Error: argument of type 'number' is not assignable to parameter of type 'string | Blob' #845

Open
chiptus opened this issue Apr 30, 2023 · 1 comment · May be fixed by #1336
Open

TS Error: argument of type 'number' is not assignable to parameter of type 'string | Blob' #845

chiptus opened this issue Apr 30, 2023 · 1 comment · May be fixed by #1336
Labels
bug Something isn't working
Milestone

Comments

@chiptus
Copy link
Contributor

chiptus commented Apr 30, 2023

Wow, this tool is amazing, it has everything we need to make types generation automatic (until now we did by hand when needed)

What are the steps to reproduce this issue?

I have this schema:

/endpoints:
    post:
      consumes:
      - multipart/form-data
      parameters:
      - collectionFormat: csv
        description: List of tag identifiers to which this environment(endpoint) is
          associated
        in: formData
        items:
          type: integer
        name: TagIds
        type: array

What happens?

Screenshot_20230430_184400

What were you expecting to happen?

no error. so code should probably be:

if (endpointCreateBody.TagIds !== undefined) {
    endpointCreateBody.TagIds.forEach((value) =>
      formData.append('TagIds', String(value))
    );
  }

Any logs, error output, etc?

Argument of type 'number' is not assignable to parameter of type 'string | Blob'

What versions are you using?

Operating System: ubuntu
Package Version: v6.15.0
Browser Version: not in browser

@jamalsoueidan
Copy link

I changed all boolean to string and integer or number to string, I convert them back to number when it hits the endpoint.
I don't know if their is any solution to the problem.

export const NumberOrStringType = z
  .union([z.number(), z.string()])
  .transform((value) =>
    typeof value === "string" ? parseInt(value, 10) : value
  );

@melloware melloware added the bug Something isn't working label Nov 3, 2023
@BijanRegmi BijanRegmi linked a pull request Apr 29, 2024 that will close this issue
3 tasks
@melloware melloware added this to the 6.28.0 milestone Apr 29, 2024
@melloware melloware modified the milestones: 6.28.0, 6.29.0, 6.30.0 May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants