Having trouble using a library installed in node_modules/
within a typescript app? Here's a quick hack for you. Create a folder named after the module in typings/modules
and add an index.d.ts
file inside with the following content:
declare module "lib-name" {
export default class Logger {
constructor(namespace: string)
}
}
You should now be able to import the module. However, if you encounter an error like
cannot use 'with' an expression whose type lacks a call or construct signature
when trying to let l = new Lib('namespace');
, then there might be a syntax issue that needs addressing.