Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting and indentation broken when type casting #21

Open
pbondoer opened this issue Dec 19, 2019 · 2 comments
Open

Highlighting and indentation broken when type casting #21

pbondoer opened this issue Dec 19, 2019 · 2 comments

Comments

@pbondoer
Copy link

Following MaxMEllon/vim-jsx-pretty#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):

https://uplr.it/3f67b.png

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 leafgarland/typescript-vim#134 initially.

Please let me know if I can provide any additional information :)

@pbondoer
Copy link
Author

If you are stumbling on this issue from Google, an alternative is to use the as casting operator:

const bar = foo as string;

@pbondoer
Copy link
Author

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 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant