strapi
strapi copied to clipboard
TypeScript: Argument of type '{ data: { myComponent: any[]; }; }' is not assignable to parameter of type 'NuxtStrapiData'.
Version
@nuxtjs/strapi: v0.3.6 nuxt: v2.15.8
Steps to reproduce
Consider this:
- You have collection type with a repeatable component inside.
- You wish to update the data inside the repeatable component.
A component object may look like this:
const myComponentObject = {
title: "A title",
description: "A description"
dateStart: "2022-01-01"
dateEnd: "2022-01-31"
}
The code may look like this:
await this.$strapi.update('my-collection-type', this.idOfCollectionTypeItem, {
data: { myRepeteableComponent: myComponentObjectsArray },
})
What is Expected?
I expect the object to be allowed by the type. Ignoring the error will still allow the data to be created/updated as expected.
What is actually happening?
It will give a TypeScript error:
Argument of type '{ data: { experience: any[]; }; }' is not assignable to parameter of type 'NuxtStrapiData'.
Types of property 'data' are incompatible.
Type '{ myRepeteableComponent: any[]; }' is not assignable to type 'string | number | boolean | (string | number | boolean)[] | undefined'.
Object literal may only specify known properties, and 'myRepeteableComponent' does not exist in type '(string | number | boolean)[]'.