Hi! I need to write something that accesses the hot reloading in vite.. How can I introduce the correct types in my TypeScript project? As of correct types, an example is in an order.. I'm trying to do something like this:
/* @refresh reload */
import { init } from "./index.js";
import { frag } from "./shaders/frag.js";
const chassis = init({ fragSrc: frag });
if (chassis) {
chassis.run();
if (import.meta.hot) {
import.meta.hot.accept(
"./shaders/frag",
// WHAT TO TYPE HERE?! WHERE TO OBTAIN THE CORRECT TYPES?!?!
(mod?: unknown) => {
if (mod) {
// EWWWWW!!!
const { frag } = mod as { frag: string };
console.log("Reloading shader modules!");
chassis.reload(frag);
chassis.run();
}
},
);
}
}