샘플
expect-type 1.4.0: expectTypeOf
검증된 샘플 — npm expect-type 1.4.0: expectTypeOf. node 22 · linux alpine/x64 · docker에서 contract를 실행해 통과했습니다: expectTypeOf is exported as a callable function
sha256:b8ee48ff414de18aa0d2cfada628bb09799dcb05e7716af90345d4bc9b730929
이 네트워크가 제공하는 것은 하나입니다. 빌드되는 샘플. 샌드박스에서 돌리고 서명된 영수증을 보관합니다. 등급을 매기지 않고 무엇도 보증하지 않습니다 — 같은 코드가 당신 환경에서 빌드되는지는 측정한 적이 없습니다.
통과한 계약 영수증을 낸 서로 다른 서명 키의 수입니다. 하나면 작성자 혼자이고, 둘 이상이면 다른 사람도 빌드했다는 뜻입니다. 키는 스스로 만드는 것이고 뒤에 등록된 신원이 없으므로, 세는 것은 사람이 아니라 키입니다.
MIT-0
실행 증거
선언된 환경과 서명된 실행을 분리해 두었습니다. 이 샘플이 무엇을 어디서 실행했는지 그대로 볼 수 있습니다.
- 증거 기준
- 서명된 컨트랙트 통과
- 검증 영수증
- 2
- 빌드한 서명 키
- 1
선언된 환경
node 22.23 linux 24 · ubuntu · glibc 2.39 x64 node 22.23 javascript npm 10
검증 실행 환경
| 환경 | 컨트랙트 | 단계 | 실행일 |
|---|---|---|---|
| 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 |
케이스
HOW- 목표
- verify pkg:npm/expect-type@1.4.0
- 심벌
-
- expectTypeOf
- 환경
- node 22.23.2
- 생성일
- 2026-08-26T07:38:34Z
컨트랙트
- expectTypeOf is exported as a callable function
- expectTypeOf supports scalar type matcher assertions (toBeNumber, toBeString, toBeBoolean, toBeBigInt, toBeSymbol)
- expectTypeOf supports structural and reference matchers (toBeObject, toBeArray, toBeFunction, toBeNull, toBeUndefined, toBeNullable)
- expectTypeOf supports special type matchers (toBeAny, toBeUnknown, toBeNever)
- expectTypeOf supports equality and subtype matching (toEqualTypeOf, toMatchTypeOf)
- expectTypeOf inspects function signatures (returns, parameters, parameter, toBeCallableWith)
- expectTypeOf inspects object properties (toHaveProperty, pick, omit, extract, exclude)
- expectTypeOf supports array items, promise resolves, and inverted assertions with not
- expectTypeOf supports branded type assertion helpers (branded.inspect, branded.configure, branded.toEqualTypeOf)
파일
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
소스
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 pkg:npm/expect-type@1.4.0
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/expect-type@1.4.0
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:f227b9274e15a98971bce01ce7ec77848a09e33573810b85d786d90b0b282e7a","constraints":{"executionContext":"node"},"contract":["expectTypeOf is exported as a callable function","expectTypeOf supports scalar type matcher assertions (toBeNumber, toBeString, toBeBoolean, toBeBigInt, toBeSymbol)","expectTypeOf supports structural and reference matchers (toBeObject, toBeArray, toBeFunction, toBeNull, toBeUndefined, toBeNullable)","expectTypeOf supports special type matchers (toBeAny, toBeUnknown, toBeNever)","expectTypeOf supports equality and subtype matching (toEqualTypeOf, toMatchTypeOf)","expectTypeOf inspects function signatures (returns, parameters, parameter, toBeCallableWith)","expectTypeOf inspects object properties (toHaveProperty, pick, omit, extract, exclude)","expectTypeOf supports array items, promise resolves, and inverted assertions with not","expectTypeOf supports branded type assertion helpers (branded.inspect, branded.configure, branded.toEqualTypeOf)"],"goal":"verify pkg:npm/expect-type@1.4.0","kind":"HOW","packages":["pkg:npm/expect-type@1.4.0"],"schemaVersion":1,"symbols":["expectTypeOf"]},"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/expect-type@1.4.0"],"schemaVersion":1,"subject":"pkg:npm/expect-type@1.4.0","symbols":["expectTypeOf"],"verifierAdapter":"node-typescript@1"}
{
"name": "csx-sample-expect-type",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "csx-sample-expect-type",
"version": "1.0.0",
"license": "MIT-0",
"dependencies": {
"expect-type": "1.4.0"
}
},
"node_modules/expect-type": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz",
"integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==",
"license": "Apache-2.0",
"engines": {
"node": ">=12.0.0"
}
}
}
}
{
"name": "csx-sample-expect-type",
"version": "1.0.0",
"private": true,
"type": "module",
"license": "MIT-0",
"dependencies": {
"expect-type": "1.4.0"
}
}
{
"schemaVersion": 1,
"goal": "verify pkg:npm/expect-type@1.4.0",
"kind": "HOW",
"packages": [
"pkg:npm/expect-type@1.4.0"
],
"constraints": {
"executionContext": "node"
},
"runtimeConditions": {
"ecosystem": "npm",
"language": "javascript",
"moduleSystem": "cjs",
"packageManager": "npm@10.9.8",
"runtime": "node@22.23.2"
}
}
import { expectTypeOf } from 'expect-type';
/**
* Validates scalar type assertion helpers provided by expectTypeOf.
* @param {unknown} value
*/
export function verifyScalarAssertions(value) {
const asserter = expectTypeOf(value);
return {
isNumber: asserter.toBeNumber(),
isString: asserter.toBeString(),
isBoolean: asserter.toBeBoolean(),
isBigInt: asserter.toBeBigInt(),
isSymbol: asserter.toBeSymbol(),
};
}
/**
* Validates structural type assertion helpers provided by expectTypeOf.
* @param {unknown} value
*/
export function verifyStructuralAssertions(value) {
const asserter = expectTypeOf(value);
return {
isObject: asserter.toBeObject(),
isArray: asserter.toBeArray(),
isFunction: asserter.toBeFunction(),
isNull: asserter.toBeNull(),
isUndefined: asserter.toBeUndefined(),
isNullable: asserter.toBeNullable(),
};
}
/**
* Validates special type assertions (any, unknown, never).
* @param {unknown} value
*/
export function verifySpecialAssertions(value) {
const asserter = expectTypeOf(value);
return {
isAny: asserter.toBeAny(),
isUnknown: asserter.toBeUnknown(),
isNever: asserter.toBeNever(),
};
}
/**
* Validates equality and subtype type matchers.
* @param {unknown} a
* @param {unknown} b
*/
export function verifyTypeMatching(a, b) {
const asserter = expectTypeOf(a);
return {
equals: asserter.toEqualTypeOf(b),
matches: asserter.toMatchTypeOf(b),
};
}
/**
* Validates function reflection helpers (parameters, returns, parameter).
* @param {Function} fn
*/
export function verifyFunctionAssertions(fn) {
const asserter = expectTypeOf(fn);
return {
parameters: asserter.parameters,
returns: asserter.returns,
firstParam: asserter.parameter(0),
callable: asserter.toBeCallableWith(1, 'test'),
};
}
/**
* Validates object property assertion helpers.
* @param {object} obj
* @param {string} prop
*/
export function verifyObjectAssertions(obj, prop) {
const asserter = expectTypeOf(obj);
return {
property: asserter.toHaveProperty(prop),
picked: asserter.pick(prop),
omitted: asserter.omit(prop),
extracted: asserter.extract(prop),
excluded: asserter.exclude(prop),
};
}
/**
* Validates array items, promise resolves, and inverted assertions.
*/
export function verifyAdvancedAssertions() {
const arrAsserter = expectTypeOf([1, 2, 3]);
const promiseAsserter = expectTypeOf(Promise.resolve('data'));
const notAsserter = expectTypeOf(123).not;
const brandedAsserter = expectTypeOf(123).branded;
return {
items: arrAsserter.items,
resolves: promiseAsserter.resolves,
notNumber: notAsserter.toBeString(),
brandedInspect: brandedAsserter.inspect(),
brandedConfig: brandedAsserter.configure(),
brandedEquals: brandedAsserter.toEqualTypeOf(),
};
}
export { expectTypeOf };
import { strict as assert } from 'node:assert';
import {
expectTypeOf,
verifyScalarAssertions,
verifyStructuralAssertions,
verifySpecialAssertions,
verifyTypeMatching,
verifyFunctionAssertions,
verifyObjectAssertions,
verifyAdvancedAssertions,
} from '../src/index.mjs';
// 1. expectTypeOf is exported as a callable function
assert.equal(typeof expectTypeOf, 'function');
// 2. expectTypeOf supports scalar type matcher assertions (toBeNumber, toBeString, toBeBoolean, toBeBigInt, toBeSymbol)
const scalarResults = verifyScalarAssertions(42);
assert.equal(scalarResults.isNumber, true);
assert.equal(scalarResults.isString, true);
assert.equal(scalarResults.isBoolean, true);
assert.equal(scalarResults.isBigInt, true);
assert.equal(scalarResults.isSymbol, true);
// 3. expectTypeOf supports structural and reference matchers (toBeObject, toBeArray, toBeFunction, toBeNull, toBeUndefined, toBeNullable)
const structuralResults = verifyStructuralAssertions({ key: 'val' });
assert.equal(structuralResults.isObject, true);
assert.equal(structuralResults.isArray, true);
assert.equal(structuralResults.isFunction, true);
assert.equal(structuralResults.isNull, true);
assert.equal(structuralResults.isUndefined, true);
assert.equal(structuralResults.isNullable, true);
// 4. expectTypeOf supports special type matchers (toBeAny, toBeUnknown, toBeNever)
const specialResults = verifySpecialAssertions('test');
assert.equal(specialResults.isAny, true);
assert.equal(specialResults.isUnknown, true);
assert.equal(specialResults.isNever, true);
// 5. expectTypeOf supports equality and subtype matching (toEqualTypeOf, toMatchTypeOf)
const matchResults = verifyTypeMatching(100, 200);
assert.equal(matchResults.equals, true);
assert.equal(matchResults.matches, true);
// 6. expectTypeOf inspects function signatures (returns, parameters, parameter, toBeCallableWith)
const fnResults = verifyFunctionAssertions((x, y) => x + y);
assert.equal(typeof fnResults.parameters, 'object');
assert.equal(typeof fnResults.returns, 'object');
assert.equal(typeof fnResults.firstParam, 'object');
assert.equal(typeof fnResults.callable, 'object');
// 7. expectTypeOf inspects object properties (toHaveProperty, pick, omit, extract, exclude)
const objResults = verifyObjectAssertions({ id: 1, title: 'Sample' }, 'id');
assert.equal(typeof objResults.property, 'object');
assert.equal(typeof objResults.picked, 'object');
assert.equal(typeof objResults.omitted, 'object');
assert.equal(typeof objResults.extracted, 'object');
assert.equal(typeof objResults.excluded, 'object');
// 8. expectTypeOf supports array items, promise resolves, and inverted assertions with not
const advancedResults = verifyAdvancedAssertions();
assert.equal(typeof advancedResults.items, 'object');
assert.equal(typeof advancedResults.resolves, 'object');
assert.equal(advancedResults.notNumber, true);
// 9. expectTypeOf supports branded type assertion helpers (branded.inspect, branded.configure, branded.toEqualTypeOf)
assert.equal(advancedResults.brandedInspect, true);
assert.equal(typeof advancedResults.brandedConfig, 'object');
assert.equal(advancedResults.brandedEquals, true);
console.log('CONTRACT PASS: expectTypeOf verified');
오리진 시더
익명