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:
@ -8,7 +8,7 @@
|
||||
|
||||
import {DomAdapter} from '../dom/dom_adapter';
|
||||
import {StringMapWrapper} from '../facade/collection';
|
||||
import {Type, isFunction, isPresent} from '../facade/lang';
|
||||
import {isFunction, isPresent} from '../facade/lang';
|
||||
|
||||
|
||||
|
||||
|
@ -6,11 +6,11 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {DebugElement} from '@angular/core';
|
||||
import {DebugElement, Type} from '@angular/core';
|
||||
|
||||
import {getDOM} from '../../dom/dom_adapter';
|
||||
import {Predicate} from '../../facade/collection';
|
||||
import {Type, isPresent} from '../../facade/lang';
|
||||
import {isPresent} from '../../facade/lang';
|
||||
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ export class By {
|
||||
*
|
||||
* {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
|
||||
*/
|
||||
static directive(type: Type): Predicate<DebugElement> {
|
||||
static directive(type: Type<any>): Predicate<DebugElement> {
|
||||
return (debugElement) => { return debugElement.providerTokens.indexOf(type) !== -1; };
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,9 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type, isBlank} from '../facade/lang';
|
||||
import {Type} from '@angular/core';
|
||||
|
||||
import {isBlank} from '../facade/lang';
|
||||
|
||||
var _DOM: DomAdapter = null;
|
||||
|
||||
@ -29,7 +31,7 @@ export function setRootDomAdapter(adapter: DomAdapter) {
|
||||
* Provides DOM operations in an environment-agnostic way.
|
||||
*/
|
||||
export abstract class DomAdapter {
|
||||
public xhrType: Type = null;
|
||||
public xhrType: Type<any> = null;
|
||||
abstract hasProperty(element: any /** TODO #9100 */, name: string): boolean;
|
||||
abstract setProperty(el: Element, name: string, value: any): any /** TODO #9100 */;
|
||||
abstract getProperty(el: Element, name: string): any;
|
||||
@ -41,7 +43,7 @@ export abstract class DomAdapter {
|
||||
abstract logGroupEnd(): any /** TODO #9100 */;
|
||||
|
||||
/** @deprecated */
|
||||
getXHR(): Type { return this.xhrType; }
|
||||
getXHR(): Type<any> { return this.xhrType; }
|
||||
|
||||
/**
|
||||
* Maps attribute names to their corresponding property names for cases
|
||||
|
@ -47,7 +47,7 @@ export class ClientMessageBrokerFactory_ extends ClientMessageBrokerFactory {
|
||||
* @experimental WebWorker support in Angular is experimental.
|
||||
*/
|
||||
export abstract class ClientMessageBroker {
|
||||
abstract runOnService(args: UiArguments, returnType: Type): Promise<any>;
|
||||
abstract runOnService(args: UiArguments, returnType: Type<any>): Promise<any>;
|
||||
}
|
||||
|
||||
interface PromiseCompleter {
|
||||
@ -82,7 +82,7 @@ export class ClientMessageBroker_ extends ClientMessageBroker {
|
||||
return id;
|
||||
}
|
||||
|
||||
runOnService(args: UiArguments, returnType: Type): Promise<any> {
|
||||
runOnService(args: UiArguments, returnType: Type<any>): Promise<any> {
|
||||
var fnArgs: any[] /** TODO #9100 */ = [];
|
||||
if (isPresent(args.args)) {
|
||||
args.args.forEach(argument => {
|
||||
@ -172,7 +172,7 @@ class MessageData {
|
||||
* @experimental WebWorker support in Angular is experimental.
|
||||
*/
|
||||
export class FnArg {
|
||||
constructor(public value: any /** TODO #9100 */, public type: Type) {}
|
||||
constructor(public value: any /** TODO #9100 */, public type: Type<any>) {}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,12 +6,12 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {BaseException, Injectable, RenderComponentType, ViewEncapsulation} from '@angular/core';
|
||||
import {Injectable, RenderComponentType, Type, ViewEncapsulation} from '@angular/core';
|
||||
|
||||
import {VIEW_ENCAPSULATION_VALUES} from '../../../core_private';
|
||||
import {Map, MapWrapper, StringMapWrapper} from '../../facade/collection';
|
||||
import {Type, isArray, isPresent, serializeEnum} from '../../facade/lang';
|
||||
|
||||
import {BaseException} from '../../facade/exceptions';
|
||||
import {isArray, isPresent, serializeEnum} from '../../facade/lang';
|
||||
import {RenderStore} from './render_store';
|
||||
import {LocationType} from './serialized_types';
|
||||
|
||||
@ -22,7 +22,7 @@ import {LocationType} from './serialized_types';
|
||||
/**
|
||||
* @experimental WebWorker support in Angular is currently experimental.
|
||||
*/
|
||||
export const PRIMITIVE: Type = String;
|
||||
export const PRIMITIVE: Type<any> = String;
|
||||
|
||||
@Injectable()
|
||||
export class Serializer {
|
||||
|
@ -6,11 +6,11 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
import {Injectable, Type} from '@angular/core';
|
||||
|
||||
import {EventEmitter} from '../../facade/async';
|
||||
import {ListWrapper, Map} from '../../facade/collection';
|
||||
import {FunctionWrapper, Type, isPresent} from '../../facade/lang';
|
||||
import {FunctionWrapper, isPresent} from '../../facade/lang';
|
||||
import {MessageBus} from '../shared/message_bus';
|
||||
import {Serializer} from '../shared/serializer';
|
||||
|
||||
@ -50,7 +50,7 @@ export class ServiceMessageBrokerFactory_ extends ServiceMessageBrokerFactory {
|
||||
*/
|
||||
export abstract class ServiceMessageBroker {
|
||||
abstract registerMethod(
|
||||
methodName: string, signature: Type[], method: Function, returnType?: Type): void;
|
||||
methodName: string, signature: Type<any>[], method: Function, returnType?: Type<any>): void;
|
||||
}
|
||||
|
||||
export class ServiceMessageBroker_ extends ServiceMessageBroker {
|
||||
@ -67,8 +67,8 @@ export class ServiceMessageBroker_ extends ServiceMessageBroker {
|
||||
}
|
||||
|
||||
registerMethod(
|
||||
methodName: string, signature: Type[], method: (..._: any[]) => Promise<any>| void,
|
||||
returnType?: Type): void {
|
||||
methodName: string, signature: Type<any>[], method: (..._: any[]) => Promise<any>| void,
|
||||
returnType?: Type<any>): void {
|
||||
this._methods.set(methodName, (message: ReceivedMessage) => {
|
||||
var serializedArgs = message.args;
|
||||
let numArgs = signature === null ? 0 : signature.length;
|
||||
@ -92,7 +92,7 @@ export class ServiceMessageBroker_ extends ServiceMessageBroker {
|
||||
}
|
||||
}
|
||||
|
||||
private _wrapWebWorkerPromise(id: string, promise: Promise<any>, type: Type): void {
|
||||
private _wrapWebWorkerPromise(id: string, promise: Promise<any>, type: Type<any>): void {
|
||||
promise.then((result: any) => {
|
||||
this._sink.emit(
|
||||
{'type': 'result', 'value': this._serializer.serialize(result, type), 'id': id});
|
||||
|
@ -6,8 +6,10 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Type} from '@angular/core';
|
||||
|
||||
import {DomAdapter, setRootDomAdapter} from '../../dom/dom_adapter';
|
||||
import {Type} from '../../facade/lang';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@ -48,7 +50,7 @@ export class WorkerDomAdapter extends DomAdapter {
|
||||
getProperty(el: Element, name: string): any { throw 'not implemented'; }
|
||||
invoke(el: Element, methodName: string, args: any[]): any { throw 'not implemented'; }
|
||||
|
||||
getXHR(): Type { throw 'not implemented'; }
|
||||
getXHR(): Type<any> { throw 'not implemented'; }
|
||||
|
||||
get attrToPropMap(): {[key: string]: string} { throw 'not implemented'; }
|
||||
set attrToPropMap(value: {[key: string]: string}) { throw 'not implemented'; }
|
||||
|
Reference in New Issue
Block a user