提问人:cj- 提问时间:1/2/2023 更新时间:1/2/2023 访问量:85
为多个文件添加导出定义
Add export definitions for multiple files
问:
我的目标是将类型添加到现有 JS 项目中,以实现智能感知 (Visual Studio Code)。有几个文件(每个“命令”一个)都需要导出相同的内容。
这些类型旨在保持独立(仅出现在代码注释和外部文件中)。我有一个定义文件。每个命令文件都引用相同的定义文件。
但从结果来看,源文件中没有选取任何类型信息(代码未暗示)。这是这样做的正确方法吗,做错了什么?
命令:
/// <reference path="../cmd.d.ts" />
export const cmd = new SlashCommandBuilder();
// Does not say what pnone was supposed to return
export const perms = pnone()
// Does not know what interactions is or the return type
export async function execute(interaction) {
}
定义(cmd.d.ts):
export const cmd: SlashCommandBuilder
export const perms: (interaction: Interaction) => boolean
export async function execute(interaction: Interaction): Promise<void>
答: 暂无答案
评论