Yes, #TypeScript should solve these ambiguities of #JavaScript.
To prevent unintended behaviour like this I have the https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/docs/rules/strict-boolean-expressions.md eslint rule enabled, which will detect this and one needs to explicitly test for undefined or 0. https://twitter.com/boennemann/status/1275855456360153089