0

Given this example, how can I make e have the type Partial<Person>?

interface Person {
  name: string;
  age: number;
}

const p1: Person = { age: 1, name: 'a' };

const p2: Partial<Person> = { age: 1 };

const e = Object.entries(p2).filter(([k, v]) => (
  p1[k] !== v
));

By setting e to Partial<Person> it says:

Type '[string, string | number][]' has no properties in common with type 'Partial<Person>'.ts(2559)
Steven
  • 916
  • 10
  • 19

0 Answers0