aboutsummaryrefslogtreecommitdiff
path: root/packages/bun-types/tests/events.test-d.ts
blob: e68a77ce5256ab9d342551cdc451a15f1ec6014e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { EventEmitter } from "events";
import { expectType } from "tsd";

const e1 = new EventEmitter<{
  a: [string];
}>();

e1.on("a", arg => {
  expectType<string>(arg);
});
// @ts-expect-error
e1.on("qwer", _ => {});

const e2 = new EventEmitter();
e2.on("qwer", _ => {});
e2.on("asdf", arg => {
  expectType<any>(arg);
});