The deeper problem is that JS is not strongly typed. Typescript gives you static type checks but the runtime is still weakly typed and will still do all sorts of weird type conversions.
dynamic typing, strong typing: python (for the most part), Scheme
dynamic typing, weak typing: Javascript, PHP
static typing, strong typing: Pascal, Ada, Java, C#
static typing, weak typing: C, Typescript, perhaps others
SPECIAL CASES:
strongly typed, dynamically typed, but with some compilers it can also be statically typed: Common Lisp
strongly typed, statically typed but can infer types: Haskell, ML family
strongly typed, can infer type with "auto" keyword: C++ (latest version)
non-typed: Machine language, assembler, perhaps Forth