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.
Prototype of stronger action, feedback and preset typings.
This revealed a couple of missing/incorrect properties in the presets.
This is written fully generic, intended to be possible to reusable for other modules.
At the same time as this typings change, refactoring has been done to break up the excessively long files
This is largely just a typings change, with a notable change being done for the callbacks for actions and feedbacks. The
options
objects have been changed to be a class, which provides some methods. This allows for modules to simplify at couple of scenarios:getPlainNumber('myprop')
allows for getting a number, and for verifying the property is a number. Internally it ensures it is typed as a number (parsing a string to number if necessary), returning the default for the property if it is undefined, and throwing an error if it isNaN
.getParsedNumber('myprop')
allows for parsing a string field, and converting the result to a number. This avoids needing to callparseVariablesInString
explicitly, as that is done inside the functions implementation.If this options class were adopted by
@companion-module/base
, it would allow for some better tracking of which properties are used by subscribe/unsubscribe, and would make supprorting button scoped variables simpler from the module side.Upgrade scripts have not been touched.