developit / developit/mitt

error TS2349: This expression is not callable when using "module": "NodeNext".

Open
#191 5 comments 4 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.9k
Forks
488
PR merge metrics
No merged PRs in 30d

Description

Using mitt in Typescript with `"moduleResolution": "NodeNext"` gives "error TS2349: This expression is not callable." error.

```
"mitt": "^3.0.1"
"typescript": "^5.3.3"
```

**tsconfig.json**
```json
{
"compilerOptions": {
"outDir": "dist",

"target": "ES2018",
"lib": ["ESNext", "DOM", "DOM.Iterable"],

/* Bundler mode */
"moduleResolution": "NodeNext",
"module": "NodeNext",
"resolveJsonModule": true,
"esModuleInterop": true,
"sourceMap": true,
"allowJs": true,

/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src"]
}
```

```ts
import mitt from 'mitt';
...
private readonly emitter = mitt();
```

**tsc --pretty --noEmit** output:
```shell
error TS2349: This expression is not callable.
Type 'typeof import("C:/code/project/node_modules/mitt/index")' has no call signatures.

28 private readonly emitter = mitt();
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.