Commit ec25af5
committed
fix(@schematics/angular): import UrlSegment instead of subPath in guard generator
When generating class-based `CanMatch` guards (`ng g guard --implements=CanMatch --no-functional`), the guard implementation template defines `canMatch(route: Route, segments: UrlSegment[])`.
Previously, the schematic added `'subPath'` instead of `'UrlSegment'` to `@angular/router` named imports. Because `@angular/router` does not export `subPath`, this generated code with broken imports (`Module '"@angular/router"' has no exported member 'subPath'`) while leaving `UrlSegment` unimported (`Cannot find name 'UrlSegment'`).
This change ensures `UrlSegment` is imported when generating `CanMatch` guards.1 parent ecf8c08 commit ec25af5
2 files changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
| 168 | + | |
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
201 | | - | |
| 201 | + | |
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
| |||
0 commit comments