question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

question: Class Validator throws ',' expected when I run "tsc"

See original GitHub issue

Description

I’m using TypeORM and Class Validator together. I need to deploy my app to heroku now, so I created a script called “npm build”, which runs the command “tsc”. However, it shows these errors which made my app unable to deploy. Below are the errors:

Minimal code-snippet showcasing the problem

node_modules/class-validator/types/decorator/common/IsIn.d.ts:6:71 - error TS1005: ',' expected.

6 export declare function isIn(value: unknown, possibleValues: readonly unknown[]): boolean;
                                                                        ~~~~~~~

node_modules/class-validator/types/decorator/common/IsIn.d.ts:6:78 - error TS1005: ',' expected.

6 export declare function isIn(value: unknown, possibleValues: readonly unknown[]): boolean;
                                                                               ~

node_modules/class-validator/types/decorator/common/IsIn.d.ts:10:47 - error TS1005: ',' expected.

10 export declare function IsIn(values: readonly any[], validationOptions?: ValidationOptions): PropertyDecorator;
                                                 ~~~

node_modules/class-validator/types/decorator/common/IsIn.d.ts:10:50 - error TS1005: ',' expected.

10 export declare function IsIn(values: readonly any[], validationOptions?: ValidationOptions): PropertyDecorator;
                                                    ~

node_modules/class-validator/types/decorator/common/IsNotIn.d.ts:6:74 - error TS1005: ',' expected.

6 export declare function isNotIn(value: unknown, possibleValues: readonly unknown[]): boolean;
                                                                           ~~~~~~~

node_modules/class-validator/types/decorator/common/IsNotIn.d.ts:6:81 - error TS1005: ',' expected.

6 export declare function isNotIn(value: unknown, possibleValues: readonly unknown[]): boolean;
                                                                                  ~

node_modules/class-validator/types/decorator/common/IsNotIn.d.ts:10:50 - error TS1005: ',' expected.

10 export declare function IsNotIn(values: readonly any[], validationOptions?: ValidationOptions): PropertyDecorator;
                                                    ~~~

node_modules/class-validator/types/decorator/common/IsNotIn.d.ts:10:53 - error TS1005: ',' expected.

10 export declare function IsNotIn(values: readonly any[], validationOptions?: ValidationOptions): PropertyDecorator;
                                                       ~


Found 8 errors.

Expected behavior

I’ve tried uninstalling and reinstalling class validator, but in vain. I expect it to have zero errors and my app successfully deployed to heroku.

Actual behavior

What happens is that the errors above are thrown, making me unable to deploy my application.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
NoNameProvidedcommented, Jan 19, 2021

I am almost 100% sure this is some problem with your build setup. Please provide a minimal, reproducible example otherwise I can guess only.

0reactions
github-actions[bot]commented, Apr 15, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nest class-validator minDate throws error even when the date ...
The problem: If I remove the minDate decorator, everything works fine but I would rather validate this common case. info: typescript: ~4.1.4.
Read more >
Getting started with continuous integration for Nest.js APIs
Learn how to build RESTful APIs with Nest.js, a Node.js framework built with TypeScript, and automate testing using CircleCI.
Read more >
How to use the class-validator.validateOrReject function in ...
To help you get started, we've selected a few class-validator. ... newProps.birthdate await validateOrReject(validation) } catch (error) { throw new this.
Read more >
Dynamic type validation in TypeScript - LogRocket Blog
The most basic validation, it's a set of conditions that check whether the structure is the expected one. const validate = (data: ...
Read more >
Documentation - The Basics - TypeScript
The alternative is to use a static type system to make predictions about what code is expected before it runs. Static type-checking. Think...
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