Beispiel
react-is 19.2.8: ForwardRef
Verifiziertes Beispiel für npm react-is 19.2.8: ForwardRef. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand.
sha256:6b8a615b4d1da8823c221f5ce61ade42a746258ce47dd6fd985b0ecb1fd9876f
Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen.
Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen.
MIT-0
Ausführungsbelege
Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.
- Beleggrundlage
- Signierter Vertrag bestanden
- Verifizierungsbelege
- 1
- Signaturschlüssel, die es gebaut haben
- 1
Deklarierte Umgebung
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
Umgebungen der Verifizierungsläufe
| Umgebung | Contract | Stufen | Lauf |
|---|---|---|---|
| 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-06 |
Fall
HOW- Ziel
- verify react-is.ForwardRef in pkg:npm/react-is@19.2.8
- Pakete
- Symbole
-
- react-is.ForwardRef
- Umgebung
- node 22.23.2
- Erstellt
- 2026-09-06T02:47:10Z
Contract
- ForwardRef is exported as a symbol equal to Symbol.for('react.forward_ref')
- isForwardRef correctly identifies React 19 forwardRef elements
- typeOf returns ForwardRef symbol for forwardRef elements
- isValidElementType returns true for forwardRef component
- isForwardRef rejects standard HTML elements, fragment elements, and context elements
- isForwardRef rejects non-element values, plain objects, raw forwardRef components, and primitives
Dateien
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.js
- test/contract.mjs
Quelltext
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 react-is.ForwardRef in pkg:npm/react-is@19.2.8
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/react-is@19.2.8
Demonstrate these symbols/APIs:
- react-is.ForwardRef
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:0542330aef6adc65253304b1015616734612973d5d460045da93ee95816f4b36","contract":["ForwardRef is exported as a symbol equal to Symbol.for('react.forward_ref')","isForwardRef correctly identifies React 19 forwardRef elements","typeOf returns ForwardRef symbol for forwardRef elements","isValidElementType returns true for forwardRef component","isForwardRef rejects standard HTML elements, fragment elements, and context elements","isForwardRef rejects non-element values, plain objects, raw forwardRef components, and primitives"],"goal":"verify react-is.ForwardRef in pkg:npm/react-is@19.2.8","kind":"HOW","packages":["pkg:npm/react-is@19.2.8"],"schemaVersion":1,"symbols":["react-is.ForwardRef"]},"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/react-is@19.2.8"],"schemaVersion":1,"subject":"pkg:npm/react-is@19.2.8","symbols":["react-is.ForwardRef"],"verifierAdapter":"node-typescript@1"}
{
"name": "sample-react-is-forward-ref",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-react-is-forward-ref",
"version": "1.0.0",
"dependencies": {
"react-is": "19.2.8"
}
},
"node_modules/react-is": {
"version": "19.2.8",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-19.2.8.tgz",
"integrity": "sha512-s5un28nYxKJw5gvUHyW5PCC28CvBqLu9r3cWgzHT4Vo/5fqqkFcdRYsGcKf50WMPpjjFZS5d76fn3YCo2njKwQ==",
"license": "MIT"
}
}
}
{
"name": "sample-react-is-forward-ref",
"version": "1.0.0",
"private": true,
"description": "Clean-room verification of react-is ForwardRef in React 19",
"type": "module",
"main": "src/index.js",
"dependencies": {
"react-is": "19.2.8"
}
}
{
"schemaVersion": 1,
"goal": "verify react-is.ForwardRef in pkg:npm/react-is@19.2.8",
"kind": "HOW",
"packages": [
"pkg:npm/react-is@19.2.8"
],
"symbols": [
"react-is.ForwardRef"
]
}
import {
ForwardRef,
isForwardRef,
isValidElementType,
typeOf,
} from 'react-is';
/**
* Return the ForwardRef symbol from react-is.
* In React 19, this corresponds to Symbol.for('react.forward_ref').
*
* @returns {symbol} The ForwardRef symbol.
*/
export function getForwardRefSymbol() {
return ForwardRef;
}
/**
* Check if the given element is a React ForwardRef element.
*
* @param {*} value - The value to inspect.
* @returns {boolean} True if the value is a ForwardRef element.
*/
export function checkIsForwardRef(value) {
return isForwardRef(value);
}
/**
* Check if the given component type is a valid element type.
*
* @param {*} type - The component type to check.
* @returns {boolean} True if the type is a valid element type.
*/
export function checkIsValidElementType(type) {
return isValidElementType(type);
}
/**
* Determine the element type symbol of a given React element using typeOf.
*
* @param {*} value - The React element to inspect.
* @returns {symbol|undefined} The matched React symbol or undefined for non-elements.
*/
export function identifyElementType(value) {
return typeOf(value);
}
/**
* Helper to construct a synthetic React 19 ForwardRef component.
*
* @param {Function} [renderFn] - Render function for forwardRef component.
* @returns {object} Synthetic forwardRef component.
*/
export function createSyntheticForwardRefComponent(renderFn = (props, ref) => null) {
return {
$$typeof: ForwardRef,
render: renderFn,
};
}
/**
* Helper to construct a synthetic React 19 ForwardRef element.
*
* @param {object} forwardRefType - Component with $$typeof matching ForwardRef.
* @param {object} [props={}] - Element props.
* @returns {object} Synthetic React 19 element.
*/
export function createSyntheticForwardRefElement(forwardRefType, props = {}) {
return {
$$typeof: Symbol.for('react.transitional.element'),
type: forwardRefType,
props,
key: null,
ref: null,
};
}
export {
ForwardRef,
isForwardRef,
isValidElementType,
typeOf,
};
import assert from 'node:assert/strict';
import {
ForwardRef,
isForwardRef,
isValidElementType,
typeOf,
getForwardRefSymbol,
checkIsForwardRef,
checkIsValidElementType,
identifyElementType,
createSyntheticForwardRefComponent,
createSyntheticForwardRefElement,
} from '../src/index.js';
// 1. ForwardRef symbol export verification
assert.equal(typeof ForwardRef, 'symbol', 'ForwardRef must be exported as a symbol');
assert.equal(
ForwardRef,
Symbol.for('react.forward_ref'),
'ForwardRef in React 19 must match Symbol.for("react.forward_ref")'
);
assert.equal(
getForwardRefSymbol(),
ForwardRef,
'getForwardRefSymbol helper must return ForwardRef symbol'
);
// 2. isForwardRef function export verification
assert.equal(typeof isForwardRef, 'function', 'isForwardRef must be exported as a function');
assert.equal(typeof checkIsForwardRef, 'function', 'checkIsForwardRef helper must be a function');
// 3. isValidElementType verification for forwardRef component
const forwardRefComponent = createSyntheticForwardRefComponent();
assert.equal(
isValidElementType(forwardRefComponent),
true,
'isValidElementType must return true for forwardRef component'
);
assert.equal(
checkIsValidElementType(forwardRefComponent),
true,
'checkIsValidElementType helper must return true for forwardRef component'
);
// 4. React 19 forwardRef element identification
const forwardRefElement = createSyntheticForwardRefElement(forwardRefComponent, {
label: 'contract-test-label',
});
assert.equal(
isForwardRef(forwardRefElement),
true,
'isForwardRef must return true for React 19 forwardRef elements'
);
assert.equal(
checkIsForwardRef(forwardRefElement),
true,
'checkIsForwardRef helper must return true for React 19 forwardRef elements'
);
assert.equal(
typeOf(forwardRefElement),
ForwardRef,
'typeOf must return ForwardRef symbol for forwardRef elements'
);
assert.equal(
identifyElementType(forwardRefElement),
ForwardRef,
'identifyElementType helper must return ForwardRef symbol'
);
// 5. Distinction from standard elements and other component types
const standardElement = {
$$typeof: Symbol.for('react.transitional.element'),
type: 'button',
props: { className: 'btn' },
key: null,
ref: null,
};
assert.equal(
isForwardRef(standardElement),
false,
'isForwardRef must return false for standard HTML/DOM elements'
);
assert.notEqual(
typeOf(standardElement),
ForwardRef,
'typeOf on standard elements must not equal ForwardRef'
);
const fragmentElement = {
$$typeof: Symbol.for('react.transitional.element'),
type: Symbol.for('react.fragment'),
props: {},
key: null,
ref: null,
};
assert.equal(
isForwardRef(fragmentElement),
false,
'isForwardRef must return false for fragment elements'
);
const providerElement = {
$$typeof: Symbol.for('react.transitional.element'),
type: {
$$typeof: Symbol.for('react.context'),
},
props: { value: 'context-val' },
key: null,
ref: null,
};
assert.equal(
isForwardRef(providerElement),
false,
'isForwardRef must return false for context provider elements'
);
const consumerElement = {
$$typeof: Symbol.for('react.transitional.element'),
type: {
$$typeof: Symbol.for('react.consumer'),
},
props: {},
key: null,
ref: null,
};
assert.equal(
isForwardRef(consumerElement),
false,
'isForwardRef must return false for context consumer elements'
);
// 6. Non-element and invalid input rejection
assert.equal(isForwardRef(null), false, 'null is not a forwardRef element');
assert.equal(isForwardRef(undefined), false, 'undefined is not a forwardRef element');
assert.equal(isForwardRef({}), false, 'plain empty object is not a forwardRef element');
assert.equal(isForwardRef('react.forward_ref'), false, 'string primitive is not a forwardRef element');
assert.equal(isForwardRef(12345), false, 'number primitive is not a forwardRef element');
assert.equal(
isForwardRef(forwardRefComponent),
false,
'raw forwardRef component object without element wrapper is not a forwardRef element'
);
assert.equal(typeOf(null), undefined, 'typeOf(null) must return undefined');
assert.equal(typeOf(undefined), undefined, 'typeOf(undefined) must return undefined');
assert.equal(typeOf({}), undefined, 'typeOf({}) must return undefined');
assert.equal(typeOf(forwardRefComponent), undefined, 'typeOf(forwardRefComponent) must return undefined');
console.log('All react-is.ForwardRef contract checks passed successfully.');
Ursprungs-Seeder
anonym