Conversation
# Conflicts: # src/compiler/checker.ts # tests/baselines/reference/keyofAndIndexedAccessErrors.errors.txt # tests/baselines/reference/keyofAndIndexedAccessErrors.symbols
| var obj = { | ||
| >obj : { [x: string]: () => void; } | ||
| >{ [(super(), "prop")]() { } } : { [x: string]: () => void; } | ||
| >obj : { [(super(), "prop")](): void; } |
There was a problem hiding this comment.
So, I don't know if it's related to this PR, but this change caught my eye:
{ [(super(), "prop")](): void; }isn't a valid type. Somewhere we're reusing the name's expression tree when building the computed property name type and shouldn't be. :(
There was a problem hiding this comment.
This is actually a baseline change from #23592. I somehow messed up a merge and ended up with a lot of apparent changes in this PR.
Anyways, what's not valid about the type? It's a method with a computed property name that uses the comma operator.
There was a problem hiding this comment.
That's supposed to be type output - if someone wrote type Foo = { [(super(), "prop")](): void; }, we'd issue an error.
|
I somehow ended up with a bad merge on this branch so I'm abandoning this PR in favor of #23645. |
With this PR we transform
keyofapplied to a union type to an intersection ofkeyofapplied to each union constituent. In other words, we rewrite types of the formkeyof (A | B)tokeyof A & keyof B.Some examples:
This PR is the mirror image of #22300 and finally brings symmetry to the type eqivalences:
Why it took so long to figure out I don't know!
Fixes #23618.