Skip to content

feat(types): router option types #6282

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

dancastillo
Copy link
Member

Checklist

types for #5985

@github-actions github-actions bot added the typescript TypeScript related label Aug 9, 2025
Copy link
Member

@gurgunday gurgunday left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@jean-michelet
Copy link
Member

Because typing is used in two files, maybe we can export a type from fastify.d.ts:

export interface RouterOptions {
  allowUnsafeRegex?: boolean,
  buildPrettyMeta?: (route: { [k: string]: unknown, store: { [k: string]: unknown } }) => object,
  caseSensitive?: boolean,
  constraints?: {
    [name: string]: ConstraintStrategy<FindMyWayVersion<RawServer>, unknown>,
  },
  defaultRoute?: (req: FastifyRequest, res: FastifyReply) => void,
  ignoreDuplicateSlashes?: boolean,
  ignoreTrailingSlash?: boolean,
  maxParamLength?: number,
  onBadUrl?: (path: string, req: FastifyRequest, res: FastifyReply) => void,
  querystringParser?: (str: string) => { [key: string]: unknown },
  useSemicolonDelimiter?: boolean,
}

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina
Copy link
Member

The typescript tests are failing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
typescript TypeScript related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants