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");

Subscribe to My Newsletter

The latest programming-related news, articles and resources - sent to your inbox monthly. Unsubscribe anytime.