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:
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:
What I'm missing in TS setup to have intellisense in CJS working properly? Is it possible to make it right?