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

if (a<b) matched as unclosed typescriptTypeArguments #242

Open
groner opened this issue May 17, 2021 · 1 comment
Open

if (a<b) matched as unclosed typescriptTypeArguments #242

groner opened this issue May 17, 2021 · 1 comment
Labels
ArrowFunc The fundamental difficulty

Comments

@groner
Copy link

groner commented May 17, 2021

I found the first problem (unclosed typescriptTypeArguments) working backwards from the second problem (unclosed typescriptTemplateLiteralType), so I'm describing them both here.

declare let a: string;
declare let b: string;
declare const definitelyNotInsideATemplateLiteral: () => void;

// a<b matches as typescript
if (a<b) {
  `${a}`;
}

definitelyNotInsideATemplateLiteral();

Here's the appearance in nvim, using the solarized colorscheme.
image

Evaluating map(synstack(line('.'), col('.')), 'synIDattr(v:val, "name")') at various points:

The start of the template literal line:
['typescriptConditionalParen', 'typescriptTypeArguments', 'typescriptObjectType']

The start of the function call line:
['typescriptConditionalParen', 'typescriptTypeArguments', 'typescriptTemplateLiteralType']

@HerringtonDarkholme HerringtonDarkholme added the ArrowFunc The fundamental difficulty label May 18, 2021
@groner
Copy link
Author

groner commented May 20, 2021

I don't think this has to do with the arrow function. The arrow function appearing in the example is only there so typescript errors don't clutter things. It could be typed Function and the issue would still occur.

Changing a<b to a <b stop it from matching as typescriptTypeArguments.

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

No branches or pull requests

2 participants