Const
class MyDto extends LosslessDto {
@Int64String
int64NumberField!: string
@BigIntValue
bigintField!: bigint
@ChildDto(MyChildDto)
childDtoField!: MyChildDto
normalField!: string
normalNumberField!: number
maybePresentField?: string
}
Decorate a Dto object field as @ChildDto
to specify that the JSON object property should be parsed as a child Dto.
class MyChildDto extends LosslessDto {
someField!: string
}
class MyDto extends LosslessDto {
@Int64String
int64NumberField!: string
@BigIntValue
bigintField!: bigint
@ChildDto(MyChildDto)
childDtoField!: MyChildDto
normalField!: string
normalNumberField!: number
maybePresentField?: string
}
Decorate Dto string fields as @Int64String
to specify that the JSON number property should be parsed as a string.
class MyDto extends LosslessDto {
@Int64String
int64NumberField!: string
@BigIntValue
bigintField!: bigint
@ChildDto(MyChildDto)
childDtoField!: MyChildDto
normalField!: string
normalNumberField!: number
maybePresentField?: string
}
Create an instance of a DTO class with the provided data.
This provides a type-safe method to create a DTO instance from a plain object.
Node 22's experimental strip types does not play well with the previous "via the constructor" method.
See: https://gist.github.com/jwulf/6e7b093b5b7b3e12c7b76f55b9e4be84
Generated using TypeDoc
Decorate Dto bigint fields as
@BigIntValue
to specify that the JSON number property should be parsed as a bigint.