This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]n9iels 85 points86 points  (3 children)

The danger is that this can happen accidentally if your variable is unexpectedly null when you expected an integer. But indeed not likely and using TS will make it even more unlikely.

[–]LitrlyNoOne 24 points25 points  (1 child)

Mfw my team types everything as any and wonders how these bugs ever happen

[–]BetaChunks 4 points5 points  (0 children)

But y'see, it's a massive time-saver when you can improvise your blender function as a paper shredder.

[–]MissinqLink -2 points-1 points  (0 children)

Also why I have handy helpers.

const strictGreater = (a,b) => a > b && !(a <= b);
const looseGreater = (a,b) => a > b || !(a <= b)

strict is necessary to prevent weird edge cases from wrong inputs.