Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Can't use custom action in typescript plopfiles #439

Open
maverox opened this issue May 26, 2024 · 2 comments
Open

Bug: Can't use custom action in typescript plopfiles #439

maverox opened this issue May 26, 2024 · 2 comments

Comments

@maverox
Copy link

maverox commented May 26, 2024

In plopfile.ts whenever I try to use a plop-pack or a custom action, I get this error
Screenshot 2024-05-27 032653

Now I figured that Actions is of type ActionType[]
and ActionType is a union of various configs but when a custom type: "value" is found it narrows down to
ActionConfig which doesnt have that property and hence it throws this error

@awhitford
Copy link

I am experiencing this too. I have a custom action that needs a custom parameter command and I get this TypeScript error during compilation:

plop/plopfile.ts:186:11 - error ts(2353): Object literal may only specify known properties, and 'command' does not exist in type '((answers: PromptProps) => string) | { type: string; path: string; pattern: RegExp; template: string; }'.

@crutchcorn @cspotcode

@awhitford
Copy link

I see an example like this in the tests:

// use the custom action
plop.setGenerator("test", {
prompts: [],
actions: [
{
type: "doTheThing",
configProp: "available from the config param",
} as CustomActionConfig<"doTheThing">,
{
type: "doTheAsyncThing",
speed: "slow",
} as CustomActionConfig<"doTheAsyncThing">,
],
});

Alas, I can't import CustomActionConfig:

'"plop"' has no exported member named 'CustomActionConfig'. Did you mean 'ActionConfig'?ts(2724)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants