-
-
Notifications
You must be signed in to change notification settings - Fork 616
Description
openapi-fetch version
0.17.0
Description
After updating to openapi-fetch@0.17.0 and openapi-typescript@7.13.0 I get a type error when accessing a deeply nested property in combination with type narrowing. The original API model is rather complex and in parts driven by code generation requirements from the Java-based backend. However, it is a valid OpenAPI spec and everything worked fine until the update. I think it's the easiest if you take a look at the reproduction linked below.
I could narrow the issue down to the introduction of the Readable type. When I replace the Readable type in openapi-typescript-helpers with type Readable<T> = T everything works fine.
Reproduction
The original OpenAPI spec is from a complex insurance application. I tried to boil it down to the absolute minimum. Without the context it may seem like a rather contrived example, but you have to trust me that it's a valid use case 😉
https://github.com/luchsamapparat/openapi-typescript-readable-bug
Expected result
It should be possible to access tinyFooProp when narrowing the model down via ['@type'] === 'Foo'.
Extra
- I’m willing to open a PR (see CONTRIBUTING.md)