How can I effectively use the require
function in typescript with standard NPM modules? I am currently attempting to utilize the debug
package.
I have installed it from npm and also ran tsd install debug
. However, I am facing issues where the syntax works fine in one file but not in another. My assumption is that this is related to the load order, possibly causing TypeScript to mistake variable redeclaration?
let debug = require("debug")("async-test");
# ReferenceError: debug is not defined
debug = require("debug")("async-test");
# ReferenceError: debug is not defined
The code appears identical on both left and right panels (in different files), yet one might display an error while the other does not.