How can I extend some typescript types/interfaces in Strapi V5?

Hi, I want to add a ?format=json parameter to my API endpoints.

But Strapi is complaining that this parameter is not supported :

Object literal may only specify known properties, and ‘format’ does not exist in type ‘FindOneParams’.

I’ve attempted to extend the FindOneParams by creating a file index.d.ts at the root of the src folder (as seen in this issue Cannot extend the Strapi interface anymore · Issue #17365 · strapi/strapi · GitHub)
`
import ‘@strapi/strapi’;

declare module ‘@strapi/strapi’ {
// Extend the FindParams interface
export interface FindParams {
format?: string;
}

// Extend the FindOneParams interface
export interface FindOneParams {
format?: string;
}

// If you need to extend the query context
export interface CommonQueryOptions {
format?: string;
}
}
`

But it does not work. How could I achieve this ?
Thanks !

This topic has been created from a Discord post (1301725497541005342) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord