facebook / facebook/flow

Extending EventEmitter stops module class from checking

Open
#2,102 3 comments 0 reactions 0 assignees View on GitHub
declarations feature request
Dominant language
Rust
Stars
22.3k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

I have this declaration file for an [external module](https://github.com/node-hid/node-hid)

``` javascript

import {EventEmitter} from 'events';

declare module 'node-hid' {

declare type HIDDeviceDescription = {
vendorId: number;
productId: number;
path: string;
}

declare function devices(): Array;

declare class HID extends EventEmitter {
constructor(path: string): void;
write(buffer: Array): void;
pause(): void;
resume(): void;
close(): void;
}
}
```

And this is in my code

``` javascript
import * as HID from 'node-hid';

var device = new HID.HID("123");
device.foobar();
```

`device.foobar` should throw an error, but it doesn't. Removing `extends EventEmitter` fixes that, but then, I cannot use EventEmitter's functions.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.