I am using the TypeScript configuration for Strapi and trying to type the Context object (ctx) in my controller handlers. The docs feature no example of typing it and there’s nothing online about it either. In JS, the ctx object features intellisense because it says it’s typed as “Application.Context” but I can’t find that namespace anywhere.
interface StrapiContext {
// Declare any additional properties or methods you want to add to the Context object.
// For example, if you have a custom service in your Strapi API, you can add its type here.
myCustomService: MyCustomService;
}
Hey @huylv177, that is true, they definetely support it. I think I expressed what I wanted badly on the previous comment, thanks for clearing that out!
I just felt like Strapi should be exporting all the types related to the variables of Strapi, but that does not happen for the Context, for example. But the solution provided here works well to type the Context