I want to create a new object only with the properties that i need.
Example:
interface Foo {
a: string;
c: string;
}
interface Doo {
a: string;
h: number;
c: string;
}
const objFoo = {} as Foo;
const objDoo = {} as Doo;
objFoo = {}
objDoo = { a: 'hi', h: 1, c: 'gray' }
objFoo = objDoo // only with the properties that matches with properties of objFoo
//output expected
objFoo { a: 'hi', c: 'gray' }
i tried with object.assign(objFoo,objDoo), but doens't work. please help
as Foo/Doobecause the empty object does not match that interface.