-
Notifications
You must be signed in to change notification settings - Fork 56
Inaccurate TypeScript types #194
Comments
Hey! Thanks for bringing this up. I believe both should be supported as you stated, is there any context we might be missing here? @crutchcorn |
Apologies for the delays, y'all! December was an extremely rough month on me and I took a bit of a break from some of my projects. Just took a look at the code changes in #196 and it all looks like fantastic changes - thanks so much @davidmwhynot ! I'll merge and publish in just a few hours (at most) |
I just want to reiterate that “The same issue presents itself in the The PR only fixes the “add” action. |
@jedmao would you be willing to open a PR for the other actions as well? |
I can’t, sorry. |
Does this need to return promise of a string?
|
I'm not super familiar with what is supported for the other actions besides the "add" action as my use-case for plop is pretty simple and only requires the use of "add" actions. |
@derekdon the return type you list looks correct to me. A CustomActionFunction can return a status |
This issue is being fixed (for all types, not just add), and with type tests to verify, in |
https://github.com/plopjs/plop/releases/tag/v3.0.0 These issues (for all action types) should now be solved as-of |
There are a number of inaccuracies in the TypeScript types that are throwing errors, even when the configuration is accurate. For example, If I wanted to add an append action like this:
This is an accurate
AddActionConfig
, but theAddActionConfig
interface declares that thetemplateFile
is a required property. Actually, either thetemplate
or thetemplateFile
is required, but not both at the same time. The way to properly type this is to create separate interfaces for each one of these scenarios, something like this:Now, I'm not 100% sure these are the actual requirements for these configurations, as the documentation doesn't really indicate the optionality of these properties, but I think you can see from my example how to properly define these scenarios.
The same issue presents itself in the
ModifyActionConfig
and potentially others.The text was updated successfully, but these errors were encountered: