'It Is possibile to map typescript object to another based on interface/or type [duplicate]
If i have an object in typescript
const x = {a:1, b:2}
And an interfacce
interface MyInterface { a: number }
It possibile to do something like (pseudocode) this
const y = Mapper<MyInterface>(x)
console.log(y) // {a: 1}
And the result should be the object with the properties defined in the target interface
Something like mapstruct https://mapstruct.org/ in java
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
