From f99803d05f3ec8b4b5317359f05a15a17f69dec4 Mon Sep 17 00:00:00 2001 From: "Oleksandr T." Date: Fri, 17 Jan 2025 22:05:26 +0200 Subject: [PATCH] fix(60551): satisfies is shown on go-to-implementation (#60801) --- src/services/findAllReferences.ts | 3 +- ...oToImplementation_satisfies.baseline.jsonc | 30 +++++++++++++++++++ .../fourslash/goToImplementation_satisfies.ts | 12 ++++++++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/goToImplementation_satisfies.baseline.jsonc create mode 100644 tests/cases/fourslash/goToImplementation_satisfies.ts diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 710a01b1c2d..ea1f164f84f 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -179,6 +179,7 @@ import { isReferencedFile, isReferenceFileLocation, isRightSideOfPropertyAccess, + isSatisfiesExpression, isShorthandPropertyAssignment, isSourceFile, isStatement, @@ -2282,7 +2283,7 @@ export namespace Core { addIfImplementation(body); } } - else if (isAssertionExpression(typeHavingNode)) { + else if (isAssertionExpression(typeHavingNode) || isSatisfiesExpression(typeHavingNode)) { addIfImplementation(typeHavingNode.expression); } } diff --git a/tests/baselines/reference/goToImplementation_satisfies.baseline.jsonc b/tests/baselines/reference/goToImplementation_satisfies.baseline.jsonc new file mode 100644 index 00000000000..7001dc96685 --- /dev/null +++ b/tests/baselines/reference/goToImplementation_satisfies.baseline.jsonc @@ -0,0 +1,30 @@ +// === goToImplementation === +// === /a.ts === +// interface /*GOTO IMPL*/I { +// foo: string; +// } +// +// function f() { +// const foo = [|{ foo: '' }|] satisfies I; +// } + + // === Details === + [ + { + "kind": "interface", + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "object literal", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + } + ] + } + ] \ No newline at end of file diff --git a/tests/cases/fourslash/goToImplementation_satisfies.ts b/tests/cases/fourslash/goToImplementation_satisfies.ts new file mode 100644 index 00000000000..1befdcfa401 --- /dev/null +++ b/tests/cases/fourslash/goToImplementation_satisfies.ts @@ -0,0 +1,12 @@ +/// + +// @filename: /a.ts +////interface /*def*/I { +//// foo: string; +////} +//// +////function f() { +//// const foo = { foo: '' } satisfies [|I|]; +////} + +verify.baselineGoToImplementation('def');