@forthtilliath/ts-types
v0.1.0
Published
Generic TypeScript utility **types** (no runtime code) — the kind of small helpers usually found in libraries like `type-fest` or `ts-toolbelt`, kept in-house here so the rest of the monorepo doesn't need an extra dependency.
Readme
@forthtilliath/ts-types
Generic TypeScript utility types (no runtime code) — the kind of small
helpers usually found in libraries like type-fest or ts-toolbelt, kept
in-house here so the rest of the monorepo doesn't need an extra dependency.
Install
{
"devDependencies": {
"@forthtilliath/ts-types": "workspace:*"
}
}Usage
import type { NonEmptyArray } from "@forthtilliath/ts-types/array";
import type {
Entries,
ExactRecord,
KeysMatching,
Merge,
Prettify,
RecordValues,
UnknownRecord,
} from "@forthtilliath/ts-types/object";
import type {
StoryComponent,
StoryDecorator,
} from "@forthtilliath/ts-types/helpers";Also available as one barrel: import type { ... } from "@forthtilliath/ts-types".
array
NonEmptyArray<T>—[T, ...T[]], forces at least one element.
object
UnknownRecord—Record<PropertyKey, unknown>, the base constraint most of the other object types build on.ExactRecord<T>— enforces the exact shape of an object (no excess properties slipping through structural typing).RecordValues<T>— union of an object's value types.Entries<T>— the[key, value]tuple shape ofObject.entries(obj).KeysMatching<T, V>— keys ofTwhose value type extendsV.Merge<F, S>— flattens an intersection (F & S) into a single object type, withS's keys taking priority overF's.Prettify<T>— cosmetic only: expands a type alias into its full object shape in editor tooltips, instead of showing the alias name.
helpers
StoryComponent<T>/StoryDecorator<T>/StoryArgumentsWithKey<T>— typing helpers for Storybook decorators and custom story render functions.
Scripts
pnpm run build # tsc -> dist/
pnpm run dev # tsc --watch
pnpm run check-types # tsc --noEmit
pnpm run lint # eslint