Home > database >  Adding generic method throws type error: Object literal may only specify known properties, and __ do
Adding generic method throws type error: Object literal may only specify known properties, and __ do

Time:11-05

My goal is that foo accepts any object which extends an Obs<T>. However I get the following error.

Argument of type '{ reset: () => number; x: number; set: (x: number) => number; }' is not assignable to parameter of type 'Obs<unknown>'.
  Object literal may only specify known properties, and 'reset' does not exist in type 'Obs<unknown>'

Snippet A

{
  // add a generic method            
  • Related