Registry /
http-networking / reactotron-core-contract
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ClientMessage
✓ import { ClientMessage } from 'reactotron-core-contract'
Represents a message sent from a Reactotron client to the desktop app.
ServerMessage
✓ import { ServerMessage } from 'reactotron-core-contract'
Represents a message sent from the Reactotron desktop app to a client.
ClientCommand
✓ import { ClientCommand } from 'reactotron-core-contract'
Defines the structure for commands a client sends to the Reactotron server.
Reactotron
✓ import { Reactotron } from 'reactotron-core-contract'
Provides the overall interface for the Reactotron instance, useful for type extension.
Host
✓ import { Host } from 'reactotron-core-contract'
Describes the host information for a Reactotron connection.
Demonstrates importing core contract types like `ClientCommand`, `ServerCommand`, `ClientMessage`, and `ServerMessage`, and how to define custom commands or messages adhering to these contracts for type safety.
import { ClientCommand, ServerCommand, ClientMessage, ServerMessage, Reactotron } from 'reactotron-core-contract';
// Example of a custom client command type definition
type MyCustomCommand = ClientCommand<'my.custom.command', { data: string, timestamp: number }>;
// Example of a custom server message type definition
type MyServerStatusMessage = ServerMessage<'server.status', { uptime: number, connections: number }>;
// A dummy function illustrating how you might use these types
function processClientCommand(command: ClientCommand | MyCustomCommand): void {
if (command.type === 'my.custom.command') {
console.log(`Received custom command: ${command.type} with data: ${command.payload.data}`);
} else {
console.log(`Received standard command: ${command.type}`);
}
}
function sendServerMessage(reactotron: Reactotron, message: ServerMessage | MyServerStatusMessage): void {
// In a real scenario, this would send over a WebSocket
console.log(`Sending message from server: ${message.type}`);
}
// Simulate a Reactotron instance for type checking
const mockReactotron: Reactotron = {
host: 'localhost',
port: 9090,
version: '3.x.x',
// ... other Reactotron properties (omitted for brevity)
};
processClientCommand({ type: 'log', payload: { level: 'debug', message: 'Hello from client' }, important: false });
processClientCommand({ type: 'my.custom.command', payload: { data: 'Special data', timestamp: Date.now() }, important: true });
sendServerMessage(mockReactotron, { type: 'server.status', payload: { uptime: 1200, connections: 5 } });
Debug
Known issues
breakingMajor version updates of the main Reactotron project (e.g., from v2 to v3) often involve fundamental changes to the WebSocket communication protocol. As `reactotron-core-contract` defines these protocol types, such changes are inherently breaking and require updating this package along with all client and server implementations to maintain compatibility. Reactotron 3.0 introduced this package for improved type safety.fixAlways align the versions of `reactotron-core-contract` with the major version of your `reactotron-core-client` or `reactotron-core-server` packages. Consult the main Reactotron project's changelog for migration guides between major versions.
affects: <3.0.0 (overall Reactotron ecosystem), <0.3.0 (specific package contract changes)
gotchaThis package primarily exports TypeScript types and interfaces. Attempting to import or use it in a JavaScript-only runtime environment for executable code will result in runtime errors as there are no actual runnable exports, only type definitions.fixEnsure `reactotron-core-contract` is only imported for type declarations within TypeScript files or for type-checking purposes. It is typically a dev dependency.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'reactotron-core-contract'
The package `reactotron-core-contract` is not installed or incorrectly referenced.
fixInstall the package using `npm install reactotron-core-contract` or `yarn add reactotron-core-contract`. Ensure it's listed in your `package.json`.
TS2307: Cannot find module 'reactotron-core-contract' or its corresponding type declarations.
This error occurs in a TypeScript project when the package is installed but TypeScript cannot locate its type definitions. This is less common for a types-first package but can happen if `skipLibCheck` is true and types are subtly misconfigured, or if an older version of TypeScript is used.
fixEnsure `typescript` is installed and configured correctly in your project. Verify `reactotron-core-contract` is in `devDependencies`. If the issue persists, check your `tsconfig.json` for `typeRoots` or `types` configurations, or consider updating TypeScript.
TS2345: Argument of type '{ type: "my.custom.command"; payload: { data: string; timestamp: number; }; }' is not assignable to parameter of type 'ClientCommand'.
You are attempting to use a custom command or message type in a context expecting a standard `ClientCommand` or `ServerCommand` without explicitly defining it as a union type.
fixWhen using custom command or message types, ensure the function signatures or variable types are correctly defined as a union of the standard types and your custom types, e.g., `command: ClientCommand | MyCustomCommand`.
Audit
Dependencies
No dependency data recorded yet.