export class Attributes<T> {
constructor(private data: T) {}
get<K extends keyof T>(key: K): T[K] {
return this.data[key];
}
set(update: T): void {
Object.assign(this.data, update);
}
}
Captura de tela de um erro Error
e versão em texto
No overload matches this call.
Overload 1 of 4, '(target: {}, source: T): {} & T', gave the following error.
Argument of type 'T' is not assignable to parameter of type '{}'.
Overload 2 of 4, '(target: object, ...sources: any[]): any', gave the following error.
Argument of type 'T' is not assignable to parameter of type 'object'.ts(2769)
Attributes.ts(1, 25): This type parameter might need an `extends {}` constraint.
Attributes.ts(1, 25): This type parameter might need an `extends object` constraint.