TS error on patching the ctx.query.filters on core controller

System Information
  • Strapi Version: 4.6.0
  • Operating System: osx
  • Database: pg
  • Node Version: 18
  • NPM Version: 8.19
  • Yarn Version: NA

I have this core controller:

export default factories.createCoreController('api::project.project',
  ({strapi}) => ({
    async find(ctx) {
      // error TS2322
      ctx.query.filters = {owner: 1} // will use ctx.state.user.ownerId later
      const {data, meta} = await super.find(ctx);
      return {data, meta}
    }
  })
);

and TS cries:

error TS2322: Type '{ owner: number; }' is not assignable to type 'string | string[]'. Object literal may only specify known properties, and 'owner' does not exist in type 'string[]'.

It works with @ts-ignore though. Is there any TS trick I am missing here, or is this a bug?


By the way, is this the best approach to do that API query filter? at the controller level?