Lots of Typescript errors - disappear after removing required: true

Getting lots of type errors and not sure why. If I remove required: true from the slots it works, however other things seem wrong like providesData not working.

Anyone seen this and solved it?

Is there a chance the types changed?

Screen Shot 2022-09-06 at 9.07.25 AM.png

Screen Shot 2022-09-06 at 9.08.02 AM.png

Builds seem to be working on the server side, so not sure if there is something wonky client side for me. Restarting my TS server didn’t fix it :disappointed:

Hey @shiny_peacock, what version of @plasmicapp/* packages are you using?

    "@plasmicapp/loader-nextjs": "^1.0.142",

are those old numbers? @tiago

Yeah :grimacing: Can you upgrade to latest? (1.0.182)

1.0.142 did not support things like providesData

:face_with_raised_eyebrow: what the…

PLASMIC?.registerComponent(PCPProductCatalog, {
  name: 'PCPProductCatalog',
  providesData: true,
  props: {
    catalogHeading: {
      type: 'slot',
      required: true,
      allowedComponents: ['PCPCatalogHeading'],
      defaultValue: [
        {
          type: 'component',
          name: 'PCPCatalogHeading',
          props: {},
        },
      ],
    },
    productGrid: {
      type: 'slot',
      required: true,
      allowedComponents: ['PCPProductGrid'],
      defaultValue: [
        {
          type: 'component',
          name: 'PCPProductGrid',
          props: {},
        },
      ],
    },
  },
})

@tiago still getting type errors here

on providesData

Hmmm, what type error are you getting?

No overload matches this call.
  Overload 2 of 2, '(component: ({ className, catalogHeading, productGrid, }: { className?: string | undefined; catalogHeading: Element; productGrid: Element; }) => Element | null, name: ComponentLookupSpec): void | undefined', gave the following error.
    Argument of type '{ name: string; providesData: boolean; props: { catalogHeading: { type: string; required: boolean; allowedComponents: string[]; defaultValue: { type: string; name: string; props: {}; }[]; }; productGrid: { ...; }; }; }' is not assignable to parameter of type 'ComponentLookupSpec'.
      Object literal may only specify known properties, and 'providesData' does not exist in type '{ name: string; projectId?: string | undefined; isCode?: boolean | undefined; }'.ts(2

This is also erroring until I remove required: true

PLASMIC?.registerComponent(PDPAddToCartRegion, {
  name: 'PDPAddToCartRegion',
  props: {
    addToCartButton: {
      type: 'slot',
      required: true,
      isRepeated: false,
      allowedComponents: ['AddToCartButton'],
      defaultValue: {
        type: 'component',
        name: 'AddToCartButton',
        props: {},
      },
    },
  },
}) 

Can you check which version is in node_modules/@plasmicapp/host/package.json?

Screen Shot 2022-09-06 at 10.10.37 AM.png

1.0.78 it seems

Weird. That is latest, so providesData should work. Can you try re-starting your IDE?

i did that, gonna try my whole computer to be safe lol

You can also ctrl+click registerComponent to see the type it is expecting