+1

The typescript example of Prototype seems to have incorrect code

Himanshu 1 год назад обновлен Alex Shvets 1 год назад 0

https://refactoring.guru/design-patterns/prototype/typescript/example

In the clone method of Prototype, we have the following line

clone.circularReference = { ...this.circularReference, prototype: {...this}, };

It seems to be wrong, as this is referencing a completely different temporary object. 

I think the correct code is

clone.circularReference = { ...this.circularReference, prototype: clone };

Please correct me if I am wrong. Thank you

Сервис поддержки клиентов работает на платформе UserEcho