If I write the following piece of code and transpile it through Babel (6.5.0) it works correctly.
function foo (first: string, second: number) {
// code here
}
: string
and : number
are just removed from the transpiled ES5 code.
If I call the function using wrong parameter types, it does not result in any error/warning. They are informative even though do not have any functionality.
I cannot find proper information about ES6's parameter typing on internet. Is parameter typing even part of ES6?
EDIT: This question got answered in the comments below and I wrapped the official answer based on them.
syntax-flow
andtransform-flow-strip-types
plugins included inbabel-preset-react
make it so errors are not thrown when type annotations are encountered, but do not actually process them - for that, you need to use the Flow tool itself.