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.*.
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.
When the object literal is going to be written like
d
, the inner operatoras keyof typeof
is tokenised asvariable.parameter.ts
or (tsx), but notkeyword.*
.