deno_gi
deno_gi copied to clipboard
Add property typechecks
When setting a property on an object, the bindings assume the correct type was passed. For example, when setting an uint8 property, the bindings assume that a comparable number was given.
It would be better to check the values given before setting properties. Here are some ways this can improve UX and help reduce programmer errors:
- Emit a warning when a high number value is set for a uint8 (maybe the integer is out of range, or a boolean was passed)
- Warn when a floating type was converted to an integer
- Don't allow setting integers to string properties and vice versa.
- Check if function parameters are correct, too.