nestjs / swagger

OpenAPI (Swagger) module for Nest framework (node.js) :earth_americas:

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error message with Typescript < v4.8 is confusing

Woodz opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Using latest @nestjs/swagger with Typescript v4.7 fails at runtime with message Error Nest CLI plugin does not support TypeScript < v4.8

This is quite confusing because the message doesn't mention that this error is from nestjs/swagger and does not get flagged up during dependency installation

Minimum reproduction code

Reproduced privately

Steps to reproduce

  1. yarn install
  2. yarn nest start

Expected behavior

  1. I expect this package to use npm peer dependencies to define supported Typescript versions
  2. I expect this package to mention this package name in the error

Package version

7.3.0

NestJS version

9.0.11

Node.js version

18.13.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

This is tricky because not everyone who uses @nestjs/swagger uses the Swagger CLI Plugin (hence, the runtime check).

This is tricky because not everyone who uses @nestjs/swagger uses the Swagger CLI Plugin (hence, the runtime check).

Oh apologies for not being clear. I was not recommend dropping the runtime check. Instead, I think that this runtime check error should be reworded to improve clarification, and additionally peerDependency added to generate an additional warning at installation time

What I'm trying to say is that adding a peer dependency might be confusing - AFAIK most people still dont use the CLI plugin, meaning, most would receive a misguided warning about their TS incompatibility even if it doesn't apply to their projects.

When it comes to rewording the error message, I'm all in! Would you like to create a PR for this?