As a Roblox developer, it is currently very annoying to do runtime typechecking.
Most developers either do one of two things:
- Use if statements and error (or use assert) if a
typeofcall doesn’t match what we expect - Use a runtime type checking library like t (GitHub - osyrisrblx/t: A Runtime Typechecker for Roblox)
In Luau, we have a well-established way to define types. It would be nice if there was a way to re-use those types during runtime type-checking (e.g. with a special function that takes in a variable and a Luau type definition), instead of having to manually re-define our types every time we wanted to do runtime type checking.