Skip to content
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.js) Introduce type aliases LinkFnControllerType and RequireT… #26897

Closed
wants to merge 1 commit into from

Conversation

rkirov
Copy link

@rkirov rkirov commented Jun 28, 2018

…ype.

This allows users to write callbacks using those aliases instead of the
full type.

Having convinient aliases is required for having AngularJS in TS work
better with strictFunctionTypes flag on.
see: angular/angular.js#16617

Also having them next to each other shows the symmetry between the
require and controller param better.

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.
  • Test the change in your own code. (Compile and run.)
  • Add or edit tests to reflect the change. (Run with npm test.)
  • Follow the advice from the readme.
  • Avoid common mistakes.
  • Run npm run lint package-name (or tsc if no tslint.json is present).

Select one of these and delete the others:

If changing an existing definition:

…ype.

This allows users to write callbacks using those aliases instead of the
full type.

Having convinient aliases is required for having AngularJS in TS work
better with strictFunctionTypes flag on.
see: angular/angular.js#16617

Also having them next to each other shows the symmetry between the
require and controller param better.
@rkirov
Copy link
Author

rkirov commented Jun 28, 2018

Hmm, the CI timedout, not sure if it is related to my change.

@typescript-bot typescript-bot added this to Needs Author Attention in Pull Request Status Board Jun 28, 2018
@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). The Travis CI build failed labels Jun 28, 2018
@typescript-bot
Copy link
Contributor

typescript-bot commented Jun 28, 2018

@rkirov Thank you for submitting this PR!

🔔 @diegovilar @thorn0 @calebstdenis @leonard-thieu - please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

If no reviewer appears after a week, a DefinitelyTyped maintainer will review the PR instead.

@typescript-bot
Copy link
Contributor

typescript-bot commented Jun 28, 2018

@rkirov The Travis CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@typescript-bot typescript-bot added Popular package This PR affects a popular package (as counted by NPM download counts). and removed Popular package This PR affects a popular package (as counted by NPM download counts). labels Jun 28, 2018
@thorn0
Copy link
Contributor

thorn0 commented Jun 28, 2018

link: (..., controller: angular.LinkFnControllerType) => {
  let myController = controller as MyControllerType;
}

You don't have to type-annotate the callback parameters here because the types are inferred. Superfluous type annotations are often seen as bad style. They definitely should be avoided in places like code examples and documentation.

@rkirov
Copy link
Author

rkirov commented Jun 28, 2018

You are totally right, forgot about inferences of a second. Indeed, this change is not required for the strict fn types rollout, so I am closing it.

@rkirov rkirov closed this Jun 28, 2018
@typescript-bot typescript-bot removed this from Needs Author Attention in Pull Request Status Board Jun 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Popular package This PR affects a popular package (as counted by NPM download counts).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants