TypeScript copy pastes

Posted

Function with a return type of a given parameter’s function return type

function execute<T>(fn: () => T): ReturnType<typeof fn> {
  // ...  
  return fn()
}

Yay for IntelliSense

Bunyan Global Logger

Insert into, or import from entry-point

declare global {
  var logger: bunyan
}

import * as bunyan from 'bunyan'
globalThis.logger = bunyan.createLogger({
  name: "LOGGER"
})

More posts

Inline Microphone Preamps

Boosting the gain of microphones with inline preamps

Posted

Eartec Dummy Battery

Externally powering some Eartec UltraLITE / UltraPAK units

Posted