LoadChildrenCallback Typescript Error when arrow function specifier async
See original GitHub issueWhich @angular/* package(s) are the source of the bug?
router
Is this a regression?
Yes
Description
Type '() => Promise<Type<any> | Routes | NgModuleFactory<any> | Observable<Type<any> | Routes> | typeof LoginRouting>' is not assignable to type 'LoadChildrenCallback'.
Type 'Promise<Type<any> | Routes | NgModuleFactory<any> | Observable<Type<any> | Routes> | typeof LoginRouting>' is not assignable to type 'Type<any> | Routes | NgModuleFactory<any> | Observable<Type<any> | Routes> | Promise<Type<any> | Routes | NgModuleFactory<...>>'.
Type 'Promise<Type<any> | Routes | NgModuleFactory<any> | Observable<Type<any> | Routes> | typeof LoginRouting>' is not assignable to type 'Promise<Type<any> | Routes | NgModuleFactory<any>>'.
Type 'Type<any> | Routes | NgModuleFactory<any> | Observable<Type<any> | Routes> | typeof LoginRouting' is not assignable to type 'Type<any> | Routes | NgModuleFactory<any>'.
Type 'Observable<Type<any> | Routes>' is not assignable to type 'Type<any> | Routes | NgModuleFactory<any>'.
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
loadChildren: async () => import('./path/to/module')
.then(mod => mod.NgModule)
Please provide the environment you discovered this bug in (run ng version
)
AngularCli: 14.0.x
Anything else?
Worked fine till 14 version
Issue Analytics
- State:
- Created a year ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
LoadChildrenCallback - Angular
A function that is called to resolve a collection of lazy-loaded routes. Must be an arrow function of the following form: () =>...
Read more >Syntax error for Typescript arrow functions with generics
In this example, I put <Lecture> in front of the arrow function - so there is no error in the implementation, but now...
Read more >Deeply Understanding JavaScript Async and Await with ...
Using await in any other case is a syntax error. ... In the case of arrow function, async is put after the =...
Read more >What is Arrow Functions and how to use ... - iTech Empires
First Let's see how we can declare function in javascript and then will see arrow function next. var test = function(message) { console.log(message);...
Read more >ES6 arrow functions, syntax and lexical scoping
ES2015 (ES6) introduces a really nice feature that punches above its weight in terms of simplicity to integrate versus time saving and ...
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
@Delagen If using the
async
modifier, the shorter version also doesn’t show the error.This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.