我正在尝试创建一个TypeScript文档生成器,但为了实现这一目标,我需要将TypeScript文件解析为更易于阅读的格式。
EX:
EX:
"Command": {
"description": "A command object for the command handler",
"constructor": [
{
"name": "name",
"type": "string",
"optional": false,
"default": null,
"description": "Name of the command"
},
{
"name": "callback",
"type": "(event: CommandContext) => void",
"optional": false,
"default": null,
"description": "Callback for the command"
}
],
"properties": [
{
"name": "name",
"description": "Name of the command",
"type": "string"
},
{
"name": "fullname",
"description": "Fullname of the command",
"type": "string"
}
],
"methods": [
{
"name": "canRun",
"description": "Checks all permission checks and verifies if a command can be run",
"parameters": [
{
"name": "context",
"type": "CommandContext",
"optional": false,
"default": null,
"description": "The context for the command",
"returns": "PermissionCheckResult"
}
]
}
],
"events": null
}
可能来自于这样的东西
export declare class Command {
/**
* Name of the command
*/
name: string;
/**
* Fullname of the command
*/
fullname: string;
/**
* Create a command
* @param name - Name of the command
* @param callback - Callback for the command
*/
constructor(name: string, callback: (event: CommandContext) => void);
/**
* Checks all permission checks and verifies if a command can be run
* @param context - The context for the command
*/
canRun(context: CommandContext): boolean;
}
我该如何实现这一点,最好在浏览器中,但如果不可能的话,我也可以使用node.js完成