refactor(core): type ComponentRef, ComponentFactory and ComponentFixture by the component type

BREAKING CHANGE:
- `ComponetRef`, `ComponentFactory`, `ComponentFixture` now all require a type
  parameter with the component type.
Closes #8361
This commit is contained in:
Tobias Bosch
2016-04-30 10:52:04 -07:00
parent 4e2c68354e
commit 6a0cbb8a57
48 changed files with 225 additions and 209 deletions

View File

@ -35,7 +35,7 @@ import {
asyncRouteDataCmp
} from './fixture_components';
function getLinkElement(rtc: ComponentFixture) {
function getLinkElement(rtc: ComponentFixture<any>) {
return rtc.debugElement.query(By.css('a')).nativeElement;
}

View File

@ -30,13 +30,13 @@ import {
import {specs, compile, clickOnElement, getHref} from '../util';
import {BaseException} from 'angular2/src/facade/exceptions';
function getLinkElement(rtc: ComponentFixture, linkIndex: number = 0) {
function getLinkElement(rtc: ComponentFixture<any>, linkIndex: number = 0) {
return rtc.debugElement.queryAll(By.css('a'))[linkIndex].nativeElement;
}
function auxRoutes() {
var tcb: TestComponentBuilder;
var fixture: ComponentFixture;
var fixture: ComponentFixture<any>;
var rtr;
beforeEach(inject([TestComponentBuilder, Router], (tcBuilder, router) => {
@ -139,7 +139,7 @@ function auxRoutes() {
function auxRoutesWithAPrimaryRoute() {
var tcb: TestComponentBuilder;
var fixture: ComponentFixture;
var fixture: ComponentFixture<any>;
var rtr;
beforeEach(inject([TestComponentBuilder, Router], (tcBuilder, router) => {

View File

@ -142,7 +142,7 @@ export class RedirectToParentCmp {
@Component({selector: 'dynamic-loader-cmp', template: `{ <div #viewport></div> }`})
@RouteConfig([new Route({path: '/', component: HelloCmp})])
export class DynamicLoaderCmp {
private _componentRef: ComponentRef = null;
private _componentRef: ComponentRef<any> = null;
@ViewChild('viewport', {read: ViewContainerRef}) viewport: ViewContainerRef;

View File

@ -30,7 +30,7 @@ import {
import {PromiseWrapper} from 'angular2/src/facade/async';
function getLinkElement(rtc: ComponentFixture) {
function getLinkElement(rtc: ComponentFixture<any>) {
return rtc.debugElement.query(By.css('a')).nativeElement;
}
@ -431,7 +431,7 @@ function syncRoutesWithSyncChildrenWithDefaultRoutesWithoutParams() {
}
function syncRoutesWithDynamicComponents() {
var fixture: ComponentFixture;
var fixture: ComponentFixture<any>;
var tcb: TestComponentBuilder;
var rtr: Router;