pnp / pnp/cli-microsoft365

`initAction` method can be called with unexpected type after migration to Zod

Open
#6,965 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug needs peer review on hold
Dominant language
TypeScript
Stars
1.5k
Forks
413
Avg merge
5d 6h
Merged PRs (30d)
21

Description

When reviewing #6934, I've noticed that the commands like login or connection list are calling initAction method. The method expects that type of the args parameter is CommandArgs defined in Command.ts.

Once we migrated the login command to Zod we are calling the initAction with CommandArgs defined in specific command file.

This works well because both CommandArgs interfaces have the same properties, but over time it can lead to some issues. At least the debug and verbose options for Zod have default value false, the old ones are optional.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the CommandArgs definition and initAction in src/Command.ts with the command-specific definition and call in src/m365/commands/login.ts. Check the migrated command entry points for the same mismatch; done means initAction receives a consistent argument type without relying on matching interfaces or differing Zod defaults, and the TypeScript checks pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.