Lots of Typescript errors - disappear after removing required: true

This is the expected registerComponent.d.ts in @plasmicapp/host 1.0.78, which contains providesData in ComponentMeta

It works sometimes

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

Similarly, this simple one fails due to require

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

is there any syntax errors there? The autocomplete suggests require is not expected…

require does not exist in the prop type, indeed

  PLASMIC?.registerComponent(Test, {
    name: "Test",
    props: {
      text: {
        type: "string",
      },
      metafieldPath: {
        type: "string",
      },
    },
  });

should work

Here is the API reference for component registration: https://docs.plasmic.app/learn/code-components-ref/

I’ve been using this for months, and I am finding out it doesn’t exist. Something is wonky here, otherwise I would’ve assumed Plasmic types would’ve choked sooner…

Let me investigate

@tiago Any chance yinz recently updated your types? I am all of a sudden not seeing any errors anymore (as I have been for many months), but also agree there is no require however we have had that in our plasmic-init for quite some time. Not sure why it is suddenly choking, however currently it is showing for one of our devs, and not for me. Very weird.

To clarify, I made the errors go away on my end by simply stepping back in our repo history, running yarn, and returning back to the HEAD

no file changes

Hey @shiny_peacock, I believe nothing changed in our end. If you take an old version of registerComponent to compare types (e.g. a diff between https://github.com/plasmicapp/plasmic/blob/34e690f99cc3eb425f97883468025aff02f7f7b4/packages/host/src/registerComponent.ts from January and master https://github.com/plasmicapp/plasmic/blob/master/packages/host/src/registerComponent.ts) there are only a few new parameters added, but nothing radically different. In particular, require never existed. Is it possible that Plasmic types were not being correctly checked in your repository previously?

It is possible, we are just gonna clean it up and hope for the best. Thank you for the help!

(It’s also possible this is due to some annoying package version issue - I think I’ve run into similar before, due to something unexpected in my lockfile)