question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeScript error

See original GitHub issue

🐛 Bug Report

It is clear that that are types for fastify-nextjs and from what I can tell the types look ok with a ‘next’ method being applied to fastify. The problem is that it is not being applied properly in my relatively simple application.

To Reproduce

Steps to reproduce the behavior:

import fastify, { RequestGenericInterface } from "fastify";
import fastifyNext from 'fastify-nextjs';

const app = fastify({ logger: true })
    .register(fastifyNext)
    .after(() => {
        fastify.next('/hello')
    });

Expected behavior

I expect there not to be a typescript error that says

Property 'next' does not exist on type '{ <Server extends Http2SecureServer, Request extends RawRequestDefaultExpression<Server> = RawRequestDefaultExpression<Server>, Reply extends RawReplyDefaultExpression<...> = RawReplyDefaultExpression<...>, Logger extends FastifyLoggerInstance = FastifyLoggerInstance>(opts: FastifyHttp2SecureOptions<...>): FastifyIn...'.ts(2339)

Your Environment

  • node version: 12
  • fastify version: >=2.0.0
  • os: Mac
  • ts-node

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Iamshankhadeepcommented, Apr 22, 2021

Yeah that’s true it was not a bug. Thanks for the help @KiraPC 🔥🔥

0reactions
climba03003commented, Apr 22, 2021

Closing for @KiraPC answer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Documentation - Understanding Errors - TypeScript
Whenever TypeScript finds an error, it tries to explain what went wrong in as much detail as possible. Because its type system is...
Read more >
Get a catch block error message with TypeScript - Kent C. Dodds
TypeScript forces you to acknowledge you can't know what was thrown making getting the error message a pain. Here's how you can manage...
Read more >
Error - JavaScript - MDN Web Docs - Mozilla
Error objects are thrown when runtime errors occur. The Error object can also be used as a base object for user-defined exceptions.
Read more >
Exception Handling - TypeScript Deep Dive - Gitbook
Creates an instance representing an error that occurs when a numeric variable or parameter is outside of its valid range.
Read more >
TypeScript errors and how to fix them
TypeScript errors and how to fix them. Common Errors. Below you find a list of common TypeScript errors along with the buggy code...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found