Skip to content

TS Issues on routerOptions option? #1109

Open

Description

@dsolis

Hello guys,
I'm trying to use the newest version of fastify 5.5.x and trying to remove the warning:

The router options for ignoreTrailingSlash property access is deprecated. Please use "options.routerOptions" instead for accessing router options. The router options will be removed in `fastify@6`.

But when initializing the object with

routerOptions: {
    ignoreDuplicateSlashes: true,
    ignoreTrailingSlash: true,
}

the property is not found on the type FastifyServerOptions

Is this a bug with the new version?

Activity

  1. AkhileshDasari commented on Jul 23, 2026

    @AkhileshDasari

    I would like to contribute to this issue.

  2. metcoder95 commented on Jul 23, 2026

    @metcoder95
    Member

    Can you provide an Minimum Reproducible Example?

  3. AkhileshDasari commented on Jul 23, 2026

    @AkhileshDasari

    Hi @metcoder95,

    Here's a Minimum Reproducible Example:

    import Fastify from 'fastify';
    
    const fastify = Fastify({
      routerOptions: {
        ignoreTrailingSlash: true,
        ignoreDuplicateSlashes: true,
      }
    });
    
    fastify.get('/', async () => ({ hello: 'world' }));
    
    await fastify.listen({ port: 3000 });

    Error:
    Property 'routerOptions' does not exist on type 'FastifyServerOptions<...>'
    Even though the runtime supports it and the deprecation warning tells us to use routerOptions, the TypeScript definitions don't expose this property yet.
    I'm happy to contribute a fix for the TypeScript definitions if you can point me to the right files. Thanks!

  4. metcoder95 commented on Jul 24, 2026

    @metcoder95
    Member

    This has been fixed in latest fastify; can you try to upgrade to 5.10?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions