Sample
type-check 0.4.0: typeCheck
Verified sample for npm type-check 0.4.0: typeCheck. The contract ran on node 22 · linux debian/x64 · docker and passed: assert typeCheck validates primitive…
sha256:d3ae5026f10bbd1d07e98598f0ebf8532277e2eb6ebaf45c20eea140d333e1e4
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-05 |
Case
HOW- Goal
- verify type-check.typeCheck in pkg:npm/type-check@0.4.0
- Packages
- Symbols
-
- type-check.typeCheck
- Environment
- node 22.23.2
- Created
- 2026-09-05T19:02:06Z
Contract
- assert typeCheck validates primitive types (Number, String, Boolean, Undefined, Null, Array, Object, RegExp)
- assert typeCheck rejects mismatched primitive types
- assert typeCheck validates union types and wildcard expressions
- assert typeCheck validates array and tuple structures
- assert typeCheck validates closed object records, optional fields with Maybe, and open records with ...
- assert typeCheck supports custom type specifications via customTypes option
Files
- PROMPT.md
- csx.json
- index.js
- package-lock.json
- package.json
- spec.json
- test/contract.js
Source
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 type-check.typeCheck in pkg:npm/type-check@0.4.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/type-check@0.4.0
Demonstrate these symbols/APIs:
- type-check.typeCheck
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:21dc7eb599ffb1bef9a6e16d8ad34c55fa0efe350b9c3cf12e0ba1d14cb5c610","contract":["assert typeCheck validates primitive types (Number, String, Boolean, Undefined, Null, Array, Object, RegExp)","assert typeCheck rejects mismatched primitive types","assert typeCheck validates union types and wildcard expressions","assert typeCheck validates array and tuple structures","assert typeCheck validates closed object records, optional fields with Maybe, and open records with ...","assert typeCheck supports custom type specifications via customTypes option"],"goal":"verify type-check.typeCheck in pkg:npm/type-check@0.4.0","kind":"HOW","packages":["pkg:npm/type-check@0.4.0"],"schemaVersion":1,"symbols":["type-check.typeCheck"]},"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/type-check@0.4.0"],"schemaVersion":1,"subject":"pkg:npm/type-check@0.4.0","symbols":["type-check.typeCheck"],"verifierAdapter":"node-typescript@1"}
const { typeCheck } = require('type-check');
module.exports = {
typeCheck,
};
{
"name": "sample-2765681028",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "sample-2765681028",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"type-check": "0.4.0"
}
},
"node_modules/prelude-ls": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
"license": "MIT",
"engines": {
"node": ">= 0.8.0"
}
},
"node_modules/type-check": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
"integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
"license": "MIT",
"dependencies": {
"prelude-ls": "^1.2.1"
},
"engines": {
"node": ">= 0.8.0"
}
}
}
}
{
"name": "sample-2765681028",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "node test/contract.js"
},
"license": "MIT-0",
"dependencies": {
"type-check": "0.4.0"
}
}
{
"schemaVersion": 1,
"goal": "verify type-check.typeCheck in pkg:npm/type-check@0.4.0",
"kind": "HOW",
"packages": [
"pkg:npm/type-check@0.4.0"
],
"symbols": [
"type-check.typeCheck"
]
}
const assert = require('node:assert');
const { typeCheck } = require('type-check');
// 1. Primitive types validation
assert.strictEqual(typeCheck('Number', 42), true, 'Number should match integer 42');
assert.strictEqual(typeCheck('Number', 3.14), true, 'Number should match float 3.14');
assert.strictEqual(typeCheck('String', 'hello'), true, 'String should match string');
assert.strictEqual(typeCheck('Boolean', true), true, 'Boolean should match true');
assert.strictEqual(typeCheck('Boolean', false), true, 'Boolean should match false');
assert.strictEqual(typeCheck('Undefined', undefined), true, 'Undefined should match undefined');
assert.strictEqual(typeCheck('Null', null), true, 'Null should match null');
assert.strictEqual(typeCheck('Array', [1, 2, 3]), true, 'Array should match array');
assert.strictEqual(typeCheck('Object', { key: 'val' }), true, 'Object should match object');
assert.strictEqual(typeCheck('RegExp', /abc/), true, 'RegExp should match regular expression');
// 2. Mismatched primitive types rejection
assert.strictEqual(typeCheck('Number', '42'), false, 'Number should reject string "42"');
assert.strictEqual(typeCheck('String', 123), false, 'String should reject number 123');
assert.strictEqual(typeCheck('Boolean', 'true'), false, 'Boolean should reject string "true"');
assert.strictEqual(typeCheck('Undefined', null), false, 'Undefined should reject null');
assert.strictEqual(typeCheck('Null', undefined), false, 'Null should reject undefined');
// 3. Union types and wildcard expressions
assert.strictEqual(typeCheck('Number | String', 10), true, 'Union should match Number');
assert.strictEqual(typeCheck('Number | String', 'sample'), true, 'Union should match String');
assert.strictEqual(typeCheck('Number | String', false), false, 'Union should reject Boolean');
assert.strictEqual(typeCheck('count::Number', 5), true, 'Comment syntax should be ignored and pass validation');
assert.strictEqual(typeCheck('*', { any: 'value' }), true, 'Wildcard should match object');
assert.strictEqual(typeCheck('*', 123), true, 'Wildcard should match primitive');
// 4. Array and tuple structures
assert.strictEqual(typeCheck('[Number]', [1, 2, 3]), true, 'Homogeneous array [Number] should pass');
assert.strictEqual(typeCheck('[Number]', [1, '2', 3]), false, 'Homogeneous array [Number] should fail with mixed types');
assert.strictEqual(typeCheck('(String, Number)', ['alice', 30]), true, 'Tuple (String, Number) should match 2 elements');
assert.strictEqual(typeCheck('(String, Number)', ['alice']), false, 'Tuple should fail on missing elements');
assert.strictEqual(typeCheck('(String, Number)', ['alice', 30, true]), false, 'Tuple should fail on extra elements');
// 5. Closed object records, optional fields with Maybe, and open records with ...
assert.strictEqual(typeCheck('{name: String, age: Number}', { name: 'Alice', age: 30 }), true, 'Exact object fields should match');
assert.strictEqual(typeCheck('{name: String, age: Number}', { name: 'Alice' }), false, 'Missing non-maybe field should fail');
assert.strictEqual(typeCheck('{name: String, age: Maybe Number}', { name: 'Alice' }), true, 'Missing maybe field should pass');
assert.strictEqual(typeCheck('{name: String, age: Maybe Number}', { name: 'Alice', age: null }), true, 'Null maybe field should pass');
assert.strictEqual(typeCheck('{name: String}', { name: 'Alice', extra: 99 }), false, 'Closed object should reject extraneous fields');
assert.strictEqual(typeCheck('{name: String, ...}', { name: 'Alice', extra: 99 }), true, 'Open record (...) should accept extraneous fields');
// 6. Custom type specifications via customTypes option
const options = {
customTypes: {
Even: {
typeOf: 'Number',
validate: (x) => x % 2 === 0,
},
},
};
assert.strictEqual(typeCheck('Even', 4, options), true, 'Custom type Even matches 4');
assert.strictEqual(typeCheck('Even', 5, options), false, 'Custom type Even rejects 5');
assert.strictEqual(typeCheck('Even', '4', options), false, 'Custom type Even rejects non-Number');
console.log('Contract assertions passed.');
Origin Seeder
anonymous