Skip to content

Commit 2f83769

Browse files
committed
(chore): Fix transpiler complaints
1 parent 69b5d72 commit 2f83769

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

src/localize-router.config.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Inject, InjectionToken, Provider} from '@angular/core';
1+
import { Inject, InjectionToken, Provider } from '@angular/core';
22

33
/**
44
* Guard to make sure we have single initialization of forRoot
@@ -29,17 +29,17 @@ export namespace CacheMechanism {
2929
* Boolean to indicate whether to use cached language value
3030
* @type {InjectionToken<boolean>}
3131
*/
32-
export const USE_CACHED_LANG = new InjectionToken('USE_CACHED_LANG');
32+
export const USE_CACHED_LANG = new InjectionToken<boolean>('USE_CACHED_LANG');
3333
/**
3434
* Cache mechanism type
3535
* @type {InjectionToken<CacheMechanism>}
3636
*/
37-
export const CACHE_MECHANISM = new InjectionToken('CACHE_MECHANISM');
37+
export const CACHE_MECHANISM = new InjectionToken<CacheMechanism>('CACHE_MECHANISM');
3838
/**
3939
* Cache name
4040
* @type {InjectionToken<string>}
4141
*/
42-
export const CACHE_NAME = new InjectionToken('CACHE_NAME');
42+
export const CACHE_NAME = new InjectionToken<string>('CACHE_NAME');
4343

4444
/**
4545
* Type for default language function
@@ -51,13 +51,13 @@ export type DefaultLanguageFunction = (languages: string[], cachedLang?: string,
5151
* Function for calculating default language
5252
* @type {InjectionToken<DefaultLanguageFunction>}
5353
*/
54-
export const DEFAULT_LANG_FUNCTION = new InjectionToken('DEFAULT_LANG_FUNCTION');
54+
export const DEFAULT_LANG_FUNCTION = new InjectionToken<DefaultLanguageFunction>('DEFAULT_LANG_FUNCTION');
5555

5656
/**
5757
* Boolean to indicate whether prefix should be set for single language scenarios
5858
* @type {InjectionToken<boolean>}
5959
*/
60-
export const ALWAYS_SET_PREFIX = new InjectionToken('ALWAYS_SET_PREFIX');
60+
export const ALWAYS_SET_PREFIX = new InjectionToken<boolean>('ALWAYS_SET_PREFIX');
6161

6262
/**
6363
* Config interface for LocalizeRouter

src/localize-router.parser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Observable } from 'rxjs/Observable';
55
import { Observer } from 'rxjs/Observer';
66
import { Location } from '@angular/common';
77
import 'rxjs/add/observable/forkJoin';
8-
import 'rxjs/add/operator/toPromise';
8+
import 'rxjs/add/observable/toPromise';
99
import 'rxjs/add/operator/share';
1010
import { CacheMechanism, LocalizeRouterSettings } from './localize-router.config';
1111

@@ -88,7 +88,7 @@ export abstract class LocalizeParser {
8888

8989
/** exclude certain routes */
9090
for (let i = children.length - 1; i >= 0; i--) {
91-
if (children[i].data && children[i].data.skipRouteLocalization) {
91+
if (children[i].data && children[i].data['skipRouteLocalization']) {
9292
if (this.settings.alwaysSetPrefix) {
9393
// add directly to routes
9494
this.routes.push(children[i]);

src/localize-router.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Injectable } from '@angular/core';
2-
import { Router, NavigationStart, ActivatedRouteSnapshot, NavigationExtras } from '@angular/router';
2+
import { Router, NavigationStart, ActivatedRouteSnapshot, NavigationExtras, Route } from '@angular/router';
33
import { Subject } from 'rxjs/Subject';
44
import { Observable } from 'rxjs/Observable';
55
import 'rxjs/add/observable/forkJoin';
@@ -125,8 +125,8 @@ export class LocalizeRouterService {
125125
// This value does not exist in Router before version 4
126126
// so we have to find it indirectly
127127
if (event.toString().match(/RouteConfigLoadEnd/)) {
128-
Observable.of(event.route).toPromise().then(function (route) {
129-
self.parser.initChildRoutes(route._loadedConfig.routes);
128+
Observable.of(event.route).toPromise().then(function (route: Route) {
129+
self.parser.initChildRoutes((<any>route)._loadedConfig.routes);
130130
});
131131
}
132132
};

0 commit comments

Comments
 (0)