OpenAPITools / OpenAPITools/openapi-generator

[BUG] [typescript-angular] Incompatible transitive dependency of `@types/node`

Open
#19,522 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

We're using Gradle plugin with typescript-angular generator to generate an Angular client with Angular version of 13.3.12 and Node version of v14.21.3.

When generating an SDK and running npm install && npm run build we encounter the following exception, which seem to have started only the the recent couple of days.

npm run build

> @app@2.1.3 build .../api/open-api/angular-client/build/generated/client
> ng-packagr -p ng-package.json

Building Angular Package

------------------------------------------------------------------------------
Building entry point '@app'
------------------------------------------------------------------------------
✖ Compiling with Angular sources in Ivy partial compilation mode.
node_modules/@types/node/stream/web.d.ts:469:56 - error TS1005: '?' expected.

469             DecompressionStream: infer T extends object;
                                                           ~

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @app@2.1.3 build: `ng-packagr -p ng-package.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @app@2.1.3 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

It seem to have been resulting from a transitive dependency of @types/node@22.5.2 which was recently updated and originally comes from ng-packagr dependency.
https://www.npmjs.com/package/@types/node?activeTab=versions

Our current workaround is to use a legacy stable version of @types/node and executing the following command before running npm run build
npm install --save-dev @types/node@18.11.9

openapi-generator version

Version 7.4.0

OpenAPI declaration file content or url
Generation Details
Steps to reproduce

Generate angular typescript client with Angular version of 13.3.12 and Node version of v14.21.3.
Run npm install && npm run build

Related issues/PRs
Suggest a fix

Use a fixed version of @types/node which is compatible with legacy Node versions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by generating a typescript-angular client with Angular 13.3.12 and Node 14.21.3, then run npm install && npm run build to reproduce the incompatible @types/node error. Trace which generated package or ng-packagr dependency introduces @types/node@22.5.2; done means the generated client builds without requiring a manual install of @types/node@18.11.9.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, node.js, typescript
Domain
build-system, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.