How can I configure the syntastic
plugin in vim
to provide live error checking for TypeScript files using tsc
? Currently, even though I have tsc
set up in vim
, it doesn't seem to be using the closest parent's tsconfig.json
file for configuration. This makes setting up syntastic
quite challenging. Appreciate any advice on how to make tsc
use the nearest tsconfig.json
file. Thank you!
EDIT: The reason behind my suspicion that tsconfig.json
is not being utilized is because features like module resolution methods are not functioning (e.g., "require" shows as undefined), and it's also missing some definition files mentioned in the files
attribute of tsconfig.json
.
Here is what I attempted but failed:
let g:syntastic_typescript_checks=['tsc', 'tslint']
" typescript: find tsconfig.json
function! FindTypescriptRoot()
return fnamemodify(findfile('tsconfig.json', './;'), ':h')
endfunction
let g:syntastic_typescript_tsc_args=['-p', FindTypescriptRoot()]
This led to Syntastic displaying the following error message:
app.ts|| TS5042: Option 'project' cannot be mixed with source files on a command line.
It seems like this error occurs because Synatstic is running a command like tsc -p /path/to/project/ app.ts
, which is an incorrect usage of that flag. However, I'm still puzzled as to why my settings in tsconfig.json
are not recognized by syntastic
. :(