[BUG] Got error when parsing spread operator in routes
See original GitHub issueOverview of the issue
Unhandled Rejection at: Promise {
<rejected> TypeError: Cannot read property 'forEach' of undefined
at /Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:993:32
at Array.forEach (<anonymous>)
at RouterParserUtil.cleanRoutesDefinitionWithImport (/Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:992:30)
at Dependencies.visitEnumDeclarationForRoutes (/Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:5153:67)
at /Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:5179:51
at Array.reduce (<anonymous>)
at Dependencies.getRouteIO (/Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:5177:41)
at parseNode (/Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:4729:36)
at /Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:4856:13
at visitNodes (/Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/node_modules/typescript/lib/typescript.js:12643:30) } reason: TypeError: Cannot read property 'forEach' of undefined
at /Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:993:32
at Array.forEach (<anonymous>)
at RouterParserUtil.cleanRoutesDefinitionWithImport (/Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:992:30)
at Dependencies.visitEnumDeclarationForRoutes (/Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:5153:67)
at /Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:5179:51
at Array.reduce (<anonymous>)
at Dependencies.getRouteIO (/Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:5177:41)
at parseNode (/Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:4729:36)
at /Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/dist/index-cli.js:4856:13
at visitNodes (/Users/townus/.nvm/versions/node/v8.9.1/lib/node_modules/@compodoc/compodoc/node_modules/typescript/lib/typescript.js:12643:30)
Operating System, Node.js, npm, compodoc version(s)
node.js v8.9.1 npm v5.5.1 compodoc v1.0.5
Angular configuration, a package.json
file in the root folder
Compodoc installed globally or locally ?
globally
Motivation for or Use Case
On app-routing.module.ts
file:
...
export const APP_ROUTES: Routes = [
{
path: '',
component: IntroPageComponent,
resolve: {
authorized: AccountAuthCheckResolver,
oauth: AccountOauthResolver
}
},
{
path: '404',
component: NotfoundPageComponent
},
{
path: 'account',
loadChildren: 'app/account/account-routing.module#AccountRoutingModule'
},
{
path: 'commerce',
loadChildren: 'app/commerce/commerce-routing.module#CommerceRoutingModule'
},
...COMMERCE_DESIGN_POPUP_ROUTES // Got error in here
];
I think I have an error when parsing array spread operator.
Reproduce the error
Related issues
Suggest a Fix
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Spread operator error in return value, parse error
When trying to directly return an item that contains the spread operator I get a parse error. If I assign it to an...
Read more >Angular Modules and NgModule - Complete Guide
Making modules more readable using the spread operator ... component directly that is not part of a module, we will get the following...
Read more >Bug listing with status RESOLVED with resolution TEST ...
Bug :233 - "Emacs segfaults when merged through the sandbox." status:RESOLVED resolution:TEST-REQUEST severity:critical · Bug:3888 - "yenta_socket module not ...
Read more >Function arguments - Manual - PHP
It is an error to pass a value as argument which is supposed to be passed by reference. Default argument values ¶. A...
Read more >Safari Technology Preview Release Notes - Apple Developer
Changed animation-* declarations in @keyframes to be a parse error (254468@main) ... If you see bugs or unexpected behavior with the interface of...
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
I need to handle this scenario during routes parsing. Keep in touch
@seokju-na I had the same issue while parsing spread operator
//before with error.
export const pagesRoutes: Routes = [...defaultRoute, ...monitorRoutes, ...selectedRoutes, ...configureRoutes, ...systemRoutes];
//converted above as below as workaround for now and error was gone.
export const pagesRoutes: Routes = []; pagesRoutes.concat(defaultRoute,monitorRoutes, selectedRoutes, configureRoutes, systemRoutes);
Could be useful to you as workaround until the issue is resolved.