TypeScript/debug-ast2.mjs
copilot-swe-agent[bot] c0ff10a906 Initial plan for fixing keyof crash
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
2026-01-16 17:33:46 +00:00

24 lines
632 B
JavaScript

import * as ts from "./built/local/typescript.js";
const sourceFile = ts.createSourceFile(
"test.ts",
`const { c, f }: keyof = { c: 0, f };`,
ts.ScriptTarget.Latest,
true
);
function printNode(node, indent = 0) {
const prefix = " ".repeat(indent);
let info = `${prefix}${ts.SyntaxKind[node.kind]}`;
if (ts.isTypeOperatorNode(node)) {
info += ` (operator: ${ts.SyntaxKind[node.operator]})`;
}
if (ts.isIdentifier(node)) {
info += ` (text: "${node.text}")`;
}
console.log(info);
ts.forEachChild(node, child => printNode(child, indent + 1));
}
printNode(sourceFile);