Problem
When working with services, you might define your own signatures for functions, which currently is not used or type checked.
For example if I use:
const result = strapi.plugin(pluginId).serice('myService').findOne(1)
I would like findOne to type check that it's parameter should be an id.
I would also like that result would have the type that my function returns.
Possible solution
The idea is that you could provide the plugins/services/controllers as a generic to the IStrapi interface. It would maybe look something like this in practice
import myService from './services/myService'
type MyStrapi = IStrapi<{
plugins: {
myPlugin: {
services: {
myService: typeof myService
}
}
}
}>
We could also provide more types to populate even more types
Problem
When working with services, you might define your own signatures for functions, which currently is not used or type checked.
For example if I use:
I would like
findOneto type check that it's parameter should be an id.I would also like that result would have the type that my function returns.
Possible solution
The idea is that you could provide the plugins/services/controllers as a generic to the
IStrapiinterface. It would maybe look something like this in practiceWe could also provide more types to populate even more types