I’m registering custom graphql operations using register function and get typescript error.
const extensionService = strapi.service("plugin::graphql.extension");
extensionService.use(createPageWithAllLocales);
then function createPageWithAllLocales makes actions like:
const mainEntry = await strapi.entityService.create(modelUid, {
data: {
...data,
localizations,
},
populate: {
localizations: {
select: ["id"],
},
},
});
strapi is global and has type Strapi, but seems it is incomplete, because for the property select it shows an error:
Type '{ localizations: { select: string[]; }; }' is not assignable to type 'Any<CollectionTypes.pages>'.
Types of property 'localizations' are incompatible.
Type '{ select: string[]; }' is not assignable to type 'boolean | NestedParams<"api::page.page">'.
Object literal may only specify known properties, and 'select' does not exist in type 'NestedParams<"api::page.page">'.ts(2322)
index.d.ts(64, 13): The expected type comes from property 'populate' which is declared here on type '{ fields?: Any<CollectionTypes.pages>; } & { populate?: Any<CollectionTypes.pages>; } & { data?: Input<CollectionTypes.pages>; } & { ...; }'
What am I doing wrong?
Environment: development
OS: darwin-x64
Strapi Version: 4.15.0
Node/Yarn Version: yarn/1.22.19 npm/? node/v18.12.1 darwin x64
Edition: Community
Database: sqlite