Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mitt can not work #27440

Closed
linbingquan opened this issue Dec 21, 2024 · 2 comments
Closed

mitt can not work #27440

linbingquan opened this issue Dec 21, 2024 · 2 comments
Labels
invalid what appeared to be an issue with Deno wasn't

Comments

@linbingquan
Copy link
Contributor

linbingquan commented Dec 21, 2024

vscode has an error with both code.

deno run mod.ts it can work

// mod.ts
import mitt from 'npm:mitt'

const emitter = mitt() // This expression is not callable. Type 'typeof import("file:///fakepath/deno/npm/registry.npmjs.org/mitt/3.0.1/index")' has no call signatures.
emitter.on('dev', () => console.log('dev'))
emitter.emit('dev')

deno bench bench.ts it can not work

// bench.ts
import mitt from 'npm:mitt'

Deno.bench({
    name: 'mitt',
    fn() {
        const emitter = mitt() // This expression is not callable. Type 'typeof import("file:///fakepath/deno/npm/registry.npmjs.org/mitt/3.0.1/index")' has no call signatures.
        emitter.on('dev', () => console.log('dev'))
        emitter.emit('dev')
    }
})
deno --version

deno 2.1.4 (stable, release, x86_64-pc-windows-msvc)
v8 13.0.245.12-rusty
typescript 5.6.2

vscode: 1.96.2

@dsherret dsherret added the invalid what appeared to be an issue with Deno wasn't label Dec 21, 2024
@dsherret
Copy link
Member

This also occurs with Node importing with ESM. It's a problem with the package. The types are wrong:

https://arethetypeswrong.github.io/?p=mitt%403.0.1

@dsherret
Copy link
Member

Follow the issue in the repo here: developit/mitt#191

@dsherret dsherret closed this as not planned Won't fix, can't repro, duplicate, stale Dec 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid what appeared to be an issue with Deno wasn't
Projects
None yet
Development

No branches or pull requests

2 participants