node中有没有什么插件能dto转实体类的?

如题,希望类型转换后的对象能只有自己本身的属性,不保留多余属性如

// 转换的类
class A {
    text:string
    id:number
}

class ADTO {
    text:string
    other:string
 
}



let aDTO = new ADTO()
aDTO.text = 'text'
aDTO.other = "other"

// 希望有个transfrom插件 
// 让a是A类型的,内容是 {text:'text'},得到从aDto相同的属性,不保留不同的属性
const a = transform(A, new ADTO())

待解决 悬赏分:70 - 离问题结束还有 171天17小时55分52秒
反对 0举报 0 收藏 0

我来回答

回答1