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

Throw an error if duplicate property is present in the type declaration #116

Closed gajus closed 7 years ago

gajus commented 8 years ago

I think the following should throw an error, since you would never overwrite a property in the same type declaration:

type RetryConfigurationType = {
    retries: ?number,
    retries: ?number
};

Related: https://github.com/codemix/babel-plugin-typecheck/issues/115

phpnode commented 7 years ago

It seems that Flow itself does allow this but it's probably a bug. Nevertheless, with flow-runtime I don't want to choke on anything that Flow accepts so at most we could emit a warning here. I think it's easier to ignore this edge case, maybe your eslint plugin catches it?