refactor(Type): merge Type and ConcreType<?> into Type<?> (#10616)

Closes #9729

BREAKING CHANGE:

`Type` is now `Type<T>` which means that in most cases you have to
use `Type<any>` in place of `Type`.

We don't expect that any user applications use the `Type` type.
This commit is contained in:
Miško Hevery
2016-08-10 18:21:28 -07:00
committed by vikerman
parent 6f4ee6101c
commit b96869afd2
91 changed files with 637 additions and 714 deletions

View File

@ -57,25 +57,8 @@ var _global: BrowserNodeGlobal = globalScope;
export {_global as global};
/**
* Runtime representation a type that a Component or other object is instances of.
*
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
* the `MyCustomComponent` constructor function.
*
* @stable
*/
export var Type = Function;
export interface Type extends Function {}
/**
* Runtime representation of a type that is constructable (non-abstract).
*/
export interface ConcreteType<T> extends Type { new (...args: any[]): T; }
export function getTypeNameForDebugging(type: Type): string {
export function getTypeNameForDebugging(type: any): string {
if (type['name']) {
return type['name'];
}
@ -426,7 +409,7 @@ export function isPrimitive(obj: any): boolean {
return !isJsObject(obj);
}
export function hasConstructor(value: Object, type: Type): boolean {
export function hasConstructor(value: Object, type: any): boolean {
return value.constructor === type;
}