Commit Graph

58 Commits

Author SHA1 Message Date
Martin Probst
970fc9d484 Angular IPromise interop with platform Promise.
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.
2019-02-06 14:08:06 +01:00
Quentin Bouygues
d158d782e9 Test IDirective changes,
cascade generics from IModule's directive function
2018-12-14 17:21:44 +01:00
Quentin Bouygues
7983723f0f Update Directive typings to enable type checking with TS compiler's strict mode
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
2018-12-14 11:53:02 +01:00
barrtender
58d87fc9d4 Fixing ICacheObject::get return type (#29001)
get can return undefined if the key isn't in the cache.

See the example:
https://docs.angularjs.org/api/ng/type/$cacheFactory.Cache
```
  superCache.remove('another key');
  expect(superCache.get('another key')).toBeUndefined();
```
2018-09-18 15:24:08 -07:00
Geoff Cameron
ddb90ccfe1 Add tests 2018-08-13 14:18:26 -04:00
Geoff Cameron
322c5e6cad Use real promise base class 2018-08-03 19:34:11 -04:00
Geoff Cameron
a8486a33ea Make typings compatible with ES6 promises
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
2018-08-02 15:40:03 -04:00
Richie Foreman
1aa8a708ac Add types for $injector.{loadNewModules, modules} to types/angular (#27240)
* 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
2018-07-20 17:34:05 -07:00
Oscar Busk
4ef49ba480 Simplify filterfunction using interface instead of silly type 2018-06-28 22:21:06 +02:00
Oscar Busk
f6a902f8ce Improve module.filter() by allowing $stateful to be defined. 2018-06-28 12:27:49 +02:00
Mine Starks
c01777fef8
Merge pull request #26321 from scipper/master
Added new featured to $rootScope from 1.6.10
2018-06-13 08:36:15 -07:00
Lucas Sloan
8dfa12287e Make the IControllerService typings more specific.
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.
2018-06-07 13:23:10 -07:00
Steffen Kowalski
ce7505a1d1 fixed errors in @types/angular 2018-06-07 09:31:07 +02:00
Steffen Kowalski
ef970e72ad
added docs to $suspend, $isSuspended and $resume 2018-06-06 15:27:16 +02:00
Steffen Kowalski
43448845ed
Added myself to "Definitions by" 2018-06-06 14:14:35 +02:00
Steffen Kowalski
faa9a6b089
Added new featured to $rootScope from 1.6.10
https://github.com/angular/angular.js/blob/master/CHANGELOG.md#1610-crystalline-persuasion-2018-04-17
2018-06-06 14:13:31 +02:00
Lucas Sloan
2689160921 AngularJS: improve types for IQService.all (support for arrays of non-promises). (#25350) 2018-05-03 10:53:09 -07:00
Oscar Busk
f4e0c531ba Add typing for object syntax on component registerer (#25507) 2018-05-03 10:51:31 -07:00
Georgii Dolzhykov
628cbd69e1 AngularJS: improve types for foreach (support for array-likes) 2018-02-08 20:50:26 +02:00
Georgii Dolzhykov
37c1b1dfea AngularJS: 1) fix for $q.reject in then callbacks, 2) types for $error and $pending (#23115)
* 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
2018-01-29 12:12:25 -08:00
Benjamin Buhler
4c23e96fc7 Added $processModelValue to INgModelController (#23128)
See https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#$processModelValue
2018-01-23 15:03:32 -08:00
Robin Keller
25bf971c33 Update angular.module to accept an Injectable as the configFn.
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
2017-12-21 13:03:39 -08:00
mtraynham
bcf7644868 Angular - Default IScope generic typings for backwards compatibility 2017-11-06 11:34:28 -05:00
Daniel Rosenwasser
40d6bf0abd
Merge pull request #21209 from fjmorel/master
angular: Add missing function to ICompileProvider
2017-11-04 01:35:10 -07:00
Fred Morel
20240a4128 Add strictComponentBindingsEnabled to ICompileProvider
Function added in angular 1.6.x
2017-11-02 16:12:59 -04:00
Georgii Dolzhykov
44e215bda7 AngularJS: compatibility with strictFunctionTypes
Fixes #21160
2017-11-01 15:13:22 +03:00
Andy
097d2acf71 Miscellaneous lint fixes (#20849) 2017-10-22 15:22:50 -07:00
aidandownes
0b0c6b20b0 Update type definition for $injector.invoke to be consistent with angular documentation/code. (#19886)
- $inject.invoke also accepts optional context and locals agruments when function is an array annotation format.
- Also added tests.
2017-10-16 09:06:56 -07:00
Elijah Schow
ec2c36e82b Add `$overrideModelOptions' to 'INgModelController' (closes #19136) (#19880)
AngularJS Issue:
https://github.com/angular/angular.js/issues/12884

AngularJS Documentation:
https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#$overrideModelOptions

AngularJS Source:
https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js#L863
2017-10-16 09:04:19 -07:00
Georgii Dolzhykov
69acc07b23 angular: Better types for HTTP interceptors & response objects (#19247)
* Better types for HTTP interceptors & response objects

* Fix failing tests

* Don't use TS 2.3 features, staying compatible with 2.1
2017-08-22 22:22:20 +01:00
Andy
5d6c651a1a Apply stricter lint rules (#19063) 2017-08-17 14:53:41 -07:00
Leonard Thieu
351589d38d [angular] Add index signature to JQLite. (#18767) 2017-08-14 11:28:41 -07:00
Joel Poloney
a7bc5ed2d4 Adding missing race method to angular.IQService (#18476)
* Adding missing race method to angular.IQService

https://docs.angularjs.org/api/ng/service/$q lists race(promises); as a valid method in AngularJS $q. Adding this type so it can be used accordingly.

* Fixing lint errors

* Fixing use of array
2017-07-28 12:47:05 -07:00
Angus Jones
2cde2fb1ed Remove [index: string]: any; in IRootScopeService
To bring it into line with both the documentation (https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/angular#a-word-on-scope-and-assigning-new-members) and the general guidelines (https://github.com/Microsoft/TypeScript/issues/12596#issuecomment-299976171).
2017-07-18 10:00:28 +10:00
Eddie Stanley
cb14ef339d [angular] Added support for specifying the JSON-P callback parameter name to $http service 2017-07-12 19:30:52 +10:00
Leonard Thieu
efc67e63d9 [angular][jquery] Fix merge issue with cssPropertySetter. 2017-06-26 17:36:16 -04:00
Leonard Thieu
d8e10aafad Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped into angular 2017-06-23 09:34:22 -04:00
Nathan Shively-Sanders
fcb37f9fe0 Merge pull request #17281 from kalleguld/master
angular: gave a more precise return type for IQService.all()
2017-06-22 14:28:29 -07:00
Leonard Thieu
b7f084da26 [angular] Add @types/jquery@3 integration tests. 2017-06-21 18:07:02 -04:00
Leonard Thieu
ec325e9f84 Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped into angular 2017-06-21 17:27:57 -04:00
Kasper Guldmann Nielsen
2effeac8f0 angular: gave a more precise return type to $q.all<T>() 2017-06-21 18:53:30 +02:00
Nathan Shively-Sanders
31739ef0c6 Merge pull request #17303 from DefinitelyTyped/weak-types-round-3
More fixes for 2.4. Not all for weak types.
2017-06-20 09:20:23 -07:00
Nathan Shively-Sanders
1119ad2d81 More fixes for 2.4. Not all for weak types:
2.4 also has been inference for generics, which finds more errors as
well.
2017-06-19 13:00:47 -07:00
Leonard Thieu
9e58e7e879 [angular] Remove dependency on @types/jquery. 2017-06-19 14:46:49 -04:00
Nathan Shively-Sanders
37e41d33e4 Deprecate incorrect resolve overload and usage 2017-06-19 09:30:38 -07:00
Kasper Guldmann Nielsen
5c0f7336fb angular: gave a more precise return type for IQService.all() 2017-06-18 22:20:49 +02:00
Leonard Thieu
1c3565933c :( 2017-06-13 13:00:42 -04:00
Cosmin Ababei
7ce18dce88 Added locals to $evalAsync (#16725)
* Added locals to $evalAsync

See https://docs.angularjs.org/api/ng/type/$rootScope.Scope#$evalAsync

* Changed the return type of the expression inside $evalAsync
2017-06-02 08:03:52 -07:00
Caleb St-Denis
514a27de01 angular - Separate interfaces for each lifecycle hook (#16299)
* Separate interfaces for each lifecycle hook

Having one required hook per interface leads to greater type safety than
having a single IController interface with all properties optional.
Namely, the IController interface will not help you if you misspell a hook
name. (A slight improvement, admittedly, but an improvement nonetheless.)

This is closer to how the typings are done for lifecycle hooks in ng2.

* Use `dtslint`

* Fix trailing whitespace
2017-05-03 12:02:48 -07:00
Mateusz
d5240b6d9c Re-add generic Function type to IInjector.invoke() sygnature. (#16042)
Looks like it is used in some projects. 'Function' should be treated
as a function with '(..args: any[]) => any' signature.
2017-04-26 11:47:36 -07:00