vim-jsx-typescript
vim-jsx-typescript copied to clipboard
Highlighting and indentation broken when type casting
Following https://github.com/MaxMEllon/vim-jsx-pretty/issues/114, I was looking for an alternative to vim-jsx-pretty
for TypeScript, and found this.
Unfortunately it seems this plugin also suffers from the same bug when inside a tsx
file (luckily, it doesn't happen for regular .ts
files):
Minimal .vimrc
to reproduce (with vim-plug
)
call plug#begin()
Plug 'leafgarland/typescript-vim'
Plug 'peitalin/vim-jsx-typescript'
call plug#end()
Additional information
This came up through https://github.com/leafgarland/typescript-vim/issues/134 initially.
Please let me know if I can provide any additional information :)
If you are stumbling on this issue from Google, an alternative is to use the as
casting operator:
const bar = foo as string;
According to TypeScript docs:
The two samples are equivalent. Using one over the other is mostly a choice of preference; however, when using TypeScript with JSX, only
as
-style assertions are allowed.
So perhaps this shouldn't be considered a bug after all. I'll let you be the judge of that :+1: