We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e90d9b0 commit 801ad1dCopy full SHA for 801ad1d
src/entity/in_memory.ts
@@ -89,9 +89,11 @@ export class InMemoryEntity {
89
/**
90
* @summary Clone this entity
91
*/
92
- clone<T extends InMemoryEntity>(extraContext?: object): T {
93
- // @ts-ignore
94
- const object: T = new this.constructor({
+ clone(extraContext?: object): this {
+ type ThisType = typeof this;
+ type TConstructor = { new (o: object): ThisType };
95
+
96
+ const object = new (this.constructor as TConstructor)({
97
...this.toJSON(),
98
...extraContext,
99
});
0 commit comments