I write TypeScript in vim and don't wish to run proprietary software, save for a few games on a machine dedicated for that purpose.
It works simply by adding this line on the top or bottom:
/* vim:set filetype=javascript: */
You can add other options in there as well, so it's easy for others to match your indentation style for instance.