Suppose, I am writing a library with Typescript. There is a function with following signature-
function check(value: "YES"|"NO"): boolean
So, when this function is called from other typescript files with values other than "YES" or "NO", there will be a compilation error. But if called from a Javascript file, there will be no error, as Javascript do not has the type information. I can check for invalid values inside my function and throw errors. But then the type safety provided by Typescript seems only an illusion to me.
What should I do in this case as a library developer? Go with pure javascript? What did the teams like Angular do?