Open mhsdesign opened 2 years ago
i set up my project using higher-order functions for the dependencies similar to: https://medium.com/geekculture/dependency-injection-in-javascript-2d2e4ad9df49
// application/ports.ts export interface Logger { log(msg: string): void; } // application/fooFunction.ts interface Dependencies { logger: Logger; } export const makeFooFunction({ logger }: Dependencies ) = (foo: string) => { // foo bar logger.log("bung" + foo) }
i was wondering if this higher-order pattern could technically also be implemented / be used for di with this project (if yes maybe i can build it myself but idk)
(fx. by setting makeFooFunction.inject = ['logger'])
makeFooFunction.inject = ['logger']
uups sorry there is already https://github.com/nicojs/typed-inject#injectorinjectfunctionfn-injectablefunction
(i find this beeing to far down in the docs -> its not teasered like class di at the top)
i set up my project using higher-order functions for the dependencies similar to: https://medium.com/geekculture/dependency-injection-in-javascript-2d2e4ad9df49
i was wondering if this higher-order pattern could technically also be implemented / be used for di with this project (if yes maybe i can build it myself but idk)
(fx. by setting
makeFooFunction.inject = ['logger']
)