DefinitelyTyped/types/hystrixjs
rcannon 01d17fcb39
[hystrixjs] Strengthen type hints
This adds type hints for builders, commands and their respective
callbacks functions out to seven arity, while leaving the nonspecific
versions for backwards compatibility. This allows
`commandFactory.getOrCreate()` to create fully type hinted callback
signatures, both for the builder and the command.

```js
const command = commandFactory.
  getOrCreate<ResponseType, Arg1Type, Arg2Type>();
```

I also replaced all references to `Q` with `PromiseLike`, and added the
missing `hystrix.promise.implementation` configuration option, which
allows changing the underlying promise implementation.

This allows things like:

```js
const Bluebird = require("bluebird");
HystrixConfig.init({
  "hystrix.promise.implementation": Bluebird
});
(command.execute() as Bluebird<any>).catch(() => true);
```

...although I couldn't figure out how to more elegantly express that
Bluebird type.

Also made the fallback signature match the implementation.
2017-11-10 23:29:21 -08:00
..
hystrixjs-tests.ts [hystrixjs] Strengthen type hints 2017-11-10 23:29:21 -08:00
index.d.ts [hystrixjs] Strengthen type hints 2017-11-10 23:29:21 -08:00
tsconfig.json [hystrixjs] Strengthen type hints 2017-11-10 23:29:21 -08:00
tslint.json Ensure every package has a tslint.json (#21009) 2017-10-25 11:13:50 -07:00