mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-09 20:51:43 -06:00
fix(39421): omit prefix text for rest binding element (#39433)
This commit is contained in:
parent
8795458d6d
commit
ebac7ec08f
@ -402,7 +402,7 @@ namespace ts.FindAllReferences {
|
||||
const parent = node.parent;
|
||||
const name = originalNode.text;
|
||||
const isShorthandAssignment = isShorthandPropertyAssignment(parent);
|
||||
if (isShorthandAssignment || isObjectBindingElementWithoutPropertyName(parent) && parent.name === node) {
|
||||
if (isShorthandAssignment || (isObjectBindingElementWithoutPropertyName(parent) && parent.name === node && parent.dotDotDotToken === undefined)) {
|
||||
const prefixColon: PrefixAndSuffix = { prefixText: name + ": " };
|
||||
const suffixColon: PrefixAndSuffix = { suffixText: ": " + name };
|
||||
if (kind === EntryKind.SearchedLocalFoundProperty) {
|
||||
|
||||
13
tests/cases/fourslash/renameRestBindingElement.ts
Normal file
13
tests/cases/fourslash/renameRestBindingElement.ts
Normal file
@ -0,0 +1,13 @@
|
||||
/// <reference path='fourslash.ts' />
|
||||
|
||||
////interface I {
|
||||
//// a: number;
|
||||
//// b: number;
|
||||
//// c: number;
|
||||
////}
|
||||
////function foo([|{ a, ...[|{| "contextRangeIndex": 0 |}rest|] }: I|]) {
|
||||
//// [|rest|];
|
||||
////}
|
||||
|
||||
const [r0Def, r0, r1] = test.ranges();
|
||||
verify.renameLocations(r0, { ranges: [r0, r1], providePrefixAndSuffixTextForRename: true });
|
||||
Loading…
x
Reference in New Issue
Block a user