When attempting to utilize EventEmitter3, I am using the following syntax:
import EventEmitter from 'eventemitter3'
The module is installed in the ./node_modules
directory. It contains an index.d.ts
file, so it should be recognized by Typescript. However, I encounter the error message:
[ts] Cannot find module 'eventemitter3'.
I have attempted to add ./node_modules
to the included types in my tsconfig.json
without success:
{
"compilerOptions": {
"typeRoots": ["./node_modules", "./node_modules/@types"]
}
}
What is the correct way to configure Typescript to locate node modules?