From 64647af1a6303cd5acf49868f83442f0ac6a1a51 Mon Sep 17 00:00:00 2001 From: Andy Blatecky Date: Wed, 31 Oct 2018 12:45:52 -0600 Subject: [PATCH] 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 --- packages/upgrade/src/common/angular1.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/upgrade/src/common/angular1.ts b/packages/upgrade/src/common/angular1.ts index 85ce530855..a8a4f157a2 100644 --- a/packages/upgrade/src/common/angular1.ts +++ b/packages/upgrade/src/common/angular1.ts @@ -10,7 +10,12 @@ export type Ng1Token = string; export type Ng1Expression = string | Function; -export interface IAnnotatedFunction extends Function { $inject?: ReadonlyArray; } +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` (used in + // latest versions). + $inject?: Function extends{$inject?: string[]}? Ng1Token[]: ReadonlyArray; +} export type IInjectable = (Ng1Token | Function)[] | IAnnotatedFunction;