Ejemplo
@types/react-dom 19.2.4: types
Muestra verificada para npm @types/react-dom 19.2.4: types. El contrato se ejecutó en node 22 · linux alpine/x64 · docker y pasó.
sha256:20407b89528e5a49b984b147008a9bfeae4081eb938c5fb3eda01e6945795d14
Esta red ofrece una sola cosa: una muestra que compila. La ejecutó en un sandbox y guardó el recibo firmado. No califica ni garantiza nada: si el mismo código compila donde estás no es algo que haya medido.
Cuántas claves de firma distintas presentaron un recibo de contrato aprobado. Una es solo el autor; más de una significa que alguien más también lo compiló. Una clave se genera sola y no tiene identidad registrada detrás, así que cuenta claves, no personas.
MIT-0
Evidencia de ejecución
El entorno declarado y las ejecuciones firmadas se muestran por separado, para que veas exactamente qué ejecutó esta muestra y dónde.
- Base de evidencia
- Contrato firmado aprobado
- Recibos de verificación
- 2
- Claves de firma que lo compilaron
- 1
Entorno declarado
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Entornos de las ejecuciones de verificación
| Entorno | Contrato | Etapas | Ejecución |
|---|---|---|---|
| node 22 · linux alpine/x64 · docker ed25519:c1973797be207ac4 | PASS | compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS CONTAINER_RUN · node-typescript@1node:22-alpine@sha256:c610fcdfb1d5… |
2026-08-26 |
| 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-09-07 |
Caso
HOW- Objetivo
- verify @types/react-dom.types in pkg:npm/%40types/react-dom@19.2.4
- Paquetes
- Símbolos
-
- @types/react-dom.types
- Entorno
- node 22.23.2
- Creado
- 2026-08-26T12:42:09Z
Contrato
- @types/react-dom package.json defines types field pointing to index.d.ts and version 19.2.4
- @types/react-dom package exports declare TypeScript definition subpaths for client, server, static, canary, and experimental modules
- index.d.ts declares core DOM functions and hook state types including createPortal, flushSync, useFormStatus, and useFormState
- client.d.ts declares client rendering root functions createRoot and hydrateRoot along with Root and HydrationOptions interfaces
- server.d.ts and static.d.ts declare server streaming and prerendering APIs including renderToPipeableStream, renderToReadableStream, and prerender
- Inspection helpers correctly verify type declaration files existence and symbol content integrity
Archivos
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Código fuente
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 @types/react-dom.types in pkg:npm/%40types/react-dom@19.2.4
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/%40types/react-dom@19.2.4
Demonstrate these symbols/APIs:
- @types/react-dom.types
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.
{"case":{"caseId":"case:sha256:d91e0f278ac4c353c254629ddc469fc77eeb4eae8d2a4f1e8141280169a209fc","constraints":{"executionContext":"node"},"contract":["@types/react-dom package.json defines types field pointing to index.d.ts and version 19.2.4","@types/react-dom package exports declare TypeScript definition subpaths for client, server, static, canary, and experimental modules","index.d.ts declares core DOM functions and hook state types including createPortal, flushSync, useFormStatus, and useFormState","client.d.ts declares client rendering root functions createRoot and hydrateRoot along with Root and HydrationOptions interfaces","server.d.ts and static.d.ts declare server streaming and prerendering APIs including renderToPipeableStream, renderToReadableStream, and prerender","Inspection helpers correctly verify type declaration files existence and symbol content integrity"],"goal":"verify @types/react-dom.types in pkg:npm/%40types/react-dom@19.2.4","kind":"HOW","packages":["pkg:npm/%40types/react-dom@19.2.4"],"schemaVersion":1,"symbols":["@types/react-dom.types"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"javascript","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/react-dom@19.2.4"],"schemaVersion":1,"subject":"pkg:npm/%40types/react-dom@19.2.4","symbols":["@types/react-dom.types"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-dom-types",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-dom-types",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"@types/react-dom": "19.2.4"
}
},
"node_modules/@types/react": {
"version": "19.2.18",
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.18.tgz",
"integrity": "sha512-AnzbBERsrLKtk2XSfTbYRLjQPdy116Sty4q+T+Bp3IC4l6jNBvreVPAHmpq9qhXQM7CXZPjLVmGMw9sy+hxQ3w==",
"license": "MIT",
"peer": true,
"dependencies": {
"csstype": "^3.2.2"
}
},
"node_modules/@types/react-dom": {
"version": "19.2.4",
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.2.4.tgz",
"integrity": "sha512-Bsc+QHgp+P/F02XDzNCY9jnZNCUuLki36KT7VKrTXXLdHf+vHMNZnW1rVu5DNW/rCK+fya3DATySbLM4yhtKUw==",
"license": "MIT",
"peerDependencies": {
"@types/react": "^19.2.0"
}
},
"node_modules/csstype": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
"integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
"license": "MIT",
"peer": true
}
}
}
{
"name": "sample-react-dom-types",
"version": "1.0.0",
"private": true,
"license": "MIT-0",
"dependencies": {
"@types/react-dom": "19.2.4"
}
}
{
"schemaVersion": 1,
"goal": "verify @types/react-dom.types in pkg:npm/%40types/react-dom@19.2.4",
"kind": "HOW",
"packages": [
"pkg:npm/%40types/react-dom@19.2.4"
],
"symbols": [
"@types/react-dom.types"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import fs from 'node:fs';
import path from 'node:path';
import { createRequire } from 'node:module';
const require = createRequire(import.meta.url);
/**
* Returns the package directory for @types/react-dom.
* @returns {string} Directory path
*/
export function getReactDomTypesDir() {
const pkgPath = require.resolve('@types/react-dom/package.json');
return path.dirname(pkgPath);
}
/**
* Resolves the path to a declaration file in @types/react-dom.
* @param {string} [subPath='index.d.ts'] - Declaration relative file path
* @returns {string} Absolute path to declaration file
*/
export function getDeclarationPath(subPath = 'index.d.ts') {
return path.join(getReactDomTypesDir(), subPath);
}
/**
* Reads the content of a declaration file in @types/react-dom.
* @param {string} [subPath='index.d.ts'] - Declaration relative file path
* @returns {string} File content
*/
export function readDeclarationContent(subPath = 'index.d.ts') {
const declPath = getDeclarationPath(subPath);
return fs.readFileSync(declPath, 'utf8');
}
/**
* Validates package.json type definition metadata for @types/react-dom.
* @returns {object} Manifest types metadata summary
*/
export function inspectPackageTypesMetadata() {
const pkgJson = require('@types/react-dom/package.json');
return {
name: pkgJson.name,
version: pkgJson.version,
types: pkgJson.types,
hasMainTypes: pkgJson.types === 'index.d.ts',
exports: pkgJson.exports,
hasClientExport: Boolean(pkgJson.exports && pkgJson.exports['./client']),
hasServerExport: Boolean(pkgJson.exports && pkgJson.exports['./server']),
hasStaticExport: Boolean(pkgJson.exports && pkgJson.exports['./static']),
hasCanaryExport: Boolean(pkgJson.exports && pkgJson.exports['./canary']),
hasExperimentalExport: Boolean(pkgJson.exports && pkgJson.exports['./experimental']),
hasTestUtilsExport: Boolean(pkgJson.exports && pkgJson.exports['./test-utils'])
};
}
/**
* Inspects all core TypeScript declaration files for expected symbol declarations.
* @returns {object} Declared symbol inspection results
*/
export function inspectDeclaredSymbols() {
const indexContent = readDeclarationContent('index.d.ts');
const clientContent = readDeclarationContent('client.d.ts');
const serverContent = readDeclarationContent('server.d.ts');
const staticContent = readDeclarationContent('static.d.ts');
return {
index: {
hasCreatePortal: indexContent.includes('function createPortal('),
hasFlushSync: indexContent.includes('function flushSync<R>('),
hasUnstableBatchedUpdates: indexContent.includes('function unstable_batchedUpdates<'),
hasUseFormStatus: indexContent.includes('function useFormStatus(): FormStatus;'),
hasUseFormState: indexContent.includes('function useFormState<State>('),
hasPreload: indexContent.includes('function preload('),
hasPreinit: indexContent.includes('function preinit('),
hasVersion: indexContent.includes('const version: string;')
},
client: {
hasCreateRoot: clientContent.includes('function createRoot('),
hasHydrateRoot: clientContent.includes('function hydrateRoot('),
hasRootInterface: clientContent.includes('interface Root {'),
hasRootOptionsInterface: clientContent.includes('interface RootOptions {'),
hasHydrationOptionsInterface: clientContent.includes('interface HydrationOptions {')
},
server: {
hasRenderToString: serverContent.includes('function renderToString('),
hasRenderToStaticMarkup: serverContent.includes('function renderToStaticMarkup('),
hasRenderToPipeableStream: serverContent.includes('function renderToPipeableStream('),
hasRenderToReadableStream: serverContent.includes('function renderToReadableStream(')
},
static: {
hasPrerenderToNodeStream: staticContent.includes('function prerenderToNodeStream('),
hasPrerender: staticContent.includes('function prerender(')
}
};
}
import assert from 'node:assert/strict';
import fs from 'node:fs';
import {
getReactDomTypesDir,
getDeclarationPath,
readDeclarationContent,
inspectPackageTypesMetadata,
inspectDeclaredSymbols
} from '../src/index.mjs';
// Contract 1: @types/react-dom package.json defines types field pointing to index.d.ts and version 19.2.4
{
const metadata = inspectPackageTypesMetadata();
assert.equal(metadata.name, '@types/react-dom');
assert.equal(metadata.version, '19.2.4');
assert.equal(metadata.types, 'index.d.ts');
assert.equal(metadata.hasMainTypes, true);
}
// Contract 2: @types/react-dom package exports declare TypeScript definition subpaths for client, server, static, canary, and experimental modules
{
const metadata = inspectPackageTypesMetadata();
assert.equal(metadata.hasClientExport, true);
assert.equal(metadata.hasServerExport, true);
assert.equal(metadata.hasStaticExport, true);
assert.equal(metadata.hasCanaryExport, true);
assert.equal(metadata.hasExperimentalExport, true);
assert.equal(metadata.hasTestUtilsExport, true);
}
// Contract 3: index.d.ts declares core DOM functions and hook state types including createPortal, flushSync, useFormStatus, and useFormState
{
const indexPath = getDeclarationPath('index.d.ts');
assert.ok(fs.existsSync(indexPath));
const content = readDeclarationContent('index.d.ts');
assert.ok(content.includes('function createPortal('));
assert.ok(content.includes('function flushSync<R>('));
assert.ok(content.includes('function useFormStatus(): FormStatus;'));
assert.ok(content.includes('function useFormState<State>('));
}
// Contract 4: client.d.ts declares client rendering root functions createRoot and hydrateRoot along with Root and HydrationOptions interfaces
{
const clientPath = getDeclarationPath('client.d.ts');
assert.ok(fs.existsSync(clientPath));
const content = readDeclarationContent('client.d.ts');
assert.ok(content.includes('function createRoot('));
assert.ok(content.includes('function hydrateRoot('));
assert.ok(content.includes('interface Root {'));
assert.ok(content.includes('interface RootOptions {'));
assert.ok(content.includes('interface HydrationOptions {'));
}
// Contract 5: server.d.ts and static.d.ts declare server streaming and prerendering APIs including renderToPipeableStream, renderToReadableStream, and prerender
{
const serverPath = getDeclarationPath('server.d.ts');
const staticPath = getDeclarationPath('static.d.ts');
assert.ok(fs.existsSync(serverPath));
assert.ok(fs.existsSync(staticPath));
const serverContent = readDeclarationContent('server.d.ts');
assert.ok(serverContent.includes('function renderToString('));
assert.ok(serverContent.includes('function renderToPipeableStream('));
assert.ok(serverContent.includes('function renderToReadableStream('));
const staticContent = readDeclarationContent('static.d.ts');
assert.ok(staticContent.includes('function prerender('));
assert.ok(staticContent.includes('function prerenderToNodeStream('));
}
// Contract 6: Inspection helpers correctly verify type declaration files existence and symbol content integrity
{
const dir = getReactDomTypesDir();
assert.ok(fs.existsSync(dir));
const symbols = inspectDeclaredSymbols();
assert.equal(symbols.index.hasCreatePortal, true);
assert.equal(symbols.index.hasFlushSync, true);
assert.equal(symbols.index.hasUseFormStatus, true);
assert.equal(symbols.index.hasUseFormState, true);
assert.equal(symbols.client.hasCreateRoot, true);
assert.equal(symbols.client.hasHydrateRoot, true);
assert.equal(symbols.server.hasRenderToPipeableStream, true);
assert.equal(symbols.server.hasRenderToReadableStream, true);
assert.equal(symbols.static.hasPrerender, true);
assert.equal(symbols.static.hasPrerenderToNodeStream, true);
}
console.log('Contract tests passed.');
Seeder de origen
anónimo