diff --git a/src/justjs.ts b/src/justjs.ts index 884f54f12..d601604e9 100644 --- a/src/justjs.ts +++ b/src/justjs.ts @@ -72,7 +72,7 @@ services.$injector = { let STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; let ARGUMENT_NAMES = /([^\s,]+)/g; if (!isInjectable(fn)) throw new Error(`Not an injectable function: ${fn}`); - if (fn && fn.$inject) return fn.$inject; + if (fn && fn['$inject']) return fn['$inject']; if (isArray(fn)) return (fn as any).slice(0, -1); let fnStr = fn.toString().replace(STRIP_COMMENTS, ''); let result = fnStr.slice(fnStr.indexOf('(') + 1, fnStr.indexOf(')')).match(ARGUMENT_NAMES); diff --git a/src/state/state.ts b/src/state/state.ts index c5a59571d..5615ce117 100644 --- a/src/state/state.ts +++ b/src/state/state.ts @@ -3,8 +3,8 @@ import {isObject} from "../common/predicates"; import {bindFunctions} from "../common/common"; import {BuilderFunction} from "./stateBuilder"; import {StateRegistry} from "./stateRegistry"; -import {State} from "./stateObject"; -import {Ng1StateDeclaration} from "../ng1/interface"; // TS4053 +import {StateDeclaration} from "./interface"; +import {State} from "./stateObject"; // has or is using /** * @ngdoc object @@ -262,8 +262,8 @@ export class StateProvider { * To create a parent/child state use a dot, e.g. "about.sales", "home.newest". * @param {object} definition State configuration object. */ - state(name: string, definition: Ng1StateDeclaration): StateProvider; - state(definition: Ng1StateDeclaration): StateProvider; + state(name: string, definition: StateDeclaration): StateProvider; + state(definition: StateDeclaration): StateProvider; state(name: any, definition?: any) { if (isObject(name)) { definition = name; diff --git a/src/state/stateBuilder.ts b/src/state/stateBuilder.ts index 41adb80ea..147ddf597 100644 --- a/src/state/stateBuilder.ts +++ b/src/state/stateBuilder.ts @@ -138,7 +138,7 @@ export function resolvablesBuilder(state: State): Resolvable[] { /** fetch DI annotations from a function or ng1-style array */ const annotate = (fn: Function) => - fn.$inject || services.$injector.annotate(fn, services.$injector.strictDi); + fn['$inject'] || services.$injector.annotate(fn, services.$injector.strictDi); /** true if the object has both `token` and `resolveFn`, and is probably a [[ResolveLiteral]] */ const isResolveLiteral = (obj: any) => !!(obj.token && obj.resolveFn); diff --git a/src/url/urlRouter.ts b/src/url/urlRouter.ts index 6ffffb34b..0da9f731e 100644 --- a/src/url/urlRouter.ts +++ b/src/url/urlRouter.ts @@ -2,12 +2,10 @@ import {extend, bindFunctions, IInjectable} from "../common/common"; import {isFunction, isString, isDefined, isArray} from "../common/predicates"; import {UrlMatcher} from "./urlMatcher"; -import {services, $InjectorLike} from "../common/coreservices"; +import {services, $InjectorLike, LocationServices} from "../common/coreservices"; import {UrlMatcherFactory} from "./urlMatcherFactory"; import {StateParams} from "../params/stateParams"; -import IInjectorService = angular.auto.IInjectorService; import {RawParams} from "../params/interface"; -import ILocationService = angular.ILocationService; /** @hidden */ let $location = services.location; @@ -75,7 +73,7 @@ export class UrlRouterProvider { /** @hidden */ rules: Function[] = []; /** @hidden */ - otherwiseFn: ($injector: IInjectorService, $location: ILocationService) => string; + otherwiseFn: ($injector: $InjectorLike, $location: LocationServices) => string; /** @hidden */ interceptDeferred = false; @@ -121,7 +119,7 @@ export class UrlRouterProvider { * * @return [[$urlRouterProvider]] (`this`) */ - rule(rule: ($injector: IInjectorService, $location: ILocationService) => string): UrlRouterProvider { + rule(rule: ($injector: $InjectorLike, $location: LocationServices) => string): UrlRouterProvider { if (!isFunction(rule)) throw new Error("'rule' must be a function"); this.rules.push(rule); return this; @@ -154,7 +152,7 @@ export class UrlRouterProvider { * * @return {object} `$urlRouterProvider` - `$urlRouterProvider` instance */ - otherwise(rule: string | (($injector: IInjectorService, $location: ILocationService) => string)): UrlRouterProvider { + otherwise(rule: string | (($injector: $InjectorLike, $location: LocationServices) => string)): UrlRouterProvider { if (!isFunction(rule) && !isString(rule)) throw new Error("'rule' must be a string or function"); this.otherwiseFn = isString(rule) ? () => rule : rule; return this;