@typescript/analyze-trace
Version:
Analyze the output of tsc --generatetrace
23 lines • 916 B
JavaScript
;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
Object.defineProperty(exports, "__esModule", { value: true });
if (process.argv.length < 4) {
const path = require("path");
console.error(`Usage: ${path.basename(process.argv[0])} ${path.basename(process.argv[1])} type_path id+`);
process.exit(1);
}
const fs = require("fs");
const treeify = require("treeify");
const getTypeTree = require("./get-type-tree");
const typesPath = process.argv[2];
const ids = process.argv.slice(3).map(x => +x);
const json = fs.readFileSync(typesPath, { encoding: "utf-8" });
const types = JSON.parse(json);
console.log(ids.map(id => printType(id)).join("\n"));
function printType(id) {
const cache = new Map();
const tree = getTypeTree(id, cache, types);
return treeify.asTree(tree, /*showValues*/ false, /*hideFunctions*/ true);
}
//# sourceMappingURL=print-types.js.map