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

fix: Update to [email protected] generates error TS7016: Could not find a declaration file for module 'validator'. #1412

Closed
KeithGillette opened this issue Nov 21, 2021 · 14 comments
Labels
status: done/released Issue has been completed, no further action is needed. type: fix Issues describing a broken feature.

Comments

@KeithGillette
Copy link

Description

Updating a project from [email protected] to [email protected] generates 16 error TS7016: Could not find a declaration file for module 'validator'. messages on tsc transpilation when tsconfig.json is configured with the default skipLibCheck: false.

Minimal code-snippet showcasing the problem
[email protected] removes @types/validator from the package.json dependencies, which now requires consuming applications to manually add @types/validator to avoid error TS7016 on transpilation when the default skipLibCheck: false.

Expected behavior

Update from 0.13.1 to 0.13.2 should allow project to build without error.

Actual behavior

node_modules/class-validator/types/decorator/string/IsAlpha.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsAlphanumeric.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsCurrency.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '/Users/keith.gillette/Code/TaskTrain/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsDateString.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsDecimal.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsEmail.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsFQDN.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsHash.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsIdentityCard.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsISO8601.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsISSN.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsMacAddress.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsMobilePhone.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsNumberString.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsPostalCode.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~

node_modules/class-validator/types/decorator/string/IsUrl.d.ts:2:25 - error TS7016: Could not find a declaration file for module 'validator'. '~/node_modules/validator/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/validator` if it exists or add a new declaration (.d.ts) file containing `declare module 'validator';`

2 import ValidatorJS from 'validator';
                          ~~~~~~~~~~~


Found 16 errors.
@KeithGillette KeithGillette added status: needs triage Issues which needs to be reproduced to be verified report. type: fix Issues describing a broken feature. labels Nov 21, 2021
@Sonahit
Copy link

Sonahit commented Nov 22, 2021

Same error after updating

@kliuiev-io
Copy link

Fixes locally by npm i --save-dev @types/validator but it's still a bug

@angelxmoreno
Copy link

@kliuiev-io @KeithGillette which do you advise

  1. sticking with 0.13.1
  2. installing @types/validator

@ianhowe76
Copy link

I am guessing this is related to @types/validator moving to devDependancies in v1.13.2

v0.13.1...v0.13.2

@DnOberon
Copy link

Really don't want to sticky my project to the previous version, any movement on this?

@SchroederSteffen
Copy link

Considering that @types packages are only required for the build, do we agree that moving it to the dev dependencies is actually the right call? 🤔
It would come down to a documentation issue like: "You need to npm i -D @types/validator yourself."

@KeithGillette
Copy link
Author

KeithGillette commented Feb 16, 2022

While installing @types/validator as a project development dependency will fix the transpilation error messages, 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.

@mohd-akram
Copy link

Any update on this? This was already fixed once before in the project's history.

@flmuel
Copy link

flmuel commented Sep 22, 2022

please fix and merge :)

@NoNameProvided
Copy link
Member

Fixed in 12f8d86

@NoNameProvided NoNameProvided added status: fixed Issues with merged PRs, but not released yet. and removed status: needs triage Issues which needs to be reproduced to be verified report. labels Nov 20, 2022
@nVitius
Copy link

nVitius commented Nov 30, 2022

@NoNameProvided Can we expect a new release that includes that fix?

@NoNameProvided
Copy link
Member

Yes

@NoNameProvided NoNameProvided added status: done/released Issue has been completed, no further action is needed. and removed status: fixed Issues with merged PRs, but not released yet. labels Dec 9, 2022
@NoNameProvided
Copy link
Member

This feature/fix has been released in 0.14.0.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: done/released Issue has been completed, no further action is needed. type: fix Issues describing a broken feature.
Development

Successfully merging a pull request may close this issue.