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

Fixes for variables, object type, new tests #26

Closed fixplz closed 9 years ago

fixplz commented 9 years ago

Fixed some mistakes I made with variables.

Changed Object annotation to error for null (Flow does this).

Added some failing tests.

fixplz commented 9 years ago

@phpnode Do you want to merge this? I'm not going to fix the errors now. Here is the error list https://travis-ci.org/codemix/babel-plugin-typecheck/jobs/85705961

fixplz commented 9 years ago

I removed the try/catch in the traverse call so it shows error locations inside functions (like when augmenting variables). Is that ok? Maybe there's a better way to distinguish which errors should appear at the function node.

phpnode commented 9 years ago

@fixplz added a few notes, I think we should revert a couple of things in the last PR. As a rule I want this plugin to be complementary to flow, so if flow supports something that we don't, then we should do the best job we can under the circumstances, but not prevent the programmer from using those constructs. Flow covers things that we cannot, and we cover things that flow doesn't support yet, so they can work well together provided that they don't step on each other's toes.

fixplz commented 9 years ago

@phpnode just rebased

phpnode commented 9 years ago

@fixplz ah I just merged #33 which incorporates your original commits

fixplz commented 9 years ago

Consider reversing it, this PR will be cleaner.

phpnode commented 9 years ago

@fixplz I'm not a huge fan of rebase for reasons like this, I'd rather leave the history intact even if it's messy.

fixplz commented 9 years ago

@phpnode Ok. I will follow up about the issue of throwing errors for things like type parameters.