This is the difference between build time (compilation time) and error checking at runtime. TypeScript helps you with checking build time. Providing a TypeScript definition file with your library will help users get meaningful compile-time errors when they misuse your lib.
If your lib is consumed by JavaScript directly, you will not have a built-in step to notify the user, and you will have to resort to runtime messages. If file size is not a problem, I would suggest throwing a meaningful error message:
function (check) {
if (check != "YES" && check != "NO")
throw new Error("Invalid Check Value: " + check);
...
}
If you are worried about file size, it might be best to just not work with invalid calls. Or have some reasonable default. It will depend on your situation.
"" , , .