Plugin Prop Validation & Improvements #201
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
One line summary
Add plugin props validation for better error handling and clearer error messages.
Description
This PR addresses issues related to plugin props in our codebase. The motivation behind these changes is to improve error handling and provide clearer error messages for developers working with our code.
Previously, the property "mode" was required in the plugin props, but there was no validation in place to check if it was provided. This led to runtime errors in Node.js when attempting to access the optional prop "smallIcons" when the props object was undefined. This situation was confusing for developers who were setting up the plugin array for the first time without specifying a props object. To mitigate this, we have added validation to ensure that the "mode" property is always provided, resulting in a much clearer error message when it's missing.
Additionally, we have extended the validation to cover cases where users provide props of the wrong type or provide props that do not match the model's requirements. This enhancement will help prevent unexpected issues and make debugging easier.
Lastly, we have updated the type definition to correctly indicate that "devTeam" and "iPhoneDeploymentTarget" are optional properties, aligning our code with their actual usage.
These changes collectively improve the robustness of our codebase and enhance the developer experience by providing informative error messages and more accurate type definitions.