humantyping-ts
v0.1.6
Published
Realistic human typing simulation for TypeScript and Playwright.
Maintainers
Readme
HumanTypingTS
TypeScript port of HumanTyping, the Python library by @Lax3n. Simulates human-like typing with variable timing, keyboard-neighbor errors, swap errors, delayed correction, backspacing, word difficulty, bigram speedups, accents, and fatigue.
The package is published as humantyping-ts and is Playwright-first, while the core MarkovTyper can be used without Playwright.
See It In Action

Install
# Bun
bun add humantyping-ts
# npm
npm install humantyping-ts
# pnpm
pnpm add humantyping-ts
# yarn
yarn add humantyping-tsIf you want browser automation, also install Playwright (it's an optional peer dependency):
bun add -d playwrightPlaywright Usage
import { chromium } from "playwright";
import { HumanTyper } from "humantyping-ts";
const browser = await chromium.launch({ headless: false });
const page = await browser.newPage();
await page.goto("https://example.com");
const input = page.locator("input[name='search']");
await input.click();
const typer = new HumanTyper({ wpm: 70, layout: "qwerty" });
await typer.type(input, "realistic typing!");
await browser.close();Pure Simulation
import { MarkovTyper, runMonteCarlo } from "humantyping-ts";
const typer = new MarkovTyper("Hello world", { targetWpm: 60 });
const { totalTime, history } = typer.run();
console.log(totalTime);
console.log(history);
const stats = runMonteCarlo("Hello world", 60, 100);
console.log(stats.meanTime, stats.standardDeviation);Notes
HumanTyper.type(target, text)accepts Playwright-like locators, element handles, or pages with akeyboard.- Playwright is a peer dependency so downstream projects can control the Playwright version.
- The port aims for behavioral parity with the Python model, not exact random-seed equivalence.
Local Development
Clone the repo and install dev dependencies with Bun:
bun installRun the unit tests and build the dist/ output:
bun test
bun run buildRun the real browser smoke test when Playwright browsers are installed:
bun run test:smokeLinks
- npm: https://www.npmjs.com/package/humantyping-ts
- GitHub: https://github.com/jhubbardsf/HumanTypingTS
- Demo page: https://jhubbardsf.github.io/HumanTypingTS/
- Original Python library: https://github.com/Lax3n/HumanTyping
