Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

typescript errors on angular@10 with @nguniversal/express-engine@10 #1744

Closed
amitport opened this issue Jun 26, 2020 · 5 comments
Closed

typescript errors on angular@10 with @nguniversal/express-engine@10 #1744

amitport opened this issue Jun 26, 2020 · 5 comments

Comments

@amitport
Copy link
Contributor

following the initial installation instruction in angular.io (ng add):

ERROR in server.ts:18:25 - error TS2345: Argument of type '(filePath: string, options: Readonly<RenderOptions>, callback: (err?: Error | null | undefined, html?: string | undefined) =
> void) => void' is not assignable to parameter of type '(path: string, options: object, callback: (e: any, rendered?: string | undefined) => void) => void'.
  Types of parameters 'options' and 'options' are incompatible.
    Type '{}' is missing the following properties from type 'Readonly<RenderOptions>': req, bootstrap

18   server.engine('html', ngExpressEngine({
                           ~~~~~~~~~~~~~~~~~
19     bootstrap: AppServerModule,
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20   }));
   ~~~~
server.ts:37:3 - error TS2322: Type 'Express' is not assignable to type 'void'.

37   return server;
     ~~~~~~~~~~~~~~
server.ts:45:10 - error TS2339: Property 'listen' does not exist on type 'void'.

45   server.listen(port, () => {
@fgravin
Copy link

fgravin commented Jun 29, 2020

Hi, how to use the fix while waiting for a new release ?
Thanks

@amitport
Copy link
Contributor Author

@fgravin you can build the lib yourself but it's not worth the effort IMO.
I just use ts-ignore for now

@saranglohar
Copy link

I fixed it by removing return type void given to the app() method in server.ts.

@amitport
Copy link
Contributor Author

amitport commented Jul 5, 2020

@saranglohar this should be fixed. If you had an issue with @nguniversal/express-engine@10.0.1 you should open a new github issue with the full details

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants