From 5a91e261dcc1d482334b8476b5d18a1bc7ee4a6c Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 4 Oct 2022 23:34:12 +0000 Subject: [PATCH] Add a lightweight walk to bind object type literals in JSDoc. --- src/compiler/binder.ts | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 4c3eac092b4..4e250aa4659 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2456,13 +2456,23 @@ namespace ts { } else { for (const j of node.jsDoc!) { - setParent(j, node); - setParentRecursive(j, /*incremental*/ false); + setParentsAndBindAnonymousJSDocTypes(j); } } } } + function setParentsAndBindAnonymousJSDocTypes(node: Node) { + setParent(node, parent); + const saveParent = parent; + parent = node; + if (node.kind === SyntaxKind.TypeLiteral) { + bindWorker(node); + } + forEachChild(node, setParentsAndBindAnonymousJSDocTypes); + parent = saveParent; + } + function updateStrictModeStatementList(statements: NodeArray) { if (!inStrictMode) { for (const statement of statements) {