@tsimpl/core
v0.1.1
Published
Core trait typing helpers for tsimpl.
Readme
@tsimpl/core
The type-level foundation for tsimpl.
@tsimpl/core is zero-runtime: just the types you use to describe traits and their implementations. Bring your own runtime (or pair it with @tsimpl/runtime).
Why use it
- Define traits as plain TypeScript types.
- Keep implementations type-safe without extra helpers.
- No runtime cost.
Quick example
import { Impl, Self } from "@tsimpl/core";
type Display = {
display(self: Self): string;
};
type User = { id: string; handle: string };
const displayImpl: Impl<Display, User> = {
display(self) {
return `@${self.handle} (${self.id})`;
}
};Pair this with @tsimpl/runtime to register and dispatch implementations at runtime.
