Skip to content

docs: Adding type annotation to ngOnInit()#43579

Closed
fusho-takahashi wants to merge 1 commit into
angular:masterfrom
fusho-takahashi:fix-toh-example-codes
Closed

docs: Adding type annotation to ngOnInit()#43579
fusho-takahashi wants to merge 1 commit into
angular:masterfrom
fusho-takahashi:fix-toh-example-codes

Conversation

@fusho-takahashi
Copy link
Copy Markdown
Contributor

Adding type annotation to ngOnInit() in example codes of tutorial.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Adding type annotation to ngOnInit() in example codes of tutorial.
ref. https://github.com/angular/angular-cli/blob/a02f48d6f82d7568b4f5bc26add4f7bfa36e2d3f/packages/schematics/angular/component/files/__name%40dasherize%40if-flat__/__name%40dasherize__.__type%40dasherize__.ts.template#L26

Does this PR introduce a breaking change?

  • Yes
  • No

@google-cla google-cla Bot added the cla: yes label Sep 24, 2021
@pullapprove pullapprove Bot requested a review from IgorMinar September 24, 2021 22:19
@ngbot ngbot Bot added this to the Backlog milestone Sep 30, 2021
@AndrewKushnir
Copy link
Copy Markdown
Contributor

@fusho-takahashi thanks for creating the PR. I'm curious what is the main motivation of adding those types? Is that mostly for consistency purposes with other methods on those classes? Thank you.

@fusho-takahashi
Copy link
Copy Markdown
Contributor Author

fusho-takahashi commented Nov 1, 2021

@AndrewKushnir Thank you for your comment.
Because when I did 'Tour of Heroes' in Angular version 12, There was a difference between the code generated by Angular CLI and example code.

@AndrewKushnir
Copy link
Copy Markdown
Contributor

@fusho-takahashi thanks for additional information. Could you please let me know which CLI commands you've used (so I can reproduce the problem)? Thank you.

@fusho-takahashi
Copy link
Copy Markdown
Contributor Author

@AndrewKushnir
I used following CLI commands. thank you.

npx @angular/cli@12 new angular-tour-of-heroes
cd angular-tour-of-heroes/
npx ng generate component heroes

ref. https://angular.io/tutorial/toh-pt1

Copy link
Copy Markdown
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fusho-takahashi thanks for additional information. The change looks good 👍

Could you please update the commit message to include a note on why this change is made (to make it consistent with the class structure produced by the CLI)?

Thank you.

@AndrewKushnir AndrewKushnir added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews target: patch This PR is targeted for the next patch release labels Nov 9, 2021
@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Nov 16, 2021
@ngbot
Copy link
Copy Markdown

ngbot Bot commented Nov 16, 2021

I see that you just added the action: merge label, but the following checks are still failing:
    failure status "ci/circleci: legacy-unit-tests-saucelabs" is failing
    pending status "pullapprove" is pending
    pending 1 pending code review

If you want your PR to be merged, it has to pass all the CI checks.

If you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help.

@AndrewKushnir
Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit 6c618de.

AndrewKushnir pushed a commit that referenced this pull request Nov 16, 2021
 1�7 the class structure produced by the CLI (#43579)

PR Close #43579
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Dec 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants