Skip to content

Made ui-router noImplicitAny compliant #2836

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

Closed
wants to merge 1 commit into from
Closed

Made ui-router noImplicitAny compliant #2836

wants to merge 1 commit into from

Conversation

johnnyreilly
Copy link
Contributor

@johnnyreilly johnnyreilly commented Jun 27, 2016

This resolves issue #2693.

I know the issue had been marked as WontFix but i've created this PR given that users of the latest router will have to be on TypeScript 2.0 (which hasn't yet shipped) and have specific a tsconfig option set in order to use the ui-router (usage of noImplicitAny is pretty commonplace). That's a real shame and a slight barrier to entry.

For the most part it was just a case of taking a trip through the code and adding to method signatures an any annotation per parameter where there is no annotation at all at present. If you decided to upgrade the types to something more specific over time that would be completely open to you.

Whilst working on this I noticed there were some invalid references to the stateEvents.ts file in files.js and Gruntfile.js. I've fixed these so they point to the legacy subfolder.

@christopherthielen
Copy link
Contributor

@johnnyreilly I haven't forgotten about this PR and I appreciate the interest and the work that you've done.

I'm not going to merge it, based on the following reasons:

  1. Function parameter typings are now used to generate our API docs.
  2. Lack of a type on a parameter implies that the documentation for that function isn't complete
  3. Existence of a type on a parameter implies that the function has been documented.

Adding : any type to functions that can't actually take any will end up in the API documentation, and will be misleading to end users.


However I am open to making UI-Router noImplicitAny safe by adding explicit types to all parameters. This would require each method to be analyzed and the correct types added.

This is something I will commit to tackling as a low priority effort, as I'm working through other issues.

@johnnyreilly
Copy link
Contributor Author

Thanks for the detailed explanation @christopherthielen. I appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants