1

Let's say I have the following basic CJS module:

module.exports = { foo: "bar" }

For which I've configured separately following TS typing:

declare const test: { foo: string };

export default test;

Having that when I try to import this typed module in TypeScript file, Intellisense works as expected:

TS intellisense

But when I try to require it in CJS module intellisense fails, as it suggests the .default property, on which then foo is suggested, which is not correct:

CJS intellisense

What I'm missing in TS setup to have intellisense in CJS working properly? Is it possible to make it right?

Mariusz Nowak
  • 32,050
  • 5
  • 35
  • 37

0 Answers0