cli-microsoft365 icon indicating copy to clipboard operation
cli-microsoft365 copied to clipboard

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

Open MartinM85 opened this issue 3 months ago • 2 comments

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.

MartinM85 avatar Oct 02 '25 06:10 MartinM85

I wonder if this isn't a temporary issue that we're having because we're in the middle of migration to Zod. In theory, when we migrate, we should have consistent types throughout, so with this I wonder if it's something we should spend time on now vs. wait until we finish the migration and revisit then.

waldekmastykarz avatar Nov 15 '25 09:11 waldekmastykarz

We can wait and revisit this issue after full migration to Zod.

MartinM85 avatar Nov 17 '25 09:11 MartinM85