Validates an option value based on its type and throws an error if the value is invalid.
The option value to validate.
The name of the option.
The expected type of the option.
Throws an error if the option value is invalid.
Validates an option value based on its type and throws an error if the value is invalid.