我的服务器index.ts文件导入consoleColorFy.ts
consoleColorFy.ts
declare global {
interface Console {
redBg: TConsoleFn;
}
}
console["redBg"] = ...现在我可以使用console.redBg()了。
在大多数情况下运行良好,但是当热重新加载某个服务器的文件时
我犯了这个错误。
Property 'redBg' does not exist on type 'Console'.
>> console.redBg("error", error);首先导入的consoleColorFy.ts将始终工作,因为所有代码都是从index.ts开始的。
但是,当ts-node-dev通过更改代码运行hot-reloaded时,它似乎只是重做一些文件。也认不出我的consoleColorFy.ts Hum.有什么建议吗?
"ts-node-dev --respawn --no-notify --rs src/index.ts --env=dev"
当我重新启动服务器时,它运行良好。
或者当刷新的文件是index.ts时
发布于 2022-12-01 14:33:13
你可以添加--files,它适用于我。
https://stackoverflow.com/questions/71492193
复制相似问题