CodeSampleX

Sample

react-is 17.0.2: Element

Verified sample for npm react-is 17.0.2: Element. The contract ran on node 22 · linux debian/x64 · docker and passed: Element is exported as a symbol…

sha256:4b11c2452775dd5ab22bbe3ad5735d1f0f43fc107a7ce74d79e77593c9b85b79

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 linux 24 · ubuntu · glibc 2.39 x64 npm

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-09-06

Case

HOW
Goal
verify react-is.Element in pkg:npm/react-is@17.0.2
Packages
Symbols
  • react-is.Element
Created
2026-09-06T01:21:05Z

Contract

  1. Element is exported as a symbol matching Symbol.for('react.element')
  2. Element represents the $$typeof identifier used for React element objects
  3. isElement returns true for objects with $$typeof equal to Element
  4. typeOf returns Element for React element objects and distinguishes them from non-elements or other React types

Files

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

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 react-is.Element in pkg:npm/react-is@17.0.2
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/react-is@17.0.2
Demonstrate these symbols/APIs:
  - react-is.Element

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:f6af33f3b7d763ad7ebf6636eca3798133ba741e7d78947a92440bc38367382b","contract":["Element is exported as a symbol matching Symbol.for('react.element')","Element represents the $$typeof identifier used for React element objects","isElement returns true for objects with $$typeof equal to Element","typeOf returns Element for React element objects and distinguishes them from non-elements or other React types"],"goal":"verify react-is.Element in pkg:npm/react-is@17.0.2","kind":"HOW","packages":["pkg:npm/react-is@17.0.2"],"schemaVersion":1,"symbols":["react-is.Element"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/react-is@17.0.2"],"schemaVersion":1,"subject":"pkg:npm/react-is@17.0.2","symbols":["react-is.Element"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-react-is-element",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-react-is-element",
      "version": "1.0.0",
      "dependencies": {
        "react-is": "17.0.2"
      }
    },
    "node_modules/react-is": {
      "version": "17.0.2",
      "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
      "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
      "license": "MIT"
    }
  }
}
package.json
{
  "name": "sample-react-is-element",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of react-is.Element in react-is 17.0.2",
  "type": "module",
  "main": "src/index.js",
  "dependencies": {
    "react-is": "17.0.2"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify react-is.Element in pkg:npm/react-is@17.0.2",
  "kind": "HOW",
  "packages": [
    "pkg:npm/react-is@17.0.2"
  ],
  "symbols": [
    "react-is.Element"
  ]
}
src/index.js
import { Element, isElement, typeOf } from 'react-is';

/**
 * Return the Element symbol exported by react-is.
 *
 * @returns {symbol} The React element identifier symbol.
 */
export function getElementSymbol() {
  return Element;
}

/**
 * Check if the provided symbol matches react-is Element.
 *
 * @param {*} sym - Symbol or value to compare.
 * @returns {boolean} True if matching react-is Element.
 */
export function isMatchingElementSymbol(sym) {
  return sym === Element;
}

/**
 * Create a mock React element object tagged with the Element symbol.
 *
 * @param {string} type - Element component or tag name.
 * @param {object} props - Element properties.
 * @returns {object} Object with $$typeof set to Element.
 */
export function createElementDescriptor(type, props = {}) {
  return {
    $$typeof: Element,
    type,
    props,
    key: null,
    ref: null,
  };
}

/**
 * Verify whether an object is recognized as a React element.
 *
 * @param {*} value - The value to inspect.
 * @returns {boolean} True if the value is a React element.
 */
export function checkIsElement(value) {
  return isElement(value);
}

/**
 * Identify whether the typeOf helper resolves the value to the Element symbol.
 *
 * @param {*} value - The value to inspect.
 * @returns {boolean} True if typeOf(value) === Element.
 */
export function isElementTypeOf(value) {
  return typeOf(value) === Element;
}

export { Element, isElement, typeOf };
test/contract.mjs
import assert from 'node:assert/strict';
import {
  Element,
  isElement,
  typeOf,
  getElementSymbol,
  isMatchingElementSymbol,
  createElementDescriptor,
  checkIsElement,
  isElementTypeOf,
} from '../src/index.js';

// 1. Element export assertion
assert.equal(typeof Element, 'symbol', 'Element must be exported as a symbol');
assert.equal(Element, Symbol.for('react.element'), 'Element must equal Symbol.for("react.element")');
assert.equal(getElementSymbol(), Element, 'getElementSymbol helper must return Element');
assert.equal(isMatchingElementSymbol(Element), true, 'isMatchingElementSymbol must return true for Element');
assert.equal(isMatchingElementSymbol(Symbol.for('react.element')), true, 'isMatchingElementSymbol must return true for Symbol.for("react.element")');
assert.equal(isMatchingElementSymbol(Symbol.for('react.fragment')), false, 'isMatchingElementSymbol must return false for other symbols');

// 2. Element detection with isElement
const elementObj = createElementDescriptor('div', { id: 'test' });
assert.equal(elementObj.$$typeof, Element, 'Created descriptor must have $$typeof equal to Element');
assert.equal(isElement(elementObj), true, 'isElement must return true for object with $$typeof Element');
assert.equal(checkIsElement(elementObj), true, 'checkIsElement helper must return true');

const nonElementObj = { type: 'div', props: {} };
assert.equal(isElement(nonElementObj), false, 'Plain object must not be recognized as element');
assert.equal(checkIsElement(null), false, 'null must not be recognized as element');
assert.equal(checkIsElement(undefined), false, 'undefined must not be recognized as element');

// 3. typeOf identification matching Element
assert.equal(typeOf(elementObj), Element, 'typeOf must return Element for object with $$typeof Element');
assert.equal(isElementTypeOf(elementObj), true, 'isElementTypeOf helper must return true for element object');
assert.equal(typeOf(nonElementObj), undefined, 'typeOf must return undefined for plain object without $$typeof');
assert.equal(isElementTypeOf(nonElementObj), false, 'isElementTypeOf helper must return false for non-element');

// 4. Distinction from other React symbols
const fragmentObj = {
  $$typeof: Symbol.for('react.fragment'),
  type: Symbol.for('react.fragment'),
  props: {},
  key: null,
  ref: null,
};
assert.notEqual(typeOf(fragmentObj), Element, 'typeOf for fragment must not equal Element');
assert.equal(isElementTypeOf(fragmentObj), false, 'isElementTypeOf helper must return false for fragment');

console.log('Contract passed: react-is.Element verified successfully.');

Origin Seeder

anonymous