0.9.4 breaks some Typescript configurations
djMax opened this issue · comments
Description
Something in the changes in 0.9.4 causes NodeNext module resolution to fail.
Reproduction
Node.js side, but build time so no reason browser wouldn't also be affected. I can't get the playground to fail because I don't have full control of tsconfig it seems, but here's what fails in a local build with specific tsconfig values (as described in the discussion):
Expected result
URLs should be "known" but end up just being ignored/allow any value.
Checklist
- I’m willing to open a PR (see CONTRIBUTING.md)
Thanks for the investigation! Looking into it. It could have something to do with a change to openapi-typescript-helpers
. I think I’m going to add tests for different moduleResolution
s somehow. Could or could not be the problem based on #1634, but couldn’t hurt to eliminate that as a possibility. This seems like a bug, as TSConfig settings shouldn’t affect type safety.
Let me know if I can help - I had a sniff that the helpers might be involved too but I couldn't quite see how. There are a number of typing related changes in there, so it's a bit beyond my limited current understanding of the type infra here.
Is this theoretically fixed? I think it is but I have only seen that the playground errors now (as it should). But before I go through the variety of deps to update would love to know it was intentional :)
Running into exactly the same problem, currently stuck on 0.9.3
, all versions afterwards lose all type information.
![image](https://private-user-images.githubusercontent.com/3534453/337446966-c0b67c84-4b24-4223-9e05-1a4a88933afe.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxODQyMjcsIm5iZiI6MTcyMjE4MzkyNywicGF0aCI6Ii8zNTM0NDUzLzMzNzQ0Njk2Ni1jMGI2N2M4NC00YjI0LTQyMjMtOWUwNS0xYTRhODg5MzNhZmUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjhUMTYyNTI3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NjE2OTMyZDgyMDNkMjI0ZmY5YjQ2MDBkZWM3ZjZlNGUxNDk1YWMzMDFiNjhjMjQzMWViMjU2OTE5ZGI5NTc3YSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.M0i-kqo312TYnSDfn0fptlDMR1Jpjj1RZctHXqUpWNY)
Whereas it used to work :)
![image](https://private-user-images.githubusercontent.com/3534453/337447139-85a18bcf-c6e9-4e66-a0fe-754f24b43586.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjIxODQyMjcsIm5iZiI6MTcyMjE4MzkyNywicGF0aCI6Ii8zNTM0NDUzLzMzNzQ0NzEzOS04NWExOGJjZi1jNmU5LTRlNjYtYTBmZS03NTRmMjRiNDM1ODYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDcyOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA3MjhUMTYyNTI3WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZWQyOWY1MzQ3MmNjNzUxMmRmN2RhMmY5MzBlNWEyYjBjZWRkNWE3MzEwODhkMDk5YjgxY2FkMzNhZjE4MGRmYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.WUHG_90JppW5XAML7PWzpd3MjrFIzM4bFhaC4Bu3wUs)
Tried both openapi-typescript-helpers
0.0.7
and 0.0.8
, no difference in the generated output together with openapi-typescript
6.7.6
My tsconfig.json
has both module
and moduleResolution
set to NodeNext
.
Investigated this a little further and in planning for the upcoming 0.10.0
release (which requires openapi-typescript@7.x which will also get a stable release at the same time) this is hopefully fixed. Or if not fixed, easier to debug.
I believe some of this came from openapi-typescript@6.x generating a lot of partial schemas, which made inference harder. 7.x generating full schemas with never
types means openapi-fetch can get simpler inference, and easier cross-comparison since all shapes are fully outlined. Or that’s the hope, at least.
Some of the type inference that I believe led to the regression has been changed in 0.10.0
. Are people still seeing the failures with the latest version?
Not resolved here.
Bumped both fetch and generator to latest, regenerated, but no types. Using nodenext
.