My server index.ts
file import consoleColorFy.ts
consoleColorFy.ts
declare global {
interface Console {
redBg: TConsoleFn;
}
}
console["redBg"] = ...
Now i can use console.redBg()
.
It works well in most time but when hot-reload some server's file
I got this error.
Property 'redBg' does not exist on type 'Console'.
>> console.redBg("error", error);
consoleColorFy.ts
, which is imported first, will always work because all code starts from index.ts
.
But when ts-node-dev
run hot-reloaded
by change of code, it seems to only rework some file. and it dose not recognise my consoleColorFy.ts
Hum.... any advice?
"ts-node-dev --respawn --no-notify --rs src/index.ts --env=dev"
It works well when I restart server
Or when the refreshed file is index.ts
you can add --files
, it works for me.