When running the compiled JS in the presence of a frozen Function.prototype, this module throws on initialization Cannot assign to read only property 'constructor' of object. This is because the TypeScript compiler, when targeting ES5, uses property assignment to replace the prototype.constructor.
The motivation for freezing all of the shared intrinsic objects is that, in conjunction with compartmentalization of third-party dependencies, it is possible to mitigate some classes of supply chain attack. https://github.com/endojs/endo/tree/master/packages/ses#secure-ecmascript-ses
This can be solved with a change and possibly an upgrade to the TypeScript compiler, if they are amenable to the change. microsoft/TypeScript#43450
This can alternately be solved by either
- moving the language target up to ES2015 (which is technically a breaking change), patching after-the-build (messy),
- or creating a secondary build target for ESM and multiplexing package.json with a
module property (for RESM https://github.com/standard-things/esm) and an imports property (for Node.js 12+).
When running the compiled JS in the presence of a frozen
Function.prototype, this module throws on initializationCannot assign to read only property 'constructor' of object. This is because the TypeScript compiler, when targeting ES5, uses property assignment to replace theprototype.constructor.The motivation for freezing all of the shared intrinsic objects is that, in conjunction with compartmentalization of third-party dependencies, it is possible to mitigate some classes of supply chain attack. https://github.com/endojs/endo/tree/master/packages/ses#secure-ecmascript-ses
This can be solved with a change and possibly an upgrade to the TypeScript compiler, if they are amenable to the change. microsoft/TypeScript#43450
This can alternately be solved by either
moduleproperty (for RESM https://github.com/standard-things/esm) and animportsproperty (for Node.js 12+).