Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript: Argument of type '{ data: { myComponent: any[]; }; }' is not assignable to parameter of type 'NuxtStrapiData'. #276

Open
Namstel opened this issue Aug 30, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Namstel
Copy link

Namstel commented Aug 30, 2022

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)[]'.
@Namstel Namstel added the bug Something isn't working label Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant