3

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

dna
  • 2,097
  • 1
  • 11
  • 35

0 Answers0