Installation
Install and configure @dotdo/types
Install
pnpm add -D @dotdo/typesOr with other package managers:
npm install -D @dotdo/types
yarn add -D @dotdo/types
bun add -D @dotdo/typesTypeScript Configuration
Requires TypeScript 5.0+ with these recommended settings:
{
"compilerOptions": {
"moduleResolution": "bundler",
"verbatimModuleSyntax": true,
"strict": true,
"noUncheckedIndexedAccess": true
}
}Import Patterns
Subpath imports (recommended)
Import specific modules for better tree-shaking and clarity:
// Semantic primitives
import type { Thing, Noun, Verb, Event, Action, Domain } from '@dotdo/types/primitives'
// Functions
import type { Fn, CodeFunction, GenerativeFunction, AgenticFunction } from '@dotdo/types/functions'
// Workflows
import type { Workflow, WorkflowStep, WorkflowTrigger } from '@dotdo/types/workflows'
// Events
import type { BaseEvent, EventEmitter, EventBus } from '@dotdo/types/events'
// Agents
import type { Agent, AgentConfig, AgentTool } from '@dotdo/types/agents'
// RPC
import type { RpcPromise, RPCClient, RPCProxy } from '@dotdo/types/rpc'Barrel imports
Import multiple types from the main entry point:
import type {
Thing, Noun, Verb,
Fn, Workflow, Agent,
BaseEvent, RpcPromise,
} from '@dotdo/types'Type-Only Imports
Always use import type for type imports to ensure they're erased at runtime:
// Correct - type-only import
import type { Workflow } from '@dotdo/types'
// Also correct - inline type annotation
import { type Workflow, type WorkflowStep } from '@dotdo/types'
// Avoid - may include runtime code
import { Workflow } from '@dotdo/types'Editor Setup
VS Code
Install the TypeScript extension and enable:
{
"typescript.preferences.importModuleSpecifier": "non-relative",
"typescript.suggest.autoImports": true
}Type Checking
Run type checking with:
tsc --noEmitOr add to your scripts:
{
"scripts": {
"typecheck": "tsc --noEmit"
}
}