We’re trying Plasmic, considering if it would be good to transfer our whole codebase to use the platform.
Our project is using TypeScript. We tried to import a complex component of our codebase, with complex-typed props, into Plasmic.
The complex types for the props were, in this case, union types of several options. One of them produced by using “keyof” into an array, and the other one was just hardcoded.
I was able to include them by using “choice” props, the first by intentionally exporting and using the original array, and the second one by copy-pasting and re-writing it as an array.
We wanted to know if there’s any way of re-using the TypeScript typings without having to re-write them using Plasmic’s type system. Not only for code re-usage but because some of them may be even more complex (like extracted from existing libraries or DOM APIs).
Hi! In the past we’ve had luck using something like react-docgen-typescript to parse the typing into some data structure, and then generating the registerComponent calls. But we don’t have an official solution at the moment…
Thank you! We’ll take it a look