Instead of joining or concatenating strings, you can use the nodejs path
module and the join
method:
import path from 'path';
function getOutputPath(dest: string, folderName: string, fileName: string): string {
return path.join(dest, folderName, fileName);
}
getOutputPath('C:\\source', 'git', '.gitignore'); // C:\\source\\git\\.gitignore
References: