I want to copy an object of a specific type, to another object of an other type but similar type.
Givin this example:
interface PersonInfo {
firstName: string
lastName: string
age: number
length: number
}
interface Person {
firstName: string
lastName: string
}
I tried
const a: PersonInfo = {
firstName: "john",
lastName: "Doe",
age: 23,
length: 180
}
const b: Person = a
I want that const b:Person = { firstName: "john", lastName: "Doe", }
I don't know if this is relevant, but I am not looking for a solution where interface PersonInfo
can extend interface Person