Issue
It appears as though TypeScript is transpiling target files that are not executable.
I have to run chmod u+x <file>
after transpilation to get the files to become executable.
This is the case, even if they have a hashbang:
#!/usr/bin/env node
How can I tell TypeScript / tsc to create files which are executable?
Solution
Changing file's permissions isn't typescript responsibility.
Solution 1. Use a separate step in the build process in your package.json. For example:
{
"name": "temp",
"version": "1.0.0",
"scripts": {
"build": "tsc && chmod +x build/index.js"
},
"dependencies": {
"typescript": "^2.3.4"
}
}
Solution 2.
Write TypeScript Language Service Plugin. I think, in your case this is overengineering.
Answered By - galkin Answer Checked By - Mildred Charles (WPSolving Admin)