facebook / facebook/flow

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

Aperta
#3,018 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Rust
Stelle
22.3k
Fork
1.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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)).

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.