Skip to content
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

0.13.4 misses @types/validator #79

Open
1 of 2 tasks
SchroederSteffen opened this issue Feb 15, 2022 · 4 comments
Open
1 of 2 tasks

0.13.4 misses @types/validator #79

SchroederSteffen opened this issue Feb 15, 2022 · 4 comments

Comments

@SchroederSteffen
Copy link

SchroederSteffen commented Feb 15, 2022

Did you read the migration guide?

  • I have read the whole migration guide (there is none)

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Potential Commit/PR that introduced the regression

PR #72

Versions

0.13.3 -> 0.13.4

Describe the regression

Hi,

We upgraded to @nestjs/class-validator@0.13.4 and receive the following error during nest build:

Could not find a declaration file for module 'validator'.
Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

I saw that #72 removes the dependency.
Has this been an accidental merge issue or are we expected to install @types/validator ourselves?

Cheers,
Steffen

Minimum reproduction code

No response

Expected behavior

@nestjs/class-validator should work out-of-the-box.

Other

No response

@KeithGillette
Copy link

KeithGillette commented Feb 16, 2022

Updating to @nestjs/class-validator causes tsc to generate error TS7016: Could not find a declaration file for module 'validator'. I believe this shares the same root cause (removing @types/validator from package.json dependencies) as issue #1412 & issue #1535 in the original typestack/class-validator library from which this repository was forked.

@SchroederSteffen
Copy link
Author

Thanks for the hint @KeithGillette! So, it's an upstream issue. (typestack@70278ab / typestack#1409).
Though, having a @types/ production dependency wouldn't be right anyways, as it's just required for the build. So, I would assume that it's more correct now. Agreed?
Then it's rather a documentation issue: "You need to npm i -D @types/validator yourself."

@kamilmysliwiec
Copy link
Member

If someone wants to create a PR to this fork adding the validator declaration files, go for it! Contributions are more than welcome

@KeithGillette
Copy link

While installing @types/validator as a project development dependency will fix the transpilation error messages, @SchroederSteffen, since this is a published package that is consumed by other applications, I'm more in agreement with this StackOverflow answer supporting the previous practice of keeping @types/validator in dependencies so that it's available during development without that extra step.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants