CodeSampleX

Sample

react-is 19.2.8: typeOf

Verified sample for npm react-is 19.2.8: typeOf. The contract ran on node 22 · linux debian/x64 · docker and passed: typeOf identifies standard React DOM and…

sha256:0e32432ee2e212e42bb8b4d5e429747bcc2310b1542eb7f6004d9f6992a53340

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

Case

HOW
Goal
verify react-is.typeOf in pkg:npm/react-is@19.2.8
Packages
Symbols
  • react-is.typeOf
Environment
node 22.23.2
Created
2026-09-06T02:14:09Z

Contract

  1. typeOf identifies standard React DOM and component elements returning Element symbol
  2. typeOf identifies React fragment elements returning Fragment symbol
  3. typeOf identifies React portal objects returning Portal symbol
  4. typeOf identifies ContextProvider elements returning ContextProvider symbol
  5. typeOf identifies ContextConsumer elements returning ContextConsumer symbol
  6. typeOf identifies ForwardRef component elements returning ForwardRef symbol
  7. typeOf identifies Lazy component elements returning Lazy symbol
  8. typeOf identifies Memo component elements returning Memo symbol
  9. typeOf identifies Profiler elements returning Profiler symbol
  10. typeOf identifies StrictMode elements returning StrictMode symbol
  11. typeOf identifies Suspense elements returning Suspense symbol
  12. typeOf identifies SuspenseList elements returning SuspenseList symbol
  13. typeOf returns undefined for plain objects, null, undefined, and primitive types

Files

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

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.typeOf 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.typeOf
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:18341b0e80f506e98dd54aa467abf71a091badf82d517a65e6a1472681887ea0","constraints":{"executionContext":"node"},"contract":["typeOf identifies standard React DOM and component elements returning Element symbol","typeOf identifies React fragment elements returning Fragment symbol","typeOf identifies React portal objects returning Portal symbol","typeOf identifies ContextProvider elements returning ContextProvider symbol","typeOf identifies ContextConsumer elements returning ContextConsumer symbol","typeOf identifies ForwardRef component elements returning ForwardRef symbol","typeOf identifies Lazy component elements returning Lazy symbol","typeOf identifies Memo component elements returning Memo symbol","typeOf identifies Profiler elements returning Profiler symbol","typeOf identifies StrictMode elements returning StrictMode symbol","typeOf identifies Suspense elements returning Suspense symbol","typeOf identifies SuspenseList elements returning SuspenseList symbol","typeOf returns undefined for plain objects, null, undefined, and primitive types"],"goal":"verify react-is.typeOf in pkg:npm/react-is@19.2.8","kind":"HOW","packages":["pkg:npm/react-is@19.2.8"],"schemaVersion":1,"symbols":["react-is.typeOf"]},"contractCommand":["node","test/contract.js"],"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.typeOf"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "verify-react-is-typeof",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "verify-react-is-typeof",
      "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"
    }
  }
}
package.json
{
  "name": "verify-react-is-typeof",
  "version": "1.0.0",
  "description": "verify react-is.typeOf in pkg:npm/react-is@19.2.8",
  "main": "src/index.js",
  "dependencies": {
    "react-is": "19.2.8"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify react-is.typeOf in pkg:npm/react-is@19.2.8",
  "kind": "HOW",
  "packages": [
    "pkg:npm/react-is@19.2.8"
  ],
  "symbols": [
    "react-is.typeOf"
  ],
  "constraints": {
    "executionContext": "node"
  },
  "runtimeConditions": {
    "ecosystem": "npm",
    "language": "javascript",
    "moduleSystem": "cjs",
    "packageManager": "npm@10.9.8",
    "runtime": "node@22.23.2"
  }
}
src/index.js
const {
  typeOf,
  ContextConsumer,
  ContextProvider,
  Element,
  ForwardRef,
  Fragment,
  Lazy,
  Memo,
  Portal,
  Profiler,
  StrictMode,
  Suspense,
  SuspenseList,
} = require('react-is');

/**
 * Inspects a value and returns its React element type symbol, or undefined if not a React element.
 *
 * @param {*} value - Value to inspect.
 * @returns {symbol|undefined} The React symbol or undefined.
 */
function inspectTypeOf(value) {
  return typeOf(value);
}

module.exports = {
  typeOf,
  inspectTypeOf,
  ContextConsumer,
  ContextProvider,
  Element,
  ForwardRef,
  Fragment,
  Lazy,
  Memo,
  Portal,
  Profiler,
  StrictMode,
  Suspense,
  SuspenseList,
};
test/contract.js
const assert = require('node:assert/strict');
const {
  typeOf,
  inspectTypeOf,
  ContextConsumer,
  ContextProvider,
  Element,
  ForwardRef,
  Fragment,
  Lazy,
  Memo,
  Portal,
  Profiler,
  StrictMode,
  Suspense,
  SuspenseList,
} = require('../src/index.js');

// 1. Export verification
assert.equal(typeof typeOf, 'function', 'typeOf must be a function');
assert.equal(typeof inspectTypeOf, 'function', 'inspectTypeOf must be a function');
assert.equal(typeof Element, 'symbol', 'Element must be a symbol');
assert.equal(typeof Fragment, 'symbol', 'Fragment must be a symbol');
assert.equal(typeof Portal, 'symbol', 'Portal must be a symbol');
assert.equal(typeof ContextProvider, 'symbol', 'ContextProvider must be a symbol');
assert.equal(typeof ContextConsumer, 'symbol', 'ContextConsumer must be a symbol');
assert.equal(typeof ForwardRef, 'symbol', 'ForwardRef must be a symbol');
assert.equal(typeof Lazy, 'symbol', 'Lazy must be a symbol');
assert.equal(typeof Memo, 'symbol', 'Memo must be a symbol');
assert.equal(typeof Profiler, 'symbol', 'Profiler must be a symbol');
assert.equal(typeof StrictMode, 'symbol', 'StrictMode must be a symbol');
assert.equal(typeof Suspense, 'symbol', 'Suspense must be a symbol');
assert.equal(typeof SuspenseList, 'symbol', 'SuspenseList must be a symbol');

// React 19 symbols
const REACT_ELEMENT_TYPE = Symbol.for('react.transitional.element');
const REACT_PORTAL_TYPE = Symbol.for('react.portal');
const REACT_FRAGMENT_TYPE = Symbol.for('react.fragment');
const REACT_CONTEXT_TYPE = Symbol.for('react.context');
const REACT_CONSUMER_TYPE = Symbol.for('react.consumer');
const REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
const REACT_LAZY_TYPE = Symbol.for('react.lazy');
const REACT_MEMO_TYPE = Symbol.for('react.memo');
const REACT_PROFILER_TYPE = Symbol.for('react.profiler');
const REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode');
const REACT_SUSPENSE_TYPE = Symbol.for('react.suspense');
const REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list');

// 2. Standard React elements
const domElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: 'div',
  props: { id: 'root' },
  key: null,
  ref: null,
};
assert.equal(typeOf(domElement), Element, 'typeOf(domElement) must return Element symbol');
assert.equal(inspectTypeOf(domElement), Element, 'inspectTypeOf(domElement) must return Element symbol');

const fnComponentElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: function MyComponent() { return null; },
  props: {},
  key: null,
  ref: null,
};
assert.equal(typeOf(fnComponentElement), Element, 'typeOf(fnComponentElement) must return Element symbol');

// 3. Fragment element
const fragmentElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: REACT_FRAGMENT_TYPE,
  props: { children: [] },
  key: null,
  ref: null,
};
assert.equal(typeOf(fragmentElement), Fragment, 'typeOf(fragmentElement) must return Fragment symbol');

