typewiz icon indicating copy to clipboard operation
typewiz copied to clipboard

Runtime type checking

Open zoehneto opened this issue 6 years ago • 3 comments

I'm not sure whether this is out of scope for this project, but I think it would be interesting to collect passed types even in places where type information is already supplied in the source code and then check whether the typings in the source code are actually correct.

zoehneto avatar Mar 17 '18 16:03 zoehneto

Sounds like an interesting direction - especially when working with server-side API for which the types have been specified manually. I'm keeping this open in case someone wants to take a stab at it.

urish avatar Mar 17 '18 18:03 urish

What do we do in a case where the two don't match? Do we attempt to fix it, just emit a warning when running the fixes file? Emit a warning in runtime?

MadaraUchiha avatar Mar 17 '18 20:03 MadaraUchiha

I think for developer convenience it would be nice if conflicting / non assignable types were added as a union type. That way one can use ones favorite vcs tool to compare all type changes. As a stretch goal it would obviously also be nice fo have some logging output which shows the type observed and the corresponding call stack so one can determine where it came from and if perhaps the caller is passing the wrong type. That said, I'm not aure whether this can be achieved without deeply integrating into the respective browsers developer tools.

zoehneto avatar Mar 17 '18 21:03 zoehneto