An example of Dependency Injecttion using a functional approach.
type LoggingTool = (a: any) => void
const simpleLog: LoggingTool = a => console.log(a)
const logInitialiser = (loggingTool: LoggingTool) => (a: any) => loggingTool(a)
// Set up our logging tool...
const log = logInitialiser(simpleLog)
// Now we can log
log('hello world')
// In production, we may swap out simpleLog for something more sophisticated - but we don't need to change our log statements.