It doesn't seem like he's using TS. Also the check if(!customerIdnumber) wouldn't work since customerIdnumber should also be valid if it is equal to 0.
I agree that something could probably be done elsewhere to avoid this long check. But without context, it seems like @_garybell
is a good solution!
I am Software Developer, currently interested in static type languages (TypeScript, Elm, ReScript) mostly in the frontend land, but working actively in Python also. I am available for mentoring.
It doesn't seem like he's using TS. Also the check
if(!customerIdnumber)
wouldn't work since customerIdnumber should also be valid if it is equal to 0.I agree that something could probably be done elsewhere to avoid this long check. But without context, it seems like @_garybell is a good solution!
I don't think there exists Id which is 0 but your point is correct and the proper check would !== null. That's the whole thing should be done here.
Also I only mentioned TS to describe what type has this variable. You don't need to use explicit types, you still have types.