class-validator icon indicating copy to clipboard operation
class-validator copied to clipboard

feature: export ValidationMetadata

Open bagbyte opened this issue 4 years ago • 3 comments

Description

Would be nice to have access to the ValidationMetadata class, which is used together with addValidationMetadata, this would enable the creation of custom decorators

bagbyte avatar Mar 03 '21 10:03 bagbyte

Workaround is: import { ValidationMetadata } from 'class-validator/cjs/metadata/ValidationMetadata';

johny1614 avatar May 18 '21 14:05 johny1614

import { ValidationMetadata } from "class-validator/cjs/metadata/ValidationMetadata";

compile error

Could not find a declaration file for module 'class-validator/cjs/metadata/ValidationMetadata'. '/Users/wmvm/node_modules/class-validator/cjs/metadata/ValidationMetadata.js' implicitly has an 'any' type.   If the 'class-validator' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module 'class-validator/cjs/metadata/ValidationMetadata';

please export ValidationMetadata

wmvm0 avatar Mar 18 '23 09:03 wmvm0

I had to add a .d.ts file with contents: declare module 'class-validator/cjs/metadata/ValidationMetadata'; in order to bypass your error @wmvm0 and then used a @ts-ignore for the import. Ugly but works for now

minlare avatar May 23 '24 06:05 minlare