data-transfer-object
Advanced tools
Changelog
0.3.0 (2021-01-27)
types: skip function types properly (6c1a7d4)
The type of the object returned by toJSON()
was erroneously including function names in its return type. This has been fixed.
import { DataTransferObject, IsString } from 'data-transfer-object';
class MyDto extends DataTransferObject {
@IsString()
key!: string;
}
const input = new MyDto({ key: 'value' });
const data = input.toJSON();
// before 0.3.0
typeof data = {
key: string;
toJSON: never;
validate: never;
validateAsync: never;
}
// 0.3.0 onwards
typeof data = {
key: string;
}