refactor(TypeScript): Add noImplicitAny
We automatically insert explicit 'any's where needed. These need to be addressed as in #9100. Fixes #4924
This commit is contained in:
@ -39,17 +39,17 @@ export function main() {
|
||||
{provide: RouterUrlSerializer, useClass: DefaultRouterUrlSerializer},
|
||||
RouterOutletMap,
|
||||
{provide: Location, useClass: SpyLocation},
|
||||
{provide: RouteSegment, useFactory: (r) => r.routeTree.root, deps: [Router]},
|
||||
{provide: RouteSegment, useFactory: (r: any /** TODO #9100 */) => r.routeTree.root, deps: [Router]},
|
||||
{
|
||||
provide: Router,
|
||||
useFactory: (resolver, urlParser, outletMap, location) => new Router(
|
||||
useFactory: (resolver: any /** TODO #9100 */, urlParser: any /** TODO #9100 */, outletMap: any /** TODO #9100 */, location: any /** TODO #9100 */) => new Router(
|
||||
"RootComponent", RootCmp, resolver, urlParser, outletMap, location),
|
||||
deps: [ComponentResolver, RouterUrlSerializer, RouterOutletMap, Location]
|
||||
}
|
||||
]);
|
||||
|
||||
it('should update location when navigating',
|
||||
fakeAsync(inject([Router, TestComponentBuilder, Location], (router, tcb, location) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder, Location], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */, location: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
|
||||
router.navigateByUrl('/team/22/user/victor');
|
||||
@ -63,7 +63,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
it('should navigate back and forward',
|
||||
fakeAsync(inject([Router, TestComponentBuilder, Location], (router, tcb, location) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder, Location], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */, location: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
|
||||
router.navigateByUrl('/team/33/simple');
|
||||
@ -82,7 +82,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
it('should navigate when locations changes',
|
||||
fakeAsync(inject([Router, TestComponentBuilder, Location], (router, tcb, location) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder, Location], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */, location: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
|
||||
router.navigateByUrl('/team/22/user/victor');
|
||||
@ -95,7 +95,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
it('should support nested routes',
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
|
||||
router.navigateByUrl('/team/22/user/victor');
|
||||
@ -105,7 +105,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
it('should support aux routes',
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
|
||||
router.navigateByUrl('/team/22/user/victor(/simple)');
|
||||
@ -116,7 +116,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
it('should deactivate outlets',
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
|
||||
router.navigateByUrl('/team/22/user/victor(/simple)');
|
||||
@ -129,7 +129,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
it('should deactivate nested outlets',
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
|
||||
router.navigateByUrl('/team/22/user/victor(/simple)');
|
||||
@ -142,7 +142,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
it('should update nested routes when url changes',
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
|
||||
router.navigateByUrl('/team/22/user/victor');
|
||||
@ -158,7 +158,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
it('should not deactivate the route if can deactivate returns false',
|
||||
fakeAsync(inject([Router, TestComponentBuilder, Location], (router, tcb, location) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder, Location], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */, location: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
|
||||
router.navigateByUrl('/team/22/cannotDeactivate');
|
||||
@ -175,7 +175,7 @@ export function main() {
|
||||
|
||||
if (getDOM().supportsDOMEvents()) {
|
||||
it("should support absolute router links",
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
advance(fixture);
|
||||
|
||||
@ -192,7 +192,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
it("should support relative router links",
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
advance(fixture);
|
||||
|
||||
@ -211,7 +211,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
it("should set the router-link-active class",
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
advance(fixture);
|
||||
|
||||
@ -229,7 +229,7 @@ export function main() {
|
||||
})));
|
||||
|
||||
it("should update router links when router changes",
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
advance(fixture);
|
||||
|
||||
@ -247,14 +247,14 @@ export function main() {
|
||||
})));
|
||||
|
||||
it("should support top-level link",
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router, tcb) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(LinkCmp);
|
||||
advance(fixture);
|
||||
expect(fixture.debugElement.nativeElement).toHaveText('link');
|
||||
})));
|
||||
|
||||
it('should replace state when path is equal to current path',
|
||||
fakeAsync(inject([Router, TestComponentBuilder, Location], (router, tcb, location) => {
|
||||
fakeAsync(inject([Router, TestComponentBuilder, Location], (router: any /** TODO #9100 */, tcb: any /** TODO #9100 */, location: any /** TODO #9100 */) => {
|
||||
let fixture = tcb.createFakeAsync(RootCmp);
|
||||
|
||||
router.navigateByUrl('/team/33/simple');
|
||||
@ -286,12 +286,12 @@ function compileRoot(tcb: TestComponentBuilder): Promise<ComponentFixture<any>>
|
||||
@Component({selector: 'user-cmp', template: `hello {{user}}`})
|
||||
class UserCmp implements OnActivate {
|
||||
user: string;
|
||||
routerOnActivate(s: RouteSegment, a?, b?, c?) { this.user = s.getParam('name'); }
|
||||
routerOnActivate(s: RouteSegment, a?: any /** TODO #9100 */, b?: any /** TODO #9100 */, c?: any /** TODO #9100 */) { this.user = s.getParam('name'); }
|
||||
}
|
||||
|
||||
@Component({selector: 'cannot-deactivate', template: `cannotDeactivate`})
|
||||
class CanDeactivateCmp implements CanDeactivate {
|
||||
routerCanDeactivate(a?, b?): Promise<boolean> { return PromiseWrapper.resolve(false); }
|
||||
routerCanDeactivate(a?: any /** TODO #9100 */, b?: any /** TODO #9100 */): Promise<boolean> { return PromiseWrapper.resolve(false); }
|
||||
}
|
||||
|
||||
@Component({selector: 'simple-cmp', template: `simple`})
|
||||
@ -334,7 +334,7 @@ class RelativeLinkCmp {
|
||||
])
|
||||
class TeamCmp implements OnActivate {
|
||||
id: string;
|
||||
routerOnActivate(s: RouteSegment, a?, b?, c?) { this.id = s.getParam('id'); }
|
||||
routerOnActivate(s: RouteSegment, a?: any /** TODO #9100 */, b?: any /** TODO #9100 */, c?: any /** TODO #9100 */) { this.id = s.getParam('id'); }
|
||||
}
|
||||
|
||||
@Component({
|
||||
|
@ -24,7 +24,7 @@ export function main() {
|
||||
let emptyRouteTree = createEmptyRouteTree(ComponentA);
|
||||
|
||||
it('should handle position args',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentA, tree("b/paramB/c/paramC/d"), emptyRouteTree)
|
||||
.then(r => {
|
||||
let a = r.root;
|
||||
@ -48,7 +48,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should support empty routes',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentA, tree("f"), emptyRouteTree)
|
||||
.then(r => {
|
||||
let a = r.root;
|
||||
@ -68,7 +68,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should handle aux routes',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentA, tree("b/paramB(/d//right:d)"), emptyRouteTree)
|
||||
.then(r => {
|
||||
let c = r.children(r.root);
|
||||
@ -89,7 +89,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it("should error when two segments with the same outlet name",
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentA, tree("b/paramB(right:d//right:e)"), emptyRouteTree)
|
||||
.catch(e => {
|
||||
expect(e.message).toEqual(
|
||||
@ -99,7 +99,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should handle nested aux routes',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentA, tree("b/paramB(/d(right:e))"), emptyRouteTree)
|
||||
.then(r => {
|
||||
let c = r.children(r.root);
|
||||
@ -120,7 +120,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should handle non top-level aux routes',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentA, tree('b/paramB/d(e)'), emptyRouteTree)
|
||||
.then(r => {
|
||||
let c = r.children(r.firstChild(r.root));
|
||||
@ -137,7 +137,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should handle matrix parameters',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentA, tree("b/paramB;b1=1;b2=2(/d;d1=1;d2=2)"), emptyRouteTree)
|
||||
.then(r => {
|
||||
let c = r.children(r.root);
|
||||
@ -149,7 +149,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should match a wildcard',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentG, tree("a;aa=1/b;bb=2"), emptyRouteTree)
|
||||
.then(r => {
|
||||
let c = r.children(r.root);
|
||||
@ -162,7 +162,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should error when no matching routes',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentA, tree("invalid"), emptyRouteTree)
|
||||
.catch(e => {
|
||||
expect(e.message).toContain("Cannot match any routes");
|
||||
@ -171,7 +171,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it('should handle no matching routes (too short)',
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentA, tree("b"), emptyRouteTree)
|
||||
.catch(e => {
|
||||
expect(e.message).toContain("Cannot match any routes");
|
||||
@ -180,7 +180,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it("should error when a component doesn't have @Routes",
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentA, tree("d/invalid"), emptyRouteTree)
|
||||
.catch(e => {
|
||||
expect(e.message)
|
||||
@ -190,7 +190,7 @@ export function main() {
|
||||
}));
|
||||
|
||||
it("should reuse existing segments",
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async, resolver) => {
|
||||
inject([AsyncTestCompleter, ComponentResolver], (async: any /** TODO #9100 */, resolver: any /** TODO #9100 */) => {
|
||||
recognize(resolver, ComponentA, tree("/b/1/d"), emptyRouteTree)
|
||||
.then(t1 => {
|
||||
recognize(resolver, ComponentA, tree("/b/1/e"), t1)
|
||||
|
@ -38,20 +38,20 @@ export function main() {
|
||||
{provide: LocationStrategy, useClass: MockLocationStrategy},
|
||||
{
|
||||
provide: Router,
|
||||
useFactory: (resolver, urlParser, outletMap, location) => new Router(
|
||||
useFactory: (resolver: any /** TODO #9100 */, urlParser: any /** TODO #9100 */, outletMap: any /** TODO #9100 */, location: any /** TODO #9100 */) => new Router(
|
||||
"RootComponent", RootCmp, resolver, urlParser, outletMap, location),
|
||||
deps: [ComponentResolver, RouterUrlSerializer, RouterOutletMap, Location]
|
||||
}
|
||||
]);
|
||||
|
||||
describe("routerLink=", () => {
|
||||
it("should accept an array of commands", inject([Router, LocationStrategy], (router, locationStrategy) => {
|
||||
it("should accept an array of commands", inject([Router, LocationStrategy], (router: any /** TODO #9100 */, locationStrategy: any /** TODO #9100 */) => {
|
||||
let link = new RouterLink(null, router, locationStrategy);
|
||||
link.routerLink = ['/one', 11];
|
||||
expect(link.href).toEqual("/one/11");
|
||||
}));
|
||||
|
||||
it("should accept a single command", inject([Router, LocationStrategy], (router, locationStrategy) => {
|
||||
it("should accept a single command", inject([Router, LocationStrategy], (router: any /** TODO #9100 */, locationStrategy: any /** TODO #9100 */) => {
|
||||
let link = new RouterLink(null, router, locationStrategy);
|
||||
link.routerLink = '/one/11';
|
||||
expect(link.href).toEqual("/one/11");
|
||||
|
Reference in New Issue
Block a user