fix: Update to `class-validator@0.13.2` generates `error TS7016: Could not find a declaration file for module 'validator'.`
See original GitHub issueDescription
Updating a project from class-validator@0.13.1
to class-validator@0.13.2
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
class-validator@0.13.2
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.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:25
- Comments:13 (3 by maintainers)
Top Results From Across the Web
How to fix error TS7016: Could not find a declaration file for ...
Try `npm install @types/XYZ` if it exists or add a new declaration (.d.ts) file containing `declare module 'XYZ';. If XYZ is a direct...
Read more >Could not find a declaration file for module 'module-name ...
Here are two other solutions. When a module is not yours - try to install types from @types : npm install -D @types/module-name....
Read more >Fixing the TS7016 Error | Atomist Blog
Could not find declaration file -- How do you get past the TS7016? This article highlights the eight best and worst fixes.
Read more >Could not find declaration file for module 'X' Error | bobbyhadz
The error "Could not find declaration file for module" occurs when TypeScript cannot find the type declaration for a module. To solve the...
Read more >Error: src/algolia.ts(1,27): error TS7016: Could not find a ...
... error TS7016: Could not find a declaration file for module ... as a dev dependency to my package.json but this does not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Really don’t want to sticky my project to the previous version, any movement on this?
Fixes locally by npm i --save-dev @types/validator but it’s still a bug