facebook / facebook/flow

Extending EventEmitter stops module class from checking

未关闭
#2,102 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
declarations feature request
主要语言
Rust
星标
22.3k
派生
1.9k
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。