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

Missing types for the fastifyInstance.addresses() method #4523

Closed
2 tasks done
Baptiste-Garcin opened this issue Jan 20, 2023 · 1 comment
Closed
2 tasks done

Missing types for the fastifyInstance.addresses() method #4523

Baptiste-Garcin opened this issue Jan 20, 2023 · 1 comment
Labels
good first issue Good for newcomers typescript TypeScript related

Comments

@Baptiste-Garcin
Copy link
Contributor

Baptiste-Garcin commented Jan 20, 2023

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

4.1.0

Plugin version

No response

Node.js version

18.x

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

13.0

Description

The .addresses() server method is not present in the types for the fastify instance but this method is present in the documentation and in the instance.

Steps to Reproduce

Simply create a fastify instance and call .addresses()

import fastify from 'fastify';

const fastifyInstance = fastify();
const addresses = fastifyInstance.addresses();
//  Property 'addresses' does not exist on type 'FastifyInstance  & PromiseLike  >'.

The tsconfig.json I use:

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es5",
    "sourceMap": true
  },
  "exclude": [
    "node_modules"
  ]
}

Expected Behavior

The fastifyInstance.addresses() method should be in the FastifyInstance type.

@climba03003 climba03003 added good first issue Good for newcomers typescript TypeScript related labels Jan 20, 2023
Baptiste-Garcin added a commit to Baptiste-Garcin/fastify that referenced this issue Jan 20, 2023
Baptiste-Garcin added a commit to Baptiste-Garcin/fastify that referenced this issue Jan 20, 2023
@mcollina
Copy link
Member

Thanks for reporting! Would you like to send a Pull Request to address this issue? Remember to add unit tests.

mcollina pushed a commit that referenced this issue Jan 20, 2023
* #4523 Add types for fastifyInstance.addresses()

* #4523 Add type definition test in instance.test-d.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers typescript TypeScript related
Projects
None yet
Development

No branches or pull requests

3 participants