tree-sitter / tree-sitter-typescript

TypeScript grammar for tree-sitter
MIT License
361 stars 108 forks source link

Support for enum union cast. #156

Closed danielnehrig closed 3 years ago

danielnehrig commented 3 years ago

Typescript introduced a feature that lets you cast a enum into a union type which breaks all highlighting in ts typescript

issue example:

enum Currency {
  EUR = "EUR"
  DOLLAR = "DOLLAR"
}

interface SomeApiPayload {
  id: string
  currency: `${Currency}` // this is the enum to union cast feature
}

const someApiCall = () => {
 // do api call
}

the highlight should be broken at the function and everything should be displayed green under the interface now

danielnehrig commented 3 years ago

https://github.com/tree-sitter/tree-sitter-typescript/issues/156 related and pr is open by maintainer