How To

Use Debug Module in TypeScript

debug library exports a function that decorates console.error with a custom module name.

Instead of writing:

import debug = require('debug')('custom-module-name');

in TypeScript, write:

import Debug from "debug";
const debug = Debug("custom-module-name");