I am new to typescript, I am using the Wijimo Library and I am trying to implement the following interface
interface IItemCreator<T = any> {
(): T;
}
I have tried the following
export class SystemPageModel implements wijmo.collections.IItemCreator<SystemPageModel> {
constructor(): SystemPageModel {
return new SystemPageModel();
}
public PK: Guid;
public Name: string;
public SystemName: string;
public SystemTypePK: string;
public ff(): SystemPageModel { };
}
Well first of all: you can't implement this interface in a class. It's a function interface.
Also, you shouldn't write
return new SameClass()in a constructor as this will result in an endless loop.An example to implement this would be: