I am currently developing a TypeScript library that needs to be compatible with all versions of JavaScript. I have noticed that when calling a class in TS without using new
, it does not compile properly, which is expected.
In ES6/Babel, a class automatically includes the _classCallCheck
function to verify that it has been called with new
at runtime.
Is there a similar functionality or flag in TypeScript that can be used to implement this check? While this feature may not be necessary when using the library in TypeScript, it will be important for ensuring proper usage when implemented in JavaScript.