Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a description of the listen method to NestFastifyApplication #3786

Closed
grin0c opened this issue Jan 10, 2020 · 4 comments
Closed

Add a description of the listen method to NestFastifyApplication #3786

grin0c opened this issue Jan 10, 2020 · 4 comments

Comments

@grin0c
Copy link
Contributor

grin0c commented Jan 10, 2020

Feature Request

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

I want to handle the fastify error when starting the app.

await app.listen(port, host, (err: Error) => {
    if (err) {
      logger.error(err)
      process.exit(1)
    }

    logger.info(`Application is listening on port ${host}:${port}.`, 'Main')
  })

If you write this now, typescript throws an error, so in INestApplication, the listen method is defined like this:

listen(port: number | string, callback?: () => void): Promise<any>;
listen(port: number | string, hostname: string, callback?: () => void): Promise<any>;

I suggest taking the annotation from https://github.com/fastify/fastify/blob/master/fastify.d.ts#L529-L537 and adding it to NestFastifyApplication

Teachability, Documentation, Adoption, Migration Strategy

What is the motivation / use case for changing the behavior?

@grin0c grin0c added needs triage This issue has not been looked into type: enhancement 🐺 labels Jan 10, 2020
@kamilmysliwiec
Copy link
Member

Looks good. Would you like to create a PR for this?

@kamilmysliwiec kamilmysliwiec added scope: platform and removed needs triage This issue has not been looked into labels Jan 10, 2020
@grin0c
Copy link
Contributor Author

grin0c commented Jan 10, 2020

I will do

@kamilmysliwiec
Copy link
Member

Fixed in 6.11.0

@lock
Copy link

lock bot commented Apr 25, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 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

2 participants