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

babel plugin rewire #111

Closed sakari closed 8 years ago

sakari commented 8 years ago

With rewire typecheck seems to get confused with type aliases. I had (beware, example code follows)

type Foo = { bar: string }
function foo(arg: Foo): Promise<Foo> {
}

And my jasmine tests failed due to typecheck erroring incorrectly because { bar: string } did not match Foo. After moving rewire to the front of the .babelrc plugin list the error disappeared. By introducing an artificial type error I get typecheck to error correctly so this seems to be a good workaround.

phpnode commented 8 years ago

@sakari the passPerPreset option in the latest babel seems to fix most of these issues. Leaving this open to remind me to add a note about it to the README.

sakari commented 8 years ago

ok. have to try it out. Thanks!