From 09fbdb8bf71f5732917c61b7e6f97284d8c4e0a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Fri, 6 Jun 2025 20:56:40 +0200 Subject: [PATCH] Fixed JSDoc display on `JsxNamespacedName` attributes --- src/services/services.ts | 1 + .../quickInfoOnJsxNamespacedNameWithDoc1.ts | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 tests/cases/fourslash/quickInfoOnJsxNamespacedNameWithDoc1.ts diff --git a/src/services/services.ts b/src/services/services.ts index 0534598da21d7..4849749a0656b 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3546,6 +3546,7 @@ function getContainingObjectLiteralElementWorker(node: Node): ObjectLiteralEleme // falls through case SyntaxKind.Identifier: + case SyntaxKind.JsxNamespacedName: return isObjectLiteralElement(node.parent) && (node.parent.parent.kind === SyntaxKind.ObjectLiteralExpression || node.parent.parent.kind === SyntaxKind.JsxAttributes) && node.parent.name === node ? node.parent : undefined; diff --git a/tests/cases/fourslash/quickInfoOnJsxNamespacedNameWithDoc1.ts b/tests/cases/fourslash/quickInfoOnJsxNamespacedNameWithDoc1.ts new file mode 100644 index 0000000000000..e3f47fec79472 --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnJsxNamespacedNameWithDoc1.ts @@ -0,0 +1,24 @@ +/// + +// @jsx: react + +// https://github.com/microsoft/TypeScript/issues/61820 + +// @Filename: /types.d.ts +//// declare namespace JSX { +//// interface IntrinsicElements { +//// 'my-el': { +//// /** This appears */ +//// foo: string; +//// +//// /** This also appears */ +//// 'prop:foo': string; +//// }; +//// } +//// } + +// @filename: /a.tsx +//// + +verify.quickInfoAt("1", "(property) 'prop:foo': string", "This also appears"); +verify.quickInfoAt("2", "(property) foo: string", "This appears");