feat(core): Add "AbstractType<T>" interface (#29295)
This new interface will match classes whether they are abstract or concrete. Casting as `AbstractType<MyConcrete>` will return a type that isn't newable. This type will be used to match abstract classes in the `get()` functions of `Injector` and `TestBed`. Type isn't used yet so this isn't a breaking change. Issue #26491 PR Close #29295
This commit is contained in:

committed by
Jason Aden

parent
60afe88bcc
commit
afd4a4ed4d
@ -22,6 +22,16 @@ export function isType(v: any): v is Type<any> {
|
||||
return typeof v === 'function';
|
||||
}
|
||||
|
||||
/**
|
||||
* @description
|
||||
*
|
||||
* Represents an abstract class `T`, if applied to a concrete class it would stop being
|
||||
* instantiatable.
|
||||
*
|
||||
* @publicApi
|
||||
*/
|
||||
export interface AbstractType<T> extends Function { prototype: T; }
|
||||
|
||||
export interface Type<T> extends Function { new (...args: any[]): T; }
|
||||
|
||||
export type Mutable<T extends{[x: string]: any}, K extends string> = {
|
||||
|
Reference in New Issue
Block a user