When working with TypeScript, errors will be properly triggered if trying to execute the following:
import * as path from "path"
let path = path.join("a", "b", "c")
The reason for this error is that it causes a conflict with the local declaration of 'path'.
There are essentially two solutions to this issue:
- Importing the
path
module using a different name. - Avoiding using
path
as a variable name.
This kind of conflict appears to be quite common. I am not very familiar with popular coding conventions in TypeScript. Are there any recommended practices for handling such conflicts according to standard coding conventions?
In particular, if choosing option 1, is there a widely used scheme for renaming modules, such as pathMod
, mPath
, m_path
, or path_module
?