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

Parameterized type does not work with arrow functions #24

Open
rattrayalex-stripe opened this issue Aug 19, 2017 · 5 comments
Open

Parameterized type does not work with arrow functions #24

rattrayalex-stripe opened this issue Aug 19, 2017 · 5 comments
Labels

Comments

@rattrayalex-stripe
Copy link

This code results in broken syntax highlighting for all following code in the file:

const foo = <Foo>(x: Foo) => {
  return x + x;
};

I have found that this workaround fixes it:

const foo = /* any comment here */<Foo>(x: Foo) => {
  return x + x;
};

But would rather not have to litter my codebase with otherwise-needless comments 😄

@joshpeng
Copy link
Owner

joshpeng commented Sep 2, 2017

This seems to be the case even with this plugin disabled. Can you please confirm?

@rattrayalex-stripe
Copy link
Author

@joshpeng sorry for the delay.

The default VSCode syntax highlighter also doesn't handle this correctly, if that's what you mean. Other highlighters like vim (and, it seems, github's) don't seem to break, though.

Specifically, I'm told this syntax works with the following vim plugins:

Plugin 'pangloss/vim-javascript'
Plugin 'flowtype/vim-flow'

@joshpeng
Copy link
Owner

@rattrayalex-stripe This seems to happen both with or without Sublime Babel enabled. The issue is <Foo> because it detects that as a React HTML tag. Not sure what can be done.

@rattrayalex-stripe
Copy link
Author

Yeah, it's also an issue "upstream" with https://github.com/babel/babel-sublime and judging from the current status of that repo (babel/babel-sublime#328 and babel/babel-sublime#293) it's not likely to be addressed soon.

It may be possible to go digging in regex's and do something clever (eg; handle a <Foo>( differently from <Foo>) but I certainly understand if you're not up for that 😄

@joshpeng joshpeng added the bug label Sep 25, 2017
@kumarharsh
Copy link

@joshpeng Have you looked at https://github.com/borela/naomi?

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

No branches or pull requests

3 participants