Users write code like:
angular.element(window)
angular.element($window) // IWindowService
but this fails with a type error under TypeScript 3.5, due to a change
in the type of of Window. (Previously the only reason it compiled is
that Window was matching the ArrayLike<Element> param.)
Note that if you run the tests, the definition of JQueryStatic here
in the JQLite typings declaration-merges with the full JQuery
definition, which accepts any (!) so there is no type error. But if
you use just this library without JQuery, the type errors without my
fix look like:
angular-tests.ts:788:17 - error TS2345: Argument of type 'Window' is not assignable to parameter of type 'string | Element | Document | JQuery | ArrayLike<Element> | (() => void)'.
Type 'Window' is missing the following properties from type 'Document': activeElement, alinkColor, all, anchors, and 147 more.
788 angular.element(window);
~~~~~~
angular-tests.ts:790:17 - error TS2345: Argument of type 'IWindowService' is not assignable to parameter of type 'string | Element | Document | JQuery | ArrayLike<Element> | (() => void)'.
Type 'IWindowService' is missing the following properties from type 'Document': activeElement, alinkColor, all, anchors, and 147 more.
Angular promises support `.then()` chaining of functions that return
arbitrary `then()`able values.
https://docs.angularjs.org/api/ng/service/$q#the-promise-api
This change updates the definition of `ng.IPromise.then()` to match that
by overloading the function to handle `PromiseLike` values.
With TypeScript's flag `strictFunctionTypes`, the directive type needs to accept subtypes of its current arguments, and cascade them to its function.
This commit adds it using cascading generics on all the related types
Since ES6 promises don't implement finally, trying to $q.when a third
party promises fails typings. This introduces a new type that is
compatible with this, to allow for typings to work when
taking an ES6 promise.
Totally willing to change the name to something more sensible here
* Add {loadNewModules, modules} to angular.auto.IInjectorService
* Add {loadNewModules, modules} to angular.auto.IInjectorService
* Allow for annotated functions in .loadNewModules()
* Fix Injectable Type
* Add useful docstrings (which are pretty much carbon copied from the Angular docs)
* I dont see any whitespace, but travis does.. remove junk
* more
* Add {loadNewModules, modules} to angular.auto.IInjectorService
Tighten the IControllerService typings by replacing the generic Function type with the more specific (...args: any[]) => T, which specifies a function which returns a generic type matching the controller required.
* AngularJS: 1) fix an issue with $q.reject in then callbacks, 2) types for $error and $pending
Fixes#21333
* Promise typings from lib.d.ts + IPromise<never> hack
This is undocumented behavior in Angular, but works because this argument is passed to $injector.invoke.
See 49aba51e6b/src/loader.js lines 81, 370, and 111