From 3ed0f36bb1cfb8a428f200484cc28dcead82af2b Mon Sep 17 00:00:00 2001 From: Asger F Date: Fri, 10 Oct 2025 10:04:44 +0200 Subject: [PATCH] JS: Use forceLocal to localize MkTypeUse --- javascript/ql/lib/semmle/javascript/ApiGraphs.qll | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/javascript/ql/lib/semmle/javascript/ApiGraphs.qll b/javascript/ql/lib/semmle/javascript/ApiGraphs.qll index f82ffe21542..03bce9871ac 100644 --- a/javascript/ql/lib/semmle/javascript/ApiGraphs.qll +++ b/javascript/ql/lib/semmle/javascript/ApiGraphs.qll @@ -735,6 +735,14 @@ module API { */ cached private module Impl { + private predicate hasTypeUse(string moduleName, string exportName) { + any(TypeAnnotation n).hasUnderlyingType(moduleName, exportName) + } + + overlay[local] + private predicate hasTypeUseLocal(string moduleName, string exportName) = + forceLocal(hasTypeUse/2)(moduleName, exportName) + cached newtype TApiNode = MkRoot() or @@ -772,9 +780,7 @@ module API { } or MkUse(DataFlow::Node nd) { nd instanceof DataFlow::SourceNode } or /** A use of a TypeScript type. */ - MkTypeUse(string moduleName, string exportName) { - any(TypeAnnotation n).hasUnderlyingType(moduleName, exportName) - } or + MkTypeUse(string moduleName, string exportName) { hasTypeUseLocal(moduleName, exportName) } or MkSyntheticCallbackArg(DataFlow::InvokeNode nd) class TDef = MkModuleDef or TNonModuleDef;