2023-02-21 21:21:56 +03:00
|
|
|
diff --git a/cjs/container-instance.class.js b/cjs/container-instance.class.js
|
2023-05-26 19:03:06 +03:00
|
|
|
index e473b1e652aa0b6e7462f7ba93fcef2812483b20..1e406113d68c401ee170c997afb53e5f71edeee2 100644
|
2023-02-21 21:21:56 +03:00
|
|
|
--- a/cjs/container-instance.class.js
|
|
|
|
+++ b/cjs/container-instance.class.js
|
2023-05-26 19:03:06 +03:00
|
|
|
@@ -209,6 +209,7 @@ class ContainerInstance {
|
|
|
|
// this allows us to support javascript where we don't have decorators and emitted metadata about dependencies
|
|
|
|
// need to be injected, and user can use provided container to get instances he needs
|
|
|
|
params.push(this);
|
|
|
|
+ if (process.env.NODE_ENV === 'production') Object.freeze(constructableTargetType.prototype);
|
|
|
|
value = new constructableTargetType(...params);
|
|
|
|
// TODO: Calling this here, leads to infinite loop, because @Inject decorator registerds a handler
|
|
|
|
// TODO: which calls Container.get, which will check if the requested type has a value set and if not
|
|
|
|
@@ -234,6 +235,7 @@ class ContainerInstance {
|
2023-02-21 21:21:56 +03:00
|
|
|
*/
|
|
|
|
initializeParams(target, paramTypes) {
|
|
|
|
return paramTypes.map((paramType, index) => {
|
|
|
|
+ if (paramType === undefined) throw new ReferenceError('Cannot inject an `undefined` dependency. Possibly a circular dependency detected');
|
|
|
|
const paramHandler = container_class_1.Container.handlers.find(handler => {
|
|
|
|
/**
|
|
|
|
* @Inject()-ed values are stored as parameter handlers and they reference their target
|