Sample
typescript 7.0.2: createIdentifier
Verified sample for npm typescript 7.0.2: createIdentifier. The contract ran on node 22 · linux alpine/x64 · docker and passed.
sha256:604216699166970828547eb7c9f020d723558fe2dd0b364ef37c9fe0e162acfc
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 linux 24 · ubuntu · glibc 2.39 x64 node node npm
Verification-run environments
| Environment | Contract | Stages | Run |
|---|---|---|---|
| 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-28 |
Case
HOW- Goal
- verify typescript.createIdentifier in pkg:npm/typescript@7.0.2
- Packages
- Symbols
-
- typescript.createIdentifier
- Environment
- node
- Created
- 2026-08-28T07:19:35Z
Contract
- createIdentifier creates an AST identifier node with SyntaxKind.Identifier and specified text
- createIdentifier supports varied naming patterns including camelCase, leading underscore, dollar prefix, and unicode
- isIdentifier distinguishes identifier nodes from private identifiers and token nodes
- createIdentifier nodes compose cleanly into PropertyAccessExpression, CallExpression, and VariableDeclaration nodes
Files
- NOTES.md
- PROMPT.md
- csx.json
- package-lock.json
- package.json
- spec.json
- src/index.mjs
- test/contract.mjs
Source
# TypeScript AST Node Creation with `typescript.createIdentifier`
## Pinned Version
- `typescript`: `7.0.2`
## Symbols Demonstrated
- `typescript.createIdentifier`
## Overview & Architecture
In TypeScript 7.0.2 (modular compiler architecture), AST node creation functions are exported from `typescript/unstable/ast/factory` and AST types and predicates from `typescript/unstable/ast`.
### Key Mechanics
1. **Identifier Node Creation (`createIdentifier`)**:
`createIdentifier(text)` constructs a `NodeObject` with `kind: SyntaxKind.Identifier` and stores the identifier's string name in `node.text`.
2. **AST Node Identification (`isIdentifier`)**:
`isIdentifier(node)` inspects the node kind and returns `true` exclusively for AST identifier nodes, distinguishing them from private identifiers (`#field`), tokens (`+`, `-`), expressions, and statements.
3. **Composite AST Construction**:
Identifier nodes created via `createIdentifier` can be composed into higher-level AST constructs such as:
- `createPropertyAccessExpression(expression, questionDotToken, name)`
- `createCallExpression(expression, questionDotToken, typeArguments, arguments)`
- `createVariableDeclaration(name, exclamationToken, type, initializer)`
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 typescript.createIdentifier in pkg:npm/typescript@7.0.2
Kind: HOW
Use EXACTLY these public packages and versions:
- pkg:npm/typescript@7.0.2
Demonstrate these symbols/APIs:
- typescript.createIdentifier
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:a2b580a91b88de3725ae536319c86a2a8b02cdf104d1ce922cbe86d500dae778","contract":["createIdentifier creates an AST identifier node with SyntaxKind.Identifier and specified text","createIdentifier supports varied naming patterns including camelCase, leading underscore, dollar prefix, and unicode","isIdentifier distinguishes identifier nodes from private identifiers and token nodes","createIdentifier nodes compose cleanly into PropertyAccessExpression, CallExpression, and VariableDeclaration nodes"],"goal":"verify typescript.createIdentifier in pkg:npm/typescript@7.0.2","kind":"HOW","packages":["pkg:npm/typescript@7.0.2"],"schemaVersion":1,"symbols":["typescript.createIdentifier"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","executionContext":"node","language":"node","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","runtime":"node","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/typescript@7.0.2"],"schemaVersion":1,"subject":"pkg:npm/typescript@7.0.2","symbols":["typescript.createIdentifier"],"verifierAdapter":"node-typescript@1"}
{
"name": "npm-typescript-create-identifier-7-0-2",
"version": "1.0.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "npm-typescript-create-identifier-7-0-2",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"typescript": "7.0.2"
},
"devDependencies": {}
},
"node_modules/@typescript/typescript-aix-ppc64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz",
"integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==",
"cpu": [
"ppc64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"aix"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-darwin-arm64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz",
"integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-darwin-x64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz",
"integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"darwin"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-freebsd-arm64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz",
"integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-freebsd-x64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz",
"integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"freebsd"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-linux-arm": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz",
"integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==",
"cpu": [
"arm"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-linux-arm64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz",
"integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-linux-loong64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz",
"integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==",
"cpu": [
"loong64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-linux-mips64el": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz",
"integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==",
"cpu": [
"mips64el"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-linux-ppc64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz",
"integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==",
"cpu": [
"ppc64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-linux-riscv64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz",
"integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==",
"cpu": [
"riscv64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-linux-s390x": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz",
"integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==",
"cpu": [
"s390x"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-linux-x64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz",
"integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"linux"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-netbsd-arm64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz",
"integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-netbsd-x64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz",
"integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"netbsd"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-openbsd-arm64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz",
"integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-openbsd-x64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz",
"integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"openbsd"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-sunos-x64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz",
"integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"sunos"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-win32-arm64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz",
"integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==",
"cpu": [
"arm64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/@typescript/typescript-win32-x64": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz",
"integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==",
"cpu": [
"x64"
],
"license": "Apache-2.0",
"optional": true,
"os": [
"win32"
],
"engines": {
"node": ">=16.20.0"
}
},
"node_modules/typescript": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz",
"integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==",
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc"
},
"engines": {
"node": ">=16.20.0"
},
"optionalDependencies": {
"@typescript/typescript-aix-ppc64": "7.0.2",
"@typescript/typescript-darwin-arm64": "7.0.2",
"@typescript/typescript-darwin-x64": "7.0.2",
"@typescript/typescript-freebsd-arm64": "7.0.2",
"@typescript/typescript-freebsd-x64": "7.0.2",
"@typescript/typescript-linux-arm": "7.0.2",
"@typescript/typescript-linux-arm64": "7.0.2",
"@typescript/typescript-linux-loong64": "7.0.2",
"@typescript/typescript-linux-mips64el": "7.0.2",
"@typescript/typescript-linux-ppc64": "7.0.2",
"@typescript/typescript-linux-riscv64": "7.0.2",
"@typescript/typescript-linux-s390x": "7.0.2",
"@typescript/typescript-linux-x64": "7.0.2",
"@typescript/typescript-netbsd-arm64": "7.0.2",
"@typescript/typescript-netbsd-x64": "7.0.2",
"@typescript/typescript-openbsd-arm64": "7.0.2",
"@typescript/typescript-openbsd-x64": "7.0.2",
"@typescript/typescript-sunos-x64": "7.0.2",
"@typescript/typescript-win32-arm64": "7.0.2",
"@typescript/typescript-win32-x64": "7.0.2"
}
}
}
}
{
"name": "npm-typescript-create-identifier-7-0-2",
"version": "1.0.0",
"type": "module",
"scripts": {
"test": "node test/contract.mjs"
},
"dependencies": {
"typescript": "7.0.2"
}
}
{
"schemaVersion": 1,
"goal": "verify typescript.createIdentifier in pkg:npm/typescript@7.0.2",
"kind": "HOW",
"packages": [
"pkg:npm/typescript@7.0.2"
],
"symbols": [
"typescript.createIdentifier"
]
}
import {
createIdentifier,
createPrivateIdentifier,
createToken,
createCallExpression,
createPropertyAccessExpression,
createVariableDeclaration,
createNumericLiteral
} from 'typescript/unstable/ast/factory';
import {
SyntaxKind,
isIdentifier,
isPrivateIdentifier,
isCallExpression,
isPropertyAccessExpression,
isVariableDeclaration
} from 'typescript/unstable/ast';
/**
* Creates an Identifier AST node with the given name.
* @param {string} name
* @returns {any}
*/
export function buildIdentifier(name) {
return createIdentifier(name);
}
/**
* Checks if a given AST node is an Identifier.
* @param {any} node
* @returns {boolean}
*/
export function checkIsIdentifier(node) {
return isIdentifier(node);
}
/**
* Creates a PropertyAccessExpression using identifier nodes for receiver and member.
* @param {string} receiverName
* @param {string} memberName
* @returns {any}
*/
export function buildPropertyAccess(receiverName, memberName) {
const receiver = createIdentifier(receiverName);
const member = createIdentifier(memberName);
return createPropertyAccessExpression(receiver, undefined, member);
}
/**
* Creates a CallExpression targeting a method on an object.
* @param {string} receiverName
* @param {string} memberName
* @param {string[]} argIdentifierNames
* @returns {any}
*/
export function buildMethodCall(receiverName, memberName, argIdentifierNames = []) {
const propAccess = buildPropertyAccess(receiverName, memberName);
const args = argIdentifierNames.map((arg) => createIdentifier(arg));
return createCallExpression(propAccess, undefined, undefined, args);
}
/**
* Creates a VariableDeclaration with an Identifier name and a numeric literal initializer.
* @param {string} varName
* @param {string|number} numericValue
* @returns {any}
*/
export function buildNumericVariableDeclaration(varName, numericValue) {
const nameId = createIdentifier(varName);
const initializer = createNumericLiteral(String(numericValue));
return createVariableDeclaration(nameId, undefined, undefined, initializer);
}
export {
createIdentifier,
createPrivateIdentifier,
createToken,
createCallExpression,
createPropertyAccessExpression,
createVariableDeclaration,
createNumericLiteral,
SyntaxKind,
isIdentifier,
isPrivateIdentifier,
isCallExpression,
isPropertyAccessExpression,
isVariableDeclaration
};
import { strict as assert } from 'node:assert';
import {
createIdentifier,
createPrivateIdentifier,
createToken,
SyntaxKind,
isIdentifier,
isPrivateIdentifier,
isCallExpression,
isPropertyAccessExpression,
isVariableDeclaration,
buildIdentifier,
checkIsIdentifier,
buildPropertyAccess,
buildMethodCall,
buildNumericVariableDeclaration
} from '../src/index.mjs';
// 1. Verify createIdentifier exists and is a callable function
assert.strictEqual(typeof createIdentifier, 'function', 'createIdentifier must be a function');
assert.strictEqual(typeof isIdentifier, 'function', 'isIdentifier must be a function');
// 2. Verify basic identifier node creation and properties
const id = createIdentifier('totalCount');
assert.strictEqual(id.kind, SyntaxKind.Identifier, 'Identifier kind must equal SyntaxKind.Identifier');
assert.strictEqual(id.text, 'totalCount', 'Identifier text must match input');
assert.strictEqual(isIdentifier(id), true, 'isIdentifier must return true for identifier node');
assert.strictEqual(checkIsIdentifier(id), true, 'checkIsIdentifier wrapper must return true');
// 3. Verify naming support across various valid identifier formats
const testNames = ['camelCaseVar', 'PascalCaseClass', '_internalPrefix', '$reactiveValue', 'unicode식별자'];
for (const name of testNames) {
const created = buildIdentifier(name);
assert.strictEqual(created.kind, SyntaxKind.Identifier, `kind for ${name} must be Identifier`);
assert.strictEqual(created.text, name, `text for ${name} must match`);
assert.strictEqual(isIdentifier(created), true, `isIdentifier must be true for ${name}`);
}
// 4. Verify discrimination against non-identifier AST nodes
const privId = createPrivateIdentifier('#secretField');
assert.strictEqual(privId.kind, SyntaxKind.PrivateIdentifier, 'PrivateIdentifier must have SyntaxKind.PrivateIdentifier');
assert.strictEqual(isPrivateIdentifier(privId), true, 'isPrivateIdentifier must return true');
assert.strictEqual(isIdentifier(privId), false, 'isIdentifier must return false for PrivateIdentifier');
const plusToken = createToken(SyntaxKind.PlusToken);
assert.strictEqual(isIdentifier(plusToken), false, 'isIdentifier must return false for Token');
// 5. Verify composition in PropertyAccessExpression
const propAccess = buildPropertyAccess('console', 'log');
assert.strictEqual(isPropertyAccessExpression(propAccess), true, 'Must create PropertyAccessExpression');
assert.strictEqual(isIdentifier(propAccess.expression), true, 'Target must be Identifier');
assert.strictEqual(propAccess.expression.text, 'console', 'Target name must match');
assert.strictEqual(isIdentifier(propAccess.name), true, 'Property must be Identifier');
assert.strictEqual(propAccess.name.text, 'log', 'Property name must match');
// 6. Verify composition in CallExpression with identifier arguments
const callExpr = buildMethodCall('logger', 'info', ['payload', 'timestamp']);
assert.strictEqual(isCallExpression(callExpr), true, 'Must create CallExpression');
assert.strictEqual(callExpr.arguments.length, 2, 'Must have 2 arguments');
assert.strictEqual(callExpr.arguments[0].text, 'payload', 'First arg must be payload');
assert.strictEqual(callExpr.arguments[1].text, 'timestamp', 'Second arg must be timestamp');
assert.strictEqual(isIdentifier(callExpr.arguments[0]), true, 'First arg must be Identifier');
assert.strictEqual(isIdentifier(callExpr.arguments[1]), true, 'Second arg must be Identifier');
// 7. Verify composition in VariableDeclaration
const varDecl = buildNumericVariableDeclaration('maxRetries', 5);
assert.strictEqual(isVariableDeclaration(varDecl), true, 'Must create VariableDeclaration');
assert.strictEqual(isIdentifier(varDecl.name), true, 'Variable name node must be Identifier');
assert.strictEqual(varDecl.name.text, 'maxRetries', 'Variable name must match');
assert.strictEqual(varDecl.initializer.text, '5', 'Initializer value must match');
console.log('CONTRACT PASS: typescript.createIdentifier verified in pkg:npm/typescript@7.0.2');
Origin Seeder
anonymous