Skip to content

fix(@schematics/angular): canLoad guard signature #18756

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

Merged
merged 1 commit into from
Sep 11, 2020
Merged

fix(@schematics/angular): canLoad guard signature #18756

merged 1 commit into from
Sep 11, 2020

Conversation

geromegrignon
Copy link
Contributor

PR Type

What kind of change does this PR introduce?

  • Bugfix

What is the current behavior?

using the guard schematic with the --implements CanLoad option, the signature of the canLoad generated method is missing UrlTree.

export class TestGuard implements CanLoad {
  canLoad(
    route: Route,
    segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean {
    return true;
  }
}

Issue Number: #18751

What is the new behavior?

The schematic file has been updated to provide the following result :

export class TestGuard implements CanLoad {
  canLoad(
    route: Route,
    segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
    return true;
  }

Does this PR introduce a breaking change?

  • Yes
  • No

@geromegrignon
Copy link
Contributor Author

Is there some action i can make to fix the CI error? I looked at the logs but couldn't figure out how the changes affected it.

Copy link
Collaborator

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for this.

@alan-agius4
Copy link
Collaborator

Is there some action i can make to fix the CI error? I looked at the logs but couldn't figure out how the changes affected it.

Looks like a flake, I re-triggered the CI step

@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Sep 11, 2020
@alan-agius4
Copy link
Collaborator

alan-agius4 commented Sep 11, 2020

@geromegrignon, just realised that you didn't add a Closes note in your commit message.

Can you update the commit please?

fix(@schematics/angular): update canLoad guard signature

Closes: #18751

Also for future contributions it's best to write the description of the PR as part of the commit message body.

Thanks

@alan-agius4 alan-agius4 added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: merge The PR is ready for merge by the caretaker labels Sep 11, 2020
@alan-agius4 alan-agius4 linked an issue Sep 11, 2020 that may be closed by this pull request
15 tasks
add UrlTree to canLoad guard signature to match the documentation and the other implementations

Closes: #18751
@geromegrignon
Copy link
Contributor Author

I added the issue number and added a more complete body message.

@alan-agius4 alan-agius4 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 Sep 11, 2020
@clydin clydin merged commit 8e05a5e into angular:master Sep 11, 2020
@angular-automatic-lock-bot
Copy link

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 Oct 12, 2020
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 target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

guard canLoad(), incorrect return types
4 participants