2

I am using typescript in node js, and I have a module without any @types npm package bad words

I tried to create a myModule.d.ts but I do not exactly know what to add inside.

so I import the module

import Filter from 'bad-words';

I did

const filter = new Filter({ placeHolder: '*'});

but I get

Cannot use 'new' with an expression whose type lacks a call or construct signature

Because my d.ts is wrong (if I do not declare d.ts and use implicitany , it works)

my d.ts is like this

declare module 'bad-words'{
    class Filter{    
    }
}
Nipun Tharuksha
  • 2,496
  • 4
  • 17
  • 40
YoloSwaggg
  • 71
  • 1
  • 7

0 Answers0