-
Notifications
You must be signed in to change notification settings - Fork 30.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
angular.d.ts updates with constructor and factory interfaces. #2369
Conversation
Instead of IModule.provider simply accepting an Function for a class constructor, use an interface to enforce the type of class.
Adds intellisense when constructing directive objects
Missed provider functions that return objects. Ensure that they also implement ng.IServiceProvider.
Converted the test module, 'http-auth-interceptor', to a class to eliminate error on using anonymous type constructor.
To get the CI tests to pass, I had to converted the test module, 'http-auth-interceptor', to a class to eliminate error on using anonymous type constructor. I'm not sure what the philosophy on combining JS constructs like anonymous types:
and letting them work with DefinitelyTyped instead of converting them to idiomatic classes:
Since an example using these constructs pasted into TypeScript will still compile through even with an error/warnings like this, I think this approach is enhances the intent of the AngularJS library and lets people improve their code. |
sorry, i was late.. |
@ngbrown merged! thanks mate. |
This latest change
and
|
@@ -119,7 +128,7 @@ declare module ng { | |||
*/ | |||
controller(name: string, inlineAnnotatedConstructor: any[]): IModule; | |||
controller(object : Object): IModule; | |||
directive(name: string, directiveFactory: Function): IModule; | |||
directive(name: string, directiveFactory: IDirectiveFactory): IModule; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
causes #2618
Tracking #2618 |
Adds better intellisense for
ng.IModule.provider()
andng.IModule.directive()
when used with a constructor/class or object factory function.Also replaces single use of
ng.auto.IProvider
with identicalng.IServiceProvider
.