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

fix `func(param: string | null)` allow undefined #175

Closed bolasblack closed 7 years ago

bolasblack commented 7 years ago

Flowtype not allow ((param: string | null) => {})(undefined): https://flowtype.org/try/#0PQKgBAAgZgNg9gdzCYAoVAKDAHAhgJ1wFsAuMAZwBd8BLAOwHMwAfMOgVxhgEowBeAHxgA3gF9uGdnQAmAUyj1Z07kA

I found typecheck will check the type like: typeof param === 'string' || param == null

But the test file seems intricate, I have no idea about how to add a new test...

phpnode commented 7 years ago

@bolasblack sorry about the delay getting back to you, thanks for this but I've decided to deprecate this repo in favour of https://codemix.github.io/flow-runtime/

I checked and this bug doesn't occur with babel-plugin-flow-runtime.