lint - Is there a JavaScript technique to check for type equality in >,<,>=,<= operations? -


if have if(object.keys(obj) < 2) have bug might slip past tests if don't test objects property counts below , at/above 2. i.e. should have .length.

if linter check type on either side of <,>,<=,>= warn this.

alternatively, how else catch this? know more high quality tests catch this. problem never know when have enough high quality tests. if linter or other tool had ability warn of types in situation automatically caught.

there no conclusive way check type equality in linter without running code because code can sorts of things , linter can't know might present in variable when used in comparison. consequence of using language such javascript not require strict typing.

there variants of javascript such typescript (that can compiled javascript) offer more capabilities in regard.


Popular posts from this blog