codemix / babel-plugin-typecheck

Static and runtime type checking for JavaScript in the form of a Babel plugin.
MIT License
886 stars 44 forks source link

More specific errors #137

Closed tgriesser closed 7 years ago

tgriesser commented 8 years ago

Thanks for the library!

I'd really like to see a way to know what specific missing or invalid property triggers an error, and the object it occurred on. If you have an array of typed objects, or a lot of properties on an object, and a key on one of those objects missing, the generic error isn't super helpful or obvious:

screen shot 2016-03-22 at 10 27 02 pm

(this goes on for several hundred lines)

I'd rather see the type signature of just the failing object, and then the actual value of object which caused it to fail. If this is something you'd consider adding, I'd be willing to take a shot at implementing.

phpnode commented 8 years ago

I'm very interested in adding support for this but it will require quite a refactoring

phpnode commented 7 years ago

Hi sorry for the delay, this project is now deprecated in favour of flow-runtime which aims for full flow compatibility. flow-runtime has much better error messages and will tell you precisely which properties fail and why.