Type Definitions
Complete TypeScript reference for LexKit
Comprehensive TypeScript definitions that power LexKit's type-safe architecture. Understand the core interfaces, generics, and utility types that make LexKit type-safe.
Quick Links
Core Concepts
LexKit's type system is built around several key concepts that work together to provide compile-time safety and excellent developer experience.
Extensive use of TypeScript generics to provide type safety at compile time, ensuring that commands, state queries, and plugins are correctly typed.
Type-safe arrays of extensions that are analyzed at compile time to extract available commands, state queries, and plugin types.
Advanced type inference utilities that automatically extract and merge types from extension arrays, providing IntelliSense and compile-time validation.
Editor Configuration Types
Types that define how the editor is configured and themed.
EditorConfig Interface
NodeTheme Interface
Editor Context Types
The main context type that provides type-safe access to the editor and its extensions.
EditorContextType Interface
| Property | Type | Description |
|---|---|---|
editor | LexicalEditor | null | The raw Lexical editor instance |
config | EditorConfig | Editor configuration including theme |
extensions | Exts | Array of registered extensions (typed) |
commands | any | Aggregated commands from all extensions |
activeStates | any | Current state of all extensions |
plugins | ReactNode[] | React plugins from extensions |
hasExtension | Function | Check if a specific extension is loaded |
Extension Types
Core types that define the extension system and its contracts.
Extension Categories
Base Configuration Interface
Extension Interface
Type Extraction Utilities
Advanced TypeScript utilities that extract and merge types from extension arrays.
Base Commands
Type Extraction Utilities
EditorContextType (Extensions)
Type System Benefits
How LexKit's advanced type system improves your development experience.
Get full autocomplete for commands, state queries, and extension methods. Never guess what methods are available on your editor context.
Catch extension configuration errors and API misuse at compile time, preventing runtime errors and improving code reliability.
When you change extension APIs or add/remove extensions, TypeScript will guide you through all the necessary updates.
Rich type information enables better IDE support, documentation, and makes the codebase more maintainable and self-documenting.
Usage Examples
See how the type system works in practice with real code examples.