.toSelf() command significance

What is the function of .toSelf() command in the following statement


[This is used in the theia’s frontend-module.ts file]

Hi @Abhay0294,

in short: The “symbol” (in this case a class constructor) customWidget can be bound to anything in theory. For example, you can bind it to a subclass of itself and still use it, as it if were the same class. Using toSelf() allows you to bind the customWidget symbol to the customWidget class, or in other words, to itself.

For a longer explanation, please see the InversifyJS docs. That’s the library we use for dependency injection.

1 Like