diff --git a/internal/ast/utilities.go b/internal/ast/utilities.go index 1793bc63ef..f491127d22 100644 --- a/internal/ast/utilities.go +++ b/internal/ast/utilities.go @@ -2641,7 +2641,7 @@ func GetNodeAtPosition(file *SourceFile, position int, includeJSDoc bool) *Node } if child == nil { current.ForEachChild(func(node *Node) bool { - if nodeContainsPosition(node, position) { + if nodeContainsPosition(node, position) && node.Kind != KindJSExportAssignment && node.Kind != KindCommonJSExport { child = node return true } diff --git a/testdata/tests/cases/compiler/nestedJSDocImportType.ts b/testdata/tests/cases/compiler/nestedJSDocImportType.ts new file mode 100644 index 0000000000..8569089738 --- /dev/null +++ b/testdata/tests/cases/compiler/nestedJSDocImportType.ts @@ -0,0 +1,15 @@ +// @checkJs: true +// @noEmit: true +// @noTypesAndSymbols: true + +// @Filename: a.js +/** @typedef {string} A */ + +// @Filename: b.js +module.exports = { + create() { + /** @param {import("./a").A} x */ + function f(x) {} + return f("hi"); + } +} \ No newline at end of file