@arki/ts
For @arki/[email protected] · source AGENTS.md
AGENTS.md = laws, docs/agent-guide.md = tasks, llms.txt = map.
@arki/ts
Helper types for shapes, casing and dotted paths, plus once, lazyObject, resolveLazy and expectImportPure. Read docs/agent-guide.md for tasks. When a doc and the code disagree, src/index.ts wins.
Laws
- A type is public only if
src/types.test-d.tsasserts it withexpectTypeOf. A new type without an assertion does not merge. - A promise in the README ("a wrong path is a compile error") is an assertion in
src/types.test-d.ts, with@ts-expect-errorfor the negative case. Never write a negative claim only in prose. - Types are cheap to resolve. Measure a change to a deep helper with
bun run bench(instantiation counts) and never write the numbers by hand. - No
anyin a public signature. The path helpers useRecord<string, any>as an internal constraint only, with a reason in a comment. - The portable entries (
.,/utils,/prettify) import nothing fromnode:*. Only/testingmay. - Runtime code stays tiny:
once,resolveLazy,lazyObject. It must run on Hermes, so aProxyis fine and anode:import is not. oncedoes not remember a synchronous throw.lazyObjectbinds methods to the real instance. A change to either needs a test insrc/lazy.test.ts.- Each helper handles plain objects and string keys. Do not grow one into a general library. Point to
type-festfor the rest. - Never delete a public export to quiet a check. Libraries here are general-purpose products.
Changing this package
- Edit
src/utils.ts,src/prettify.tsorsrc/lazy.ts. - Add or change the assertion in
src/types.test-d.tsfirst. Watch it fail, then make it pass. - Run
bun run typecheck. The assertions are checked by the compiler, not by vitest. - Update the README line for the helper.
bun run test:docscompiles its blocks. - Add a changeset in
.changeset/. Documentation-only changes usepatchand the lineno demo impact: documentation and doc-example changes only, runtime behaviour unchanged.
Verify
bun run build
bun run typecheck
bun run test
bun run test:docs
bun run test:runtimes
bun ../../tooling/library/src/llms.ts --check