What is the recommended approach today to dealing with TypeScript unwanted checks that pertain to use from JavaScript?
I have the following function:
function connect(config: string): void {
// Getting warning for the line that follows:
// typeof check is always false: 'config' always has type 'string'
if (typeof config !== 'string') {
throw new Error('Connection config must be a string');
}
// execute normally...
}
I am using WebStorm UI, which pops up such warnings in a few places. The warning is irrelevant, because the module is compiled into JavaScript, and distributed as such, so the verification is strictly for calls from JavaScript clients. But there can also be TypeScript clients, so I cannot just change the function parameter type to any in the declaration.
What is the modern and recommended approach to getting rid of such warnings? Preferably, not in a way that disables such checks completely.