Closed eyexpo-isaac closed 4 years ago
It should relate to this issue in class-transformer after they released 0.2.2 yesterday
import { transformAndValidate } from 'class-transformer-validator'; class User { @IsEmail() identifier!: string; @IsString() password!: string; } const user: User = { identifier: 'johndoe@gmail.com', password: 'password123', }; const userJson: string = JSON.stringify(user); await transformAndValidate(User, userJson) .then(async (): Promise<void> => Promise.resolve()) .catch(async (err: Error): Promise<never> => Promise.reject(err));
Throw error TypeError: Reflect.getMetadata is not a function
TypeError: Reflect.getMetadata is not a function
Which was working fine before(before they upgrade to 0.2.2)
By adding
import 'reflect-metadata';
at the top solved this issue.
This is probably an upstream issue in class-transformer, I have commented on your issue at typestack/class-transformer#255, please continue the conversation there.
Closing for a housekeeping purposes 🔒
It should relate to this issue in class-transformer after they released 0.2.2 yesterday
Throw error
TypeError: Reflect.getMetadata is not a function
Which was working fine before(before they upgrade to 0.2.2)
By adding
at the top solved this issue.