That is, did you remember to check for null? Did you remember to write a test for floating points in languages that just have generic number types?
I don't see the value in relying on unit tests to enforce types.
It might be possible, but it relies on the programmer to:
1. Remember all of the types (was this an int? Or a float? Or a int | null union?
2. Implement exhaustive tests for each type
3. Remember to update the tests when something changes.
4. When reading code, if the types emitted are not specified, having to examine the unit tests to determine the type limits.
And the advantage of this is that it saves me a few keystrokes so i can write:
X = 5
Instead of
int X = 5