A library of common TypeScript types, custom type guards, and utility functions.
npm install @silvermine/toolbox
height="300"
src="https://raw.github.com/silvermine/toolbox/master/src/logo/toolbox.png"
alt="Tools such as a protractor, calculator, pencil, and a pen inside a shirt pocket."
>







A collection of common types, [type guards][type-guards], and utilities for our TypeScript
codebases.
We found that in many TypeScript projects we needed some of the same basic constructs,
e.g. an object that had string keys and string values. These types are easy enough to
define in each project (e.g. { [k: string]: string }), but then you might need a type
guard, too. And if you need a type guard, you need unit tests for that type guard. So, we
collect frequently-used types in this repo, and use this project in our other projects.
While we wanted to focus primarily on types, and we don't want this to become the "junk
drawer" of every tool we ever need, there was also the need for a few helper / utility
functions in our codebases. For example, in some codebases we don't want to use Underscore
or lodash because we only need one or two functions and can't afford the extra bloat of a
full-blown library comprised of mostly things we don't need; those functions will be
implemented in this toolbox. _This codebase is not a replacement for Underscore or
lodash_; it's primarily a collection of types and type guards, with a few additional
utilities sprinkled in.
More details about the specific types and utilities will be included at a later time when
we get a doc-build system integrated.
This software is released under the MIT license. See the license file for more
details.
[type-guards]: https://www.typescriptlang.org/docs/handbook/advanced-types.html#type-guards-and-differentiating-types