So if I wrote a library in ts and someone called the built js directly it wouldn’t have any type checking would it?
This may not be a popular opinion for those coming from C or Java, but runtime type checks in JavaScript are usually an anti-pattern. If my function defines a contract that the caller violates by passing in null or undefined, then my function should raise an exception when it tries to access `undefined.xyz` or whatever. Otherwise, embrace the duck! If the function can work with what it was given, it should instead of trying to enforce some Java-esque type system at runtime using typeof or instanceof.
But be pragmatic. If there is some critical area of your app that absolutely must never ever throw, typecheck away (although this is JS after all, so it still may throw if it damn well pleases).
How do you know that it "can work" based purely on the name of the function?
> But be pragmatic
I am. I consider javascript a last-resort option, only really useful for adding minor enhancements client side. Beyond that, I don't use it.
JavaScript is no different from most other dynamic languages this way
This is exactly why I can't take javascript seriously for anything besides basic UI enhancements to a web page.
Use whatever tools work for you, but also don’t disparage or dismiss other tools because they have different strengths and weaknesses than what you know or appreciate. There is no need for proselytizing; these are just tools after all!
I like JavaScript and TypeScript because they have let me quickly build many great things and share them with people. I also subjectivity find writing in them to be enjoyable. I may always turn to a different language if it is more productive and enjoyable than js/ts for the task at hand.