fix: error TS2503: Cannot find namespace 'ValidatorJS'.

See original GitHub issue

Just installed class-validator into a new Nest.js project, also manually intalled types.

Getting the above error for basically all validators when trying to start app:

node_modules/class-validator/validation/Validator.d.ts:383:38 - error TS2503: Cannot find namespace 'ValidatorJS'.

383     isISSN(value: unknown, options?: ValidatorJS.IsISSNOptions): boolean;

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

4reactions
zcong1993commented, Jan 6, 2020

@cjancsar try to add this to your tsconfig.json

{
  "compilerOptions": {
    ...
    "typeRoots": ["./node_modules/*/node_modules/@types/"]
  }
...
}
2reactions
cjancsarcommented, Dec 10, 2019

@vlapo I need validator and @types/validator because I am using sequelize-typescript (https://www.npmjs.com/package/sequelize-typescript) which also has them as a dependency. They should be made peer depedencies of this lib to avoid conflicts like this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

question: cannot find namespace 'ValidatorJS'. #510 - GitHub
tsconfig.build.json node_modules/class-validator/validation/Validator.d.ts:383:38 - error TS2503: Cannot find namespace 'ValidatorJS'.
Read more >
fix: error TS2503: Cannot find namespace 'ValidatorJS'.
Just installed class-validator into a new Nest. js project, also manually intalled types.
Read more >
"Cannot find namespace 'fastify'"? - node.js - Stack Overflow
How to solve the following typescript error: "Cannot find namespace ... src/app.ts:44:6 - error TS2503: Cannot find namespace 'fastify'.
Read more >
validatorjs - npm
Works in both the browser and Node. Readable and declarative validation rules. Error messages with multilingual support. CommonJS/Browserify ...
Read more >
Production build tries to build test files : r/node - Reddit
ts(18,28) #21 96.10 TS2503: Cannot find namespace 'jest'. #21 96.10 #21 96.10 ERROR in /opt/app/server/src/auth/providers/local/localRoute.test.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found