Two things that I see as potential issues. First, you have turned the zero into a string when you use quotes
!= "0".. should just be
!= 0. Second, Typescript was invented because of this issue with javascript (apps script).. lol So to be absolutely sure you are using a zero and not a 'falsey' value, use two equal signs:
!== 0.
I think that is the main problem, you are returning a falsey value instead of an an actual zero. In javascript, "" and null, and 0, and NaN, and UNDEFINED, and "0" all are considered 'false'. The last one, as in your function, is considered not a number (NaN).