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

Wrong typing for object #85

Open
meabed opened this issue Nov 9, 2021 · 7 comments
Open

Wrong typing for object #85

meabed opened this issue Nov 9, 2021 · 7 comments

Comments

@meabed
Copy link

meabed commented Nov 9, 2021

The typing for "object" is wrong in latest release.
The key could be string | number or anything.
This has been changed in latest release.
image

@anttiviljami
Copy link
Member

@meabed can you be more specific?

Is this related to the openapi-client-axios-typegen package?

@meabed
Copy link
Author

meabed commented Nov 9, 2021

Thanks @anttiviljami, yes it's the typegen package.

@anttiviljami
Copy link
Member

Can you clarify?

What exactly changed? What is the desired/expected behaviour?

@meabed
Copy link
Author

meabed commented Nov 9, 2021

Sure,
The previous behavior is swagger with property "object", for example:

"properties": {
  "metadata": {
    "description": "",
    "type": "object"
  }
}

it generate typing

metadata?: {}

After the last update, it generates types as:

  metadata?: {
      [key: string]: any;
  };

Which is wrong because key could be number / undefined / null / string. I think it might be an issue with dtsgenerator?

Thanks!

@lmarvaud
Copy link
Contributor

Hey there,

you should report this error on https://github.com/horiuchi/dtsgenerator (used by : https://github.com/anttiviljami/dtsgenerator)

@anttiviljami
Copy link
Member

This is an upstream issue with dtsgenerator but I’ll leave this open for the time being to track

@paulwer
Copy link

paulwer commented Apr 4, 2023

did someone report this already? / any updates?

in my case this happens, when defining: oneOf: [{ type: 'string' }, { type: 'number' }]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants