Skip to content

LoadChildrenCallback Typescript Error when arrow function specifier async #46697

@Delagen

Description

@Delagen

Which @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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions