Functional IoC using JS function context
#functional
#solid
Following-up on function-resolve and mvc-functional-oop, I've embraced the this keyword and JavaScript's built in context management to achieve typed functional dependency injection with less boilerplate and dependencies
const helloWorld = usecase(
{ greet, hello },
function () {
this.hello('World')
this.greet('Earth')
}
)
class CalculateWithMultiply extends DependencyClass({
...Calculate.dependencies,
...Multiply.dependencies,
run: async () => (await import('./multiply')).multiply,
}) {}