Fixed Typescript definitions for typescript@3.7.2.
Details: InstanceType<T> is now defined by TypeScript as follows:
/**
* Obtain the return type of a constructor function type
*/
type InstanceType<T extends new (...args: any) => any> = T extends new (...args: any) => infer R ? R : any;
The extends clause requires that the type-parameter be a constructor.
Since InstanceType was used by Model.create in mst-decorators/src/index.d.ts, I had to replace it with a looser version, that just returns any if the supplied type-parameter for Model<T> is a normal function instead of a constructor. (as is true for this line in the tests)
Details:
InstanceType<T>
is now defined by TypeScript as follows:The extends clause requires that the type-parameter be a constructor.
Since
InstanceType
was used byModel.create
inmst-decorators/src/index.d.ts
, I had to replace it with a looser version, that just returnsany
if the supplied type-parameter forModel<T>
is a normal function instead of a constructor. (as is true for this line in the tests)