I have a class to get JSON objects and convert them to the class that I want. the code is below.
import {plainToClass} from "class-transformer";
import UserDto from "../../auth/dto/user.dto";
class ConvertJson {
userData(data) {
return plainToClass(UserDto, data);
}
}
when I want to convert the class to generaic class
import {plainToClass} from "class-transformer";
import UserDto from "../../auth/dto/user.dto";
class ConvertJson<T> {
userData(data) {
return plainToClass(T, data);
}
}
I get this error
T only refers to a type, but is being used as a value here