Proper way to import modules in typescript

Proper way to import modules in typescript

I have tested several ways to import modules from other files, the one I prefer is
import CustomModule from "CustomModule"
as it does not require the whole path for the file. However, this method makes the type checking in typescript not working as it cannot find the module.
Another way is
import CustomModule from "./Test/CustomModule"
this way the type checking works, but now it is not as flexible as the previous method as the whole relative path is required.

Is there any way to utilize the advantage of the two methods? (Flexible for importing and keeps type checking)

I also kept some methods from js
const CustomModule = require("CustomModule")
but of course this is not ideal and cannot perform type checking