FeathersJS: Get work done faster with `feathers-hooks-commons` typings.

j2L4e
Feathers-plus
Published in
2 min readSep 13, 2018

Don’t crawl the docs, write the code!

Typings based intellisense in WebStorm

When you’re developing a FeathersJS application there’s no way around feathers-hooks-common. It’s a comprehensive collection of commonly used hooks (surprise!) and various utilities to aid you in creating your own hook functions. A lot of the provided hooks and functions are highly configureable, so, unfortunately, although the documentation is thorough you have to know your way around the package to work with it efficiently.

To help out both TypeScript and JavaScript users alike, a typings file for feathers-hooks-common was created and published with version 4.17 of the package.

Depending on your IDE you’ll now get some quick hints from the docs and links to the function’s full documentation.

Function documentation (WebStorm)

There’s also information on function parameters as you type …

Parameter documentation (WebStorm)

… and, of course, full type safety for TypeScript users.

Type mismatch error (WebStorm)

A little note on fastJoin and batch loaders

Batch loaders aren’t easy to wrap your head around, so they got a typings file, too. Yet to use batch loaders? They aid you in getting the number of database calls down to a minimum. Literally! So make sure to read up on them in the docs.

As always, feel free to join the Feathers Slack to join the discussion or just lurk around. If you run into any problems with feathers-hooks-common you’re more than welcome to create a pull request or open an issue on github.

--

--