-
Notifications
You must be signed in to change notification settings - Fork 519
Open
Labels
type: featureIssues related to new features.Issues related to new features.
Milestone
Description
I think plainToClass should always reutrn a class-instance or throw an exception.
Here's a simple example where this is not the case (using version 0.2.3):
class Test {
@IsString()
readonly table!: string;
}
// note, that we call it with a completely wrong type: string instead of JSON-object
const result = plainToClass(Test, 'not a class');Then result is of type string (value = 'not a class').
I'd expect plainToClass to:
- return an instance of type
Testwhere all properties remain undefined, or - throw an exception
Not sure, if this is a bug or intended - maybe there's a good reason for the current behaviour that I am missing?
see also Stackoverflow Question
NicoAiko, LeoMartinDev, ViRuSTriNiTy, seantalbot-jisc, ssilve1989 and 18 more
Metadata
Metadata
Assignees
Labels
type: featureIssues related to new features.Issues related to new features.