When it comes to checking if a class (or any other element) exists in the global scope, Javascript offers a convenient method:
typeof SomeUndeclaredOne === 'undefined'
However, this approach doesn't translate well into TypeScript as it triggers a compilation error:
error TS2304: Cannot find name 'SomeUndeclaredOne'
Hence, my inquiry is: what is the simplest way to determine the presence of a class in TypeScript? I am seeking a universal solution that functions not only in browsers but also in different environments (such as node.js or others lacking a global object) and is compatible with prevalent module systems like ESModules, CommonJS, etc.
I appreciate any guidance you can provide. Thank you in advance.