plopjs / plop

Consistency Made Simple
http://plopjs.com
MIT License
7.06k stars 277 forks source link

Way of extending ActionType to have type definition for action added with setActionType #422

Open JacopoPatroclo opened 5 months ago

JacopoPatroclo commented 5 months ago

Issue

Currently, when creating a new action type using the setActionType function, there's no direct provision to extend the ActionType type to include the new type and options type. It would be beneficial to add the ability to extend the ActionType type, simplifying the process for developers to share custom action types.

Proposal

It could be nice to have something like this:

declare module 'node-plop' {
   interface ActionType extends BaseActionType {
      type: 'your-type',
      someOption: string
   }
}

But of course, we need to make ActionType an interface and I'm not sure it's possible at this time. I would love to contribute to this enhancement. Let me know if it's something that makes sense to create.

If something is not clear I can extend my explanation with more examples.