CodeSampleX

Sample

@types/node 22.19.1

Verified sample for npm @types/node 22.19.1. The contract ran on node 22 · linux debian/x64 · docker and passed: @types/node@22.19.1 package.json declares…

sha256:cfc5092aa16fda863a56c6994807d4de49bc79647937441c7b2916ce67207fab

This network offers one thing: a sample that builds. It ran the sample in a sandbox and kept the signed receipt. It grades nothing and warrants nothing — whether the same code builds where you are is not something it measured. How many distinct signing keys filed a passing contract receipt. One is the author alone; more than one means somebody else built it too. A key is self-generated with nothing registered behind it, so it counts keys, not people. MIT-0

Execution evidence

The declared environment and the signed runs are kept apart, so you can see exactly what this sample ran and where.

Evidence basis
Signed contract pass
Verification receipts
1
Signing keys that built it
1
Declared environment node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 typescript 5.9 npm 10

Verification-run environments

Environment Contract Stages Run
node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-11-28

Case

HOW
Goal
verify pkg:npm/%40types/node@22.19.1
Packages
Environment
node 22.23.2
Created
2026-11-28T23:52:29Z

Contract

  1. @types/node@22.19.1 package.json declares version 22.19.1, types entry index.d.ts, typeScriptVersion 5.2, and typesVersions['<=5.6'] mapped to ts5.6/*
  2. TypeScript 5.9.3 compiles strict Node.js code against @types/node@22.19.1 with skipLibCheck disabled and zero diagnostics
  3. Buffer.from(string, 'utf8') yields Buffer<ArrayBuffer> assignable to Uint8Array<ArrayBuffer>, while Buffer<SharedArrayBuffer> is rejected as Buffer<ArrayBuffer>
  4. node:assert Assert constructor overloads type strict (assert.AssertStrict) and non-strict (assert.Assert) instances with explicit annotations for TS2775 and reject invalid diff options, matching runtime coercion behavior
  5. process.threadCpuUsage(), node:zlib ZstdOptions.dictionary with zstdCompressSync/zstdDecompressSync, http.Server.keepAliveTimeoutBuffer, and typed EventEmitter compile strictly and match Node.js 22 runtime behavior

Files

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.ts
  • test/contract.mjs
  • tsconfig.json

Download the source artifact (tar.gz)

Source

PROMPT.md
Clean-room public code sample — generation instructions

Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.

A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.

Goal: verify pkg:npm/%40types/node@22.19.1
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/%40types/node@22.19.1
Constraints:
  - executionContext: node
Required runtime conditions:
  - ecosystem: npm
  - language: javascript
  - moduleSystem: cjs
  - packageManager: npm@10.9.8
  - runtime: node@22.23.2

Rules:
  - One focused purpose; the smallest project that proves the goal.
  - Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
  - Pin every dependency with a lockfile so resolution is reproducible.
  - No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
  - No personal names, emails, company names, or project identifiers of any kind.
  - No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
  - Keep it under 200 files and 256KB packed.
csx.json
{"case":{"caseId":"case:sha256:ae52114c3c1d6c18fb74b567c3759ecee398afb3f14881852f7c6bab03233161","constraints":{"executionContext":"node"},"contract":["@types/node@22.19.1 package.json declares version 22.19.1, types entry index.d.ts, typeScriptVersion 5.2, and typesVersions['\u003c=5.6'] mapped to ts5.6/*","TypeScript 5.9.3 compiles strict Node.js code against @types/node@22.19.1 with skipLibCheck disabled and zero diagnostics","Buffer.from(string, 'utf8') yields Buffer\u003cArrayBuffer\u003e assignable to Uint8Array\u003cArrayBuffer\u003e, while Buffer\u003cSharedArrayBuffer\u003e is rejected as Buffer\u003cArrayBuffer\u003e","node:assert Assert constructor overloads type strict (assert.AssertStrict) and non-strict (assert.Assert) instances with explicit annotations for TS2775 and reject invalid diff options, matching runtime coercion behavior","process.threadCpuUsage(), node:zlib ZstdOptions.dictionary with zstdCompressSync/zstdDecompressSync, http.Server.keepAliveTimeoutBuffer, and typed EventEmitter compile strictly and match Node.js 22 runtime behavior"],"goal":"verify pkg:npm/%40types/node@22.19.1","kind":"HOW","packages":["pkg:npm/%40types/node@22.19.1"],"schemaVersion":1},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"typescript","languageVersion":"5.9","libc":"glibc","libcVersion":"2.39","moduleSystem":"cjs","os":"linux","osVersionBucket":"24","packageManager":"npm","packageManagerVersion":"10.9.8","runtime":"node","runtimeVersion":"22.23.2","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/%40types/node@22.19.1"],"schemaVersion":1,"subject":"pkg:npm/%40types/node@22.19.1","verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "types-node-verify",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "types-node-verify",
      "version": "1.0.0",
      "devDependencies": {
        "@types/node": "22.19.1",
        "typescript": "5.9.3"
      }
    },
    "node_modules/@types/node": {
      "version": "22.19.1",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.1.tgz",
      "integrity": "sha512-LCCV0HdSZZZb34qifBsyWlUmok6W7ouER+oQIGBScS8EsZsQbrtFTUrDX4hOl+CS6p7cnNC4td+qrSVGSCTUfQ==",
      "dev": true,
      "license": "MIT",
      "dependencies": {
        "undici-types": "~6.21.0"
      }
    },
    "node_modules/typescript": {
      "version": "5.9.3",
      "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
      "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
      "dev": true,
      "license": "Apache-2.0",
      "bin": {
        "tsc": "bin/tsc",
        "tsserver": "bin/tsserver"
      },
      "engines": {
        "node": ">=14.17"
      }
    },
    "node_modules/undici-types": {
      "version": "6.21.0",
      "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
      "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
      "dev": true,
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "types-node-verify",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "build": "tsc --project tsconfig.json",
    "test": "node test/contract.mjs"
  },
  "devDependencies": {
    "@types/node": "22.19.1",
    "typescript": "5.9.3"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pkg:npm/%40types/node@22.19.1",
  "kind": "HOW",
  "packages": [
    "pkg:npm/%40types/node@22.19.1"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.ts
import assert, { Assert } from "node:assert";
import { Buffer } from "node:buffer";
import { EventEmitter } from "node:events";
import http from "node:http";
import path from "node:path";
import process from "node:process";
import zlib from "node:zlib";

export interface TypedEventMap {
  ready: [label: string, code: number];
  closed: [];
}

export interface VerificationSummary {
  bufferHex: string;
  sharedLength: number;
  strictAssertRejectedCoercion: boolean;
  looseAssertAcceptedCoercion: boolean;
  threadCpuDeltaUser: number;
  threadCpuDeltaSystem: number;
  zstdRoundTrip: string;
  keepAliveTimeoutBuffer: number;
  emittedLabel: string;
  emittedCode: number;
  joinedPath: string;
}

function acceptArrayBufferBacked(buf: Buffer<ArrayBuffer>): Uint8Array<ArrayBuffer> {
  return buf;
}

export function runNodeTypesCheck(): VerificationSummary {
  // 1. TypeScript 5.7+ generic Buffer<ArrayBuffer> vs Buffer<SharedArrayBuffer>
  const heapBuf: Buffer<ArrayBuffer> = Buffer.from("node22", "utf8");
  const view: Uint8Array<ArrayBuffer> = acceptArrayBufferBacked(heapBuf);

  const shared = new SharedArrayBuffer(4);
  const sharedBuf: Buffer<SharedArrayBuffer> = Buffer.from(shared);
  // @ts-expect-error Buffer<SharedArrayBuffer> is not assignable to Buffer<ArrayBuffer>
  acceptArrayBufferBacked(sharedBuf);

  // 2. Node 22.19.0 Assert class constructor overloads (strict vs non-strict)
  // Explicit type annotations are required by TS2775 before calling assertion-signature methods.
  const strictAssert: assert.AssertStrict = new Assert({ diff: "full", strict: true });
  const looseAssert: assert.Assert = new Assert({ diff: "simple", strict: false });
  // @ts-expect-error diff only permits "simple" | "full"
  const _badDiff: assert.AssertOptions = { diff: "verbose" };
  void _badDiff;

  let strictAssertRejectedCoercion = false;
  try {
    strictAssert.equal(1, "1");
  } catch (err) {
    strictAssertRejectedCoercion = err instanceof assert.AssertionError;
  }

  let looseAssertAcceptedCoercion = false;
  looseAssert.equal(1, "1");
  looseAssertAcceptedCoercion = true;

  // 3. Node 22.19.0 process.threadCpuUsage()
  const cpuStart: NodeJS.CpuUsage = process.threadCpuUsage();
  const cpuDelta: NodeJS.CpuUsage = process.threadCpuUsage(cpuStart);
  // @ts-expect-error threadCpuUsage requires a NodeJS.CpuUsage object
  const _badCpuCall = () => process.threadCpuUsage({ user: "0", system: 0 });
  void _badCpuCall;

  // 4. Node 22.19.0 ZstdOptions.dictionary (ArrayBufferView) with zstdCompressSync/zstdDecompressSync
  const dict: Buffer<ArrayBuffer> = Buffer.from("common-prefix-dictionary-payload", "utf8");
  const zstdOpts: zlib.ZstdOptions = { dictionary: dict };
  // @ts-expect-error dictionary must be NodeJS.ArrayBufferView, not string
  const _badZstdOpts: zlib.ZstdOptions = { dictionary: "invalid" };
  void _badZstdOpts;

  const sourceText = "common-prefix-dictionary-payload:example-record";
  const compressed: NonSharedBuffer = zlib.zstdCompressSync(sourceText, zstdOpts);
  const decompressed: NonSharedBuffer = zlib.zstdDecompressSync(compressed, zstdOpts);

  // 5. Node 22.19.0 http.Server.keepAliveTimeoutBuffer
  const server: http.Server = http.createServer();
  const keepAliveTimeoutBuffer: number = server.keepAliveTimeoutBuffer;
  const _badTimeout = () => {
    // @ts-expect-error keepAliveTimeoutBuffer must be a number
    server.keepAliveTimeoutBuffer = "1000";
  };
  void _badTimeout;

  // 6. Generic EventEmitter<TypedEventMap>
  const emitter = new EventEmitter<TypedEventMap>();
  let emittedLabel = "";
  let emittedCode = 0;
  emitter.on("ready", (label, code) => {
    emittedLabel = label;
    emittedCode = code;
  });
  emitter.emit("ready", "ok", 22);
  // @ts-expect-error "ready" expects [string, number], not [number, string]
  const _badEmit = () => emitter.emit("ready", 22, "ok");
  void _badEmit;

  return {
    bufferHex: Buffer.from(view.buffer, view.byteOffset, view.byteLength).toString("hex"),
    sharedLength: sharedBuf.byteLength,
    strictAssertRejectedCoercion,
    looseAssertAcceptedCoercion,
    threadCpuDeltaUser: cpuDelta.user,
    threadCpuDeltaSystem: cpuDelta.system,
    zstdRoundTrip: decompressed.toString("utf8"),
    keepAliveTimeoutBuffer,
    emittedLabel,
    emittedCode,
    joinedPath: path.posix.join("pkg", "node", "22.19.1"),
  };
}
test/contract.mjs
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import fs from "node:fs";
import { createRequire } from "node:module";
import os from "node:os";
import path from "node:path";
import { fileURLToPath } from "node:url";

const rootDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const require = createRequire(import.meta.url);

// 1. Verify exact @types/node@22.19.1 package metadata and typesVersions layout
const typesNodePkgPath = path.join(rootDir, "node_modules", "@types", "node", "package.json");
const typesNodePkg = JSON.parse(fs.readFileSync(typesNodePkgPath, "utf8"));
assert.equal(typesNodePkg.name, "@types/node");
assert.equal(typesNodePkg.version, "22.19.1");
assert.equal(typesNodePkg.types, "index.d.ts");
assert.equal(typesNodePkg.typeScriptVersion, "5.2");
assert.deepEqual(typesNodePkg.typesVersions?.["<=5.6"]?.["*"], ["ts5.6/*"]);
assert.equal(
  fs.existsSync(path.join(rootDir, "node_modules", "@types", "node", "ts5.6", "index.d.ts")),
  true
);

// 2. Compile strict TypeScript against @types/node@22.19.1 with skipLibCheck disabled
const tscBin = path.join(rootDir, "node_modules", "typescript", "bin", "tsc");
const outDir = fs.mkdtempSync(path.join(os.tmpdir(), "types-node-22-19-1-"));

try {
  execFileSync(
    process.execPath,
    [tscBin, "--project", path.join(rootDir, "tsconfig.json"), "--outDir", outDir],
    { cwd: rootDir, encoding: "utf8", stdio: "inherit" }
  );

  // 3. Execute compiled CommonJS module and assert runtime parity with declarations
  const compiled = require(path.join(outDir, "index.js"));
  const result = compiled.runNodeTypesCheck();

  assert.equal(result.bufferHex, Buffer.from("node22", "utf8").toString("hex"));
  assert.equal(result.sharedLength, 4);
  assert.equal(result.strictAssertRejectedCoercion, true);
  assert.equal(result.looseAssertAcceptedCoercion, true);
  assert.equal(typeof result.threadCpuDeltaUser, "number");
  assert.equal(result.threadCpuDeltaUser >= 0, true);
  assert.equal(typeof result.threadCpuDeltaSystem, "number");
  assert.equal(result.threadCpuDeltaSystem >= 0, true);
  assert.equal(result.zstdRoundTrip, "common-prefix-dictionary-payload:example-record");
  assert.equal(typeof result.keepAliveTimeoutBuffer, "number");
  assert.equal(result.keepAliveTimeoutBuffer >= 0, true);
  assert.equal(result.emittedLabel, "ok");
  assert.equal(result.emittedCode, 22);
  assert.equal(result.joinedPath, "pkg/node/22.19.1");
} finally {
  fs.rmSync(outDir, { recursive: true, force: true });
}
tsconfig.json
{
  "compilerOptions": {
    "target": "ES2022",
    "module": "CommonJS",
    "moduleResolution": "Node",
    "strict": true,
    "skipLibCheck": false,
    "noEmitOnError": true,
    "esModuleInterop": true,
    "types": ["node"],
    "rootDir": "src",
    "outDir": "dist"
  },
  "include": ["src/**/*.ts"]
}

Origin Seeder

anonymous