// 4. Portal object
const portalObject = {
  $$typeof: REACT_PORTAL_TYPE,
  key: null,
  children: [],
  containerInfo: {},
};
assert.equal(typeOf(portalObject), Portal, 'typeOf(portalObject) must return Portal symbol');

// 5. ContextProvider element
const providerElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: {
    $$typeof: REACT_CONTEXT_TYPE,
    _context: {},
  },
  props: { value: 'test' },
  key: null,
  ref: null,
};
assert.equal(typeOf(providerElement), ContextProvider, 'typeOf(providerElement) must return ContextProvider symbol');

// 6. ContextConsumer element
const consumerElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: {
    $$typeof: REACT_CONSUMER_TYPE,
  },
  props: { children: () => null },
  key: null,
  ref: null,
};
assert.equal(typeOf(consumerElement), ContextConsumer, 'typeOf(consumerElement) must return ContextConsumer symbol');

// 7. ForwardRef element
const forwardRefElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: {
    $$typeof: REACT_FORWARD_REF_TYPE,
    render: (props, ref) => null,
  },
  props: {},
  key: null,
  ref: null,
};
assert.equal(typeOf(forwardRefElement), ForwardRef, 'typeOf(forwardRefElement) must return ForwardRef symbol');

// 8. Lazy component element
const lazyElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: {
    $$typeof: REACT_LAZY_TYPE,
    _payload: {},
    _init: () => null,
  },
  props: {},
  key: null,
  ref: null,
};
assert.equal(typeOf(lazyElement), Lazy, 'typeOf(lazyElement) must return Lazy symbol');

// 9. Memo component element
const memoElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: {
    $$typeof: REACT_MEMO_TYPE,
    type: 'span',
    compare: null,
  },
  props: {},
  key: null,
  ref: null,
};
assert.equal(typeOf(memoElement), Memo, 'typeOf(memoElement) must return Memo symbol');

// 10. Profiler element
const profilerElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: REACT_PROFILER_TYPE,
  props: { id: 'app-profiler', onRender: () => {} },
  key: null,
  ref: null,
};
assert.equal(typeOf(profilerElement), Profiler, 'typeOf(profilerElement) must return Profiler symbol');

// 11. StrictMode element
const strictModeElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: REACT_STRICT_MODE_TYPE,
  props: { children: [] },
  key: null,
  ref: null,
};
assert.equal(typeOf(strictModeElement), StrictMode, 'typeOf(strictModeElement) must return StrictMode symbol');

// 12. Suspense element
const suspenseElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: REACT_SUSPENSE_TYPE,
  props: { fallback: null, children: [] },
  key: null,
  ref: null,
};
assert.equal(typeOf(suspenseElement), Suspense, 'typeOf(suspenseElement) must return Suspense symbol');

// 13. SuspenseList element
const suspenseListElement = {
  $$typeof: REACT_ELEMENT_TYPE,
  type: REACT_SUSPENSE_LIST_TYPE,
  props: { children: [] },
  key: null,
  ref: null,
};
assert.equal(typeOf(suspenseListElement), SuspenseList, 'typeOf(suspenseListElement) must return SuspenseList symbol');

// 14. Non-element values return undefined
assert.equal(typeOf({}), undefined, 'typeOf on empty object must return undefined');
assert.equal(typeOf({ type: 'div' }), undefined, 'typeOf on object without $$typeof must return undefined');
assert.equal(typeOf(null), undefined, 'typeOf on null must return undefined');
assert.equal(typeOf(undefined), undefined, 'typeOf on undefined must return undefined');
assert.equal(typeOf('div'), undefined, 'typeOf on string primitive must return undefined');
assert.equal(typeOf(12345), undefined, 'typeOf on number primitive must return undefined');
assert.equal(typeOf(true), undefined, 'typeOf on boolean primitive must return undefined');

console.log('Contract test for react-is.typeOf in pkg:npm/react-is@19.2.8 passed.');

Origin Seeder

anonymous