Skip to content

Go-to-references on optional method does not work if class has parent classΒ #61215

Closed
@ulugbekna

Description

@ulugbekna

πŸ”Ž Search Terms

"go to references" "method" "parent class"

πŸ•— Version & Regression Information

I am not sure this is a regression.

I can reproduce on 5.7.3 and 5.8.1-rc

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.8.1-rc#code/JYOwLgpgTgZghgYwgAgJIDEIQCYCNEDWAEnCNgDbTIDeAUAJAAWpFEAggkgA5gD8AFAEoAXMgBuAe2DYA3A2ZlKAJQgArCAj5DRk6XIC+tWnFwBnMFERhkCcnFOnkbMxauYc+BMRaUoyYAC2XJQBEOCOGFh4hCSKVHSGtLb2ju7RXrGsfhAAHpBkjs7mlpppnt5xfnRMPuycEDza4lLYNMgA9O3IAOYSyGB9UBAw0GFIjhIgyAAGCqwc3GBC08imjBIAruStaxIA7v2MKLO1UAB0c5QLDXxnQjIruBDk+wz0CJOmEpRnL938AHIyoRkIhFjgAYI5PREjU4ip1JomrpWtV3p9vhBfhJ-kCouVkENEZBsJDoYZEjANiBNMBJsgYBIJPxLtBRJEPDFToIaPJThdatceLw7lC+ZUBfC1BpbvdaPogA

πŸ’» Code

interface IFeedbackHandler {
	handleAccept?(): void;
	handleReject?(): void;
}

abstract class AbstractFeedbackHandler implements IFeedbackHandler {
}

class FeedbackHandler extends AbstractFeedbackHandler {
	handleAccept(): void { // go to references on `handleAccept()` should show the `handler.handleAccept?.();` below
		console.log('Feedback accepted');
	}

	handleReject(): void {
		console.log('Feedback rejected');
	}
}

function foo(handler: IFeedbackHandler) {
	handler.handleAccept?.();
	handler.handleReject?.();
}

πŸ™ Actual behavior

Going to references on FeedbackHandler#handleAccept doesn't show it being used, while it could be used in the function foo().

πŸ™‚ Expected behavior

Going to references on FeedbackHandler#handleAccept shows a reference in the function foo().

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions