Commit Graph

3 Commits

Author SHA1 Message Date
Andy Hanson
32212ee634 hystrixjs: Fix name and lint 2017-12-21 14:39:59 -08:00
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
Andy Hanson
354cec620d Move all packages to a types directory 2017-03-24 14:27:52 -07:00