-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Description
π Search Terms
"renamed field docs"
"renamed field documentation"
π Version & Regression Information
- This changed between versions 4.5 and 4.6
β― Playground Link
π» Code
type Foo = {
/**
* Thing is a bar
*/
isBar: boolean
/**
* Thing is a baz
*/
isBaz: boolean
}
function getFoo(): Foo {
return undefined as any
}
const { isBaz: isBar } = getFoo();
console.debug(isBar);π Actual behavior
If you inspect the tooltip/documentation for the isBar that is the renamed isBaz from the call to getFoo(), it takes on the docs for the actual isBar rather than isBaz (or nothing) (screenshot is from the playground with 5.1.6):

While that would be the correct documentation if it were in fact, the actual isBar, this one is actually isBaz and should have isBaz's docs.
π Expected behavior
Despite me renaming isBaz to another field that also exists, it should either still show the docs for isBaz for the renamed variable, or at least nothing.
Additional information about the issue
I say this changed between 4.5 and 4.6, but that's mainly because in 4.5 and earlier versions, the renamed version shows no documentation at all. 4.6 and later still show no documentation if you rename the field to something not present in the original type (screenshot is from the playground with 5.1.6):

Personally, I'd prefer it if the renamed version still showed the docs from the original, but nothing is still better than wrong.