URLMatchResult type should include null
See original GitHub issueπ bug report
Affected Package
URLMatcher is part of @angular/router
Is this a regression?
No
Description
Even in the example, is shown, that null
, is to express that matcher didnβt match.
π¬ Minimal Reproduction
export function myMatcher(segments: UrlSegment[]): UrlMatchResult {
return null;
}
π₯ Exception or Error
Type 'null' is not assignable to type 'UrlMatchResult'.
π Your Environment
Angular Version:
Angular CLI: 7.1.2
Node: 9.11.1
OS: win32 x64
Angular: 7.2.4
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.11.2
@angular-devkit/build-angular 0.11.2
@angular-devkit/build-optimizer 0.11.2
@angular-devkit/build-webpack 0.11.2
@angular-devkit/core 7.1.2
@angular-devkit/schematics 7.1.2
@angular/cli 7.1.2
@ngtools/webpack 7.1.2
@schematics/angular 7.1.2
@schematics/update 0.11.2
rxjs 6.4.0
typescript 3.2.4
webpack 4.23.1
Issue Analytics
- State:
- Created 4 years ago
- Reactions:8
- Comments:8 (2 by maintainers)
Top Results From Across the Web
UrlMatchResult - Angular
Represents the result of matching URLs with a custom matching function. See more... type UrlMatchResult = {Β ...
Read more >How to consume Angulars routing UrlMatchResult from ...
I see two issues with your implementation: UrlMatchResult PosParams are not any type, they are a map of strings to UrlSegment .
Read more >Adding and Customizing Routes - Spartacus Documentation
The CMS in SAP Commerce Cloud includes the following special page types: ... UrlSegment[] ): UrlMatchResult | null { // check if URL...
Read more >Add navigation and routing | Getting Started with the AEM SPA ...
Dynamic navigation is implemented using Angular routes and added to an existing Header component. Objective. Understand the SPA model routingΒ ...
Read more >Angular - UrlMatcher
type -alias. Contents. Usage notes. A function for matching a route against URLs. Implement a custom URL matcher for Route.matcher when a combination...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This is a must have ! But in fact it already works. It seems to be just a typing issue.
The 2nd solution works as expected when returning null. The route is not activated.
Itβs not βcleanβ but works.
I seeβ¦ well thenβ¦