What would be the Typescript type for a module path? (for IDE autocompletion and static checking)

Viewed 27

I'm using Intellij IDEA on my Typescript project and I'm loading certain modules dynamically. Is there any way to set to a variable/argument a type that corresponds with a path to a module/file?

I'm asking because I'd like to have the same autocomplete and warnins/errors effect I'm having when using require function or import operators but on a variable. Something like:

const MODULE_PATH: Module_Path = '../my/Module/Path'

The alternative is using the type string.

I've inspected the editor's built-in types used by the require function and the argument type is a string. Is there any other way to achieve the desired effect in the editor?

0 Answers
Related