So I am trying to use the Strapi type as shown here:
export default {
register({ strapi }: { strapi: Strapi }) {
const service = strapi.service('some uid');
},
bootstrap(/*{ strapi }*/) {},
};
But the ts compiler complains that the StrapiInterface does not have the property service, which doesn’t make any sense, because the code is running if the type is set to any first.
src/index.ts:27:34 - error TS2339: Property 'service' does not exist on type 'StrapiInterface'.
27 const service = strapi.service('api::data.cache');
This confuses me a bit especially after looking into the type definition and it literally extends the Strapi class defined in the Strapi.js file which clearly has the service member.
For some reason when the StrapiInterface extends the Strapi class, all super properties are getting lost and only the newly defined properties (‘query’ and ‘entityService’) are defined.
Any thoughts?