Using JS Target Output in CommonJS Typescript

Configure your .hxml as follows:

-D js-es=6
path.to.MyClass
-js myclass.js

Unchanged output emitted by the build will look like this:

// Generated by Haxe 4.3.0
(function ($hx_exports, $global) { "use strict";
$hx_exports["build"] = $hx_exports["build"] || {};
$hx_exports["build"]["scripts"] = $hx_exports["build"]["scripts"] || {};
var $estr = function() { return js_Boot.__string_rec(this,''); },$hxEnums = $hxEnums || {},$_;
class MyClass {
	
}
...
})(typeof exports != "undefined" ? exports : typeof window != "undefined" ? window : typeof self != "undefined" ? self : this, typeof window != "undefined" ? window : typeof global != "undefined" ? global : typeof self != "undefined" ? self : this);

Remove the wrapping function and add an export default statement:

class MyClass {
	
}
export default MyClass;

Then it can be referenced in Typescript:

import MyClass  from './myclass.js';

new MyClass();