Open wwwzbwcom opened 3 years ago
@wwwzbwcom It solves the args problem but makes an issue for the receiver - you can't do new Foo()
anymore as without new
signature the type with prototype is not newable.
And I think TypeScript do a good job here - abstract class in abstract, you shouldn't be able to create an instance of such class. transformAndValidate
does exactly that, returning you an instance of abstract User
class.
I think you should change the way you define your abstract and non-abstract classes.
Hello, currently abstract class cant pass
transformAndValidate
type check.When
export declare type ClassType<T> = new (...args: any[]) => T;
, abstract class validate can't pass type check.Use
export type ClassType<T> = {prototype: T};
to allow check for abstract class, and plain object also cant pass check