Conversation
Migrates route.canLoad and class/interface CanLoad implementations to CanMatch ahead of the removal in v23: - Replaces 'implements CanLoad' with 'implements CanMatch' (or removes CanLoad if CanMatch is already present). - Renames the 'canLoad' member on guard classes to 'canMatch'. - Moves route 'canLoad' to 'canMatch' in route definitions (merging elements if 'canMatch' already exists). - Renames callsites and property references to 'canMatch' in tests (e.g. guard.canLoad(...), TestBed.inject(Guard).canLoad(...), spyOn(guard, 'canLoad'), and expect(guard.canLoad)). - Updates imports from @angular/router (CanLoad -> CanMatch, CanLoadFn -> CanMatchFn).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an automated migration for
Route.canLoadandCanLoadremoval in v23.Summary of Changes:
implements CanLoad->implements CanMatch: ReplacesCanLoadwithCanMatchin class heritage clauses. IfCanMatchis already implemented on the class,CanLoadis cleanly removed from the clause.canLoadmethods, properties, and accessors on guard classes (and derived classes) tocanMatch. Also migrates object-literal guards.Route.canLoad->Route.canMatch): Renames routecanLoadproperty tocanMatch. IfcanMatchis already present on the route object, the guards fromcanLoadare merged into thecanMatcharray andcanLoadis removed without leaving trailing commas or blank lines.canMatchin tests (e.g.guard.canLoad(...),TestBed.inject(MyGuard).canLoad(...),spyOn(guard, 'canLoad'),expect(guard.canLoad).toHaveBeenCalled(), androute.canLoad).@angular/routerimports (CanLoad->CanMatch,CanLoadFn->CanMatchFn) viaImportManager.