Traits TS is a project for providing a Traits mechanism for TypeScript. It consists of the core @traits-ts/core and the companion standard library @traits-ts/stdlib.
The base @traits-ts/core
is a TypeScript library providing the bare traits (aka mixins)
mechanism for extending classes with multiple base functionalities,
although TypeScript/JavaScript technically do not allow multiple
inheritance. For this, it internally leverages the regular class extends
mechanism at the JavaScript level, so it is does not have to
manipulate the run-time objects at all. At the TypeScript level, it is
fully type-safe and correctly derives all properties of the traits a
class is derived from.
The companion @traits-ts/stdlib provides a set of standard, reusable, generic, typed traits, based on @traits-ts/core. Currently, this standard library provides the particular traits Identifiable, Configurable, Bindable, Subscribable, Hookable, Disposable, Traceable, and Serializable.
This is Traits TS, the home of the project. Its two main parts can be found here:
- @traits-ts/core (Core)
- @traits-ts/stdlib (Standard Library)