facebook / facebook/flow

Possible to create type declarations for extended methods? (i.e., chai plugins)

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

Description

Does anyone know if it's possible to create flow declarations for chai plugins?

For example, the `chai-as-promised` plugin adds methods like `.rejectedWith(error)` to `chai.expect()`, so you could use it like this:
`expect(myPromise).to.be.rejectedWith('some error message')`

So in this case, I'd be looking to add a definition for `rejectedWith` to the return type of chai's `expect` function (BTW, chai itself does have [flow-typed declarations](https://github.com/flowtype/flow-typed/tree/master/definitions/npm/chai_v3.5.x)).

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.