microsoft / microsoft/TypeScript-TmLanguage
Tokenising failure on parenthesis-wrapped object literal's type assertion operators `as keyof typeof`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 471
- Forks
- 149
- PR merge metrics
- No merged PRs in 30d
Description
JavaScript and TypeScript Nightly version: 5.3.0-dev.20231015
Code
This is the minimal and possible code for compare and constrast.
The example might not cover all posibilities that leads to this issue.
type A = { a: "", b: "" }
const a = { a: "", b: "" }
const c = ({
key: a.a, label: a.b[a.a as keyof typeof a.b]
})
const d = (
{
key: a.a, label: a.b[a.a as keyof typeof a.b]
})
const e =
{ key: a.a, label: a.b[a.a as keyof typeof a.b] }
const f =
{
key: a.a, label: a.b[a.a as keyof typeof a.b]
}
When the object literal is going to be written like d, the inner operator as keyof typeof is tokenised as variable.parameter.ts or (tsx), but not keyword.*.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the repository's TypeScript TextMate grammar files and reproduce the supplied examples in the relevant editor syntax highlighter. Compare the highlighting of as keyof typeof in the parenthesis-wrapped object literal with the other examples; done means those operators receive keyword scopes rather than variable.parameter.ts or the TSX equivalent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100