TypeScript/debug-ast.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

21 lines
616 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);
console.log(`${prefix}${ts.SyntaxKind[node.kind]}`);
if (ts.isTypeOperatorNode(node)) {
console.log(`${prefix} operator: ${ts.SyntaxKind[node.operator]}`);
console.log(`${prefix} type: ${ts.SyntaxKind[node.type.kind]}`);
}
ts.forEachChild(node, child => printNode(child, indent + 1));
}
printNode(sourceFile);