fix(upgrade): make typings compatible with older AngularJS typings (#26880)

Make `angular1` typings compatible with older versions of AngularJS
typings from `@types/angular`.

Closes #26420

PR Close #26880
This commit is contained in:
Andy Blatecky 2018-10-31 12:45:52 -06:00 committed by Kara Erickson
parent c016066d9b
commit 64647af1a6
1 changed files with 6 additions and 1 deletions

View File

@ -10,7 +10,12 @@ export type Ng1Token = string;
export type Ng1Expression = string | Function;
export interface IAnnotatedFunction extends Function { $inject?: ReadonlyArray<Ng1Token>; }
export interface IAnnotatedFunction extends Function {
// Older versions of `@types/angular` typings extend the global `Function` interface with
// `$inject?: string[]`, which is not compatible with `$inject?: ReadonlyArray<string>` (used in
// latest versions).
$inject?: Function extends{$inject?: string[]}? Ng1Token[]: ReadonlyArray<Ng1Token>;
}
export type IInjectable = (Ng1Token | Function)[] | IAnnotatedFunction;