-
-
Notifications
You must be signed in to change notification settings - Fork 346
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
fix: use unknown instead of any for additional properties #1466
fix: use unknown instead of any for additional properties #1466
Conversation
Shall we change the |
Yes definitely, I only concentrated on additionalProperties but it makes sense to fix the issue more broadly. |
cd7cf19
to
f89c0b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original fix was here in 2021: #190 But I agree unknown is safer than any |
I'm personally not a big fan of making this configurable, simply because To quickly move forward and upgrade Orval, I suggest adding e.g // @ts-expect-error todo: fix this
const thing = data.response.thing; |
Hi, I've just noticed this change when I tried the latest version. I agree that In addition to that, is there any way to configure each This is just a small feedback. Thanks for the amazing work |
Same here, the change broke any location where we explicitly typed a generic object from the back end. const data.someObject as SomeType; We now need to use: const data.someObject as unknown as SomeType; (truthfully back end is the root cause of the problem for our specific project, which should type out all the possibilities rather than generic object, but back end is something I don't have access to, and it showcases that this change can break the codebase for some use cases) |
Yes this issue has gone back and forth between |
Status
READY
Description
Fixes #1464
The generated type for objects with
additionalProperties: true
becomes[key: string]: unknown
instead of[key: string]: any
for better type safety.Todos
Steps to Test or Reproduce
Outline the steps to test or reproduce the PR here.