The problem I've had using the typescript syntax checker involve the arguments flags that are passed to the typescript compiler (tsc binary).
The tsc binary does not have tsconfig.json support if any flag was passed to it, so I recommend that at least the default behaviour should be configurable by end-users.
Currently, this line is the problem: tsc.vim#L43
As there's no target give, people will always get the annoying legacy errors like:
error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
These flags should be configurable, so I would suggest these two variables in order to influence the behaviour:
let g:syntastic_typescript_module = 'commonjs';
let g:syntastic_typescript_target = 'es2015';
What do you think about that suggestion? Good/Bad?
If the suggestion would get accepted by @scrooloose or @jb55, I would love to implement it and create a pull request for it. Not sure where it's necessary to document this, though.
These flags should be configurable
They are, and the manual is supposed to tell you how: :h syntastic-config-makeprg. If that isn't clear, I'll consider patches to the manual.
I figured out that the problem in my setup is a mix from my personal config vs. the project config. The syntastic makerpg flags worked and I have it working now.
But I think the conceptual problem is a bit different, as the project has a tsconfig.json file that differs from my personal setup. Is there any way to use auto-generated flags by the project's tsconfig.json and its compiler options?
No, but you can adapt this trick to look upwards for a tsconfig.json and use it. Please note the b: in front of the variable.
Had troubles with TypeScript as well.
The solution was, eventually: https://github.com/Quramy/tsuquyomi
This plugin is a dedicated TypeScript syntax checker and it works well with tsconfig.json and integrates well with syntastic. Now everything works well.
@nomaed You're the second person to recommend it. I suppose this makes it a good time to retire the tsc checker from syntastic. The more checkers maintained externally by people who actually care about them, the better.
I suppose you're right.
The downside is that people who are using syntastic's tsc support successfully (for basic needs) might miss it.
I am not familiar with vim scripting, so I can't say for sure, but is it possible to set the default behavior to detect whether tsuquyomi is usable and if so - use it, and only if it's not available fall back to tsc?
@nomad External checkers have a well-defined API. They are identical to internal checkers for all intents and purposes, except for being maintained externally.
Anyway, please see #1811.