[BUG] Errors when parsing custom route matchers
See original GitHub issueThese are my routes for one of my modules:
const routes: Routes = [
{
path: '',
component: GalleriesComponent,
data: {
title: 'Bildergalerien'
}
},
{ path: ':slug', component: GalleryComponent },
{
matcher: url => {
if (url.length === 2 && url[1].path.match(/^\d+$/g)) {
return {
consumed: url,
posParams: {
slug: new UrlSegment(url[0].path, {}),
page: new UrlSegment(url[1].path, {}),
}
}
} else {
return null
}
},
component: GalleryComponent
},
{ path: ':slug/:imageSlug', component: GalleryImageComponent },
]
This is the error I get while compodoc
ing my app:
Unhandled Rejection at: Promise {
<rejected> InvalidOperationError: Expected to find an initializer.
at InvalidOperationError.BaseError [as constructor] (/Users/martin/my-project/node_modules/ts-simple-ast/dist/errors/BaseError.js:7:28)
at new InvalidOperationError (/Users/martin/my-project/node_modules/ts-simple-ast/dist/errors/InvalidOperationError.js:8:28)
at Object.throwIfNullOrUndefined (/Users/martin/my-project/node_modules/ts-simple-ast/dist/errors/helpers.js:96:15)
at PropertySignature.InitializerGetExpressionableNode.class_1.getInitializerOrThrow (/Users/martin/my-project/node_modules/ts-simple-ast/dist/compiler/base/initializer/InitializerGetExpressionableNode.js:25:27)
at RouterParserUtil.cleanFileDynamics (/Users/martin/my-project/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5677:80)
at AngularDependencies.getSourceFileDecorators (/Users/martin/my-project/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:8152:46)
at /Users/martin/my-project/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7960:31
at Array.map (<anonymous>)
at AngularDependencies.getDependencies (/Users/martin/my-project/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7949:21)
at CliApplication.Application.getDependenciesData (/Users/martin/my-project/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:9498:40)
} reason: InvalidOperationError: Expected to find an initializer.
at InvalidOperationError.BaseError [as constructor] (/Users/martin/my-project/node_modules/ts-simple-ast/dist/errors/BaseError.js:7:28)
at new InvalidOperationError (/Users/martin/my-project/node_modules/ts-simple-ast/dist/errors/InvalidOperationError.js:8:28)
at Object.throwIfNullOrUndefined (/Users/martin/my-project/node_modules/ts-simple-ast/dist/errors/helpers.js:96:15)
at PropertySignature.InitializerGetExpressionableNode.class_1.getInitializerOrThrow (/Users/martin/my-project/node_modules/ts-simple-ast/dist/compiler/base/initializer/InitializerGetExpressionableNode.js:25:27)
at RouterParserUtil.cleanFileDynamics (/Users/martin/my-project/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5677:80)
at AngularDependencies.getSourceFileDecorators (/Users/martin/my-project/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:8152:46)
at /Users/martin/my-project/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7960:31
at Array.map (<anonymous>)
at AngularDependencies.getDependencies (/Users/martin/my-project/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7949:21)
at CliApplication.Application.getDependenciesData (/Users/martin/my-project/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:9498:40)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:6
Top Results From Across the Web
Custom Route Matching with the Angular Router - Medium
You'll parse the URL to check if it matches the pattern you want, and you'll return the consumed URL, along with custom route...
Read more >Tutorial: Creating custom route matches - Angular
In this tutorial, you'll build a custom route matcher using Angular's UrlMatcher . This matcher looks for a Twitter handle in the URL....
Read more >Parser Error when deploy ASP.NET application - Stack Overflow
Once I found that one ASHX page and fixed the class name to reflect its own class name, all ASPX and ASHX files...
Read more >Routing in ASP.NET Core - Microsoft Learn
If the routing system reported an ambiguity error at startup, ... algorithm has run out of route template to parse, so this is...
Read more >Error handling — tapir 0.x documentation
The path doesn't match if a path segment is missing, there's a constant value mismatch or a decoding error (e.g. parsing a segment...
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 FreeTop 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
Top GitHub Comments
It seems to relate to the
tsconfig.json
path definition. How did you import your Enum? In my case I could solve the issue by importing the file, without using the shorted path.import {Role} from '@shared/models';
➡️import {Role} from '../shared/models';
)This issue has been automatically closed because it has not had recent activity. Please file a new issue if you are encountering a similar or related problem. Thank you for your contributions.