Skip to content

Commit be1cd98

Browse files
committed
JS: Add JSDoc test case
1 parent 9aba549 commit be1cd98

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

javascript/ql/lib/semmle/javascript/internal/TypeResolution.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ module TypeResolution {
178178
// Support JSDoc expressions of the form 'foo.bar' where 'foo' is an import
179179
// at the top-level.
180180
exists(JSDocNamedTypeExpr expr, string prefix |
181-
expr.hasNameParts(prefix, name) and
181+
expr.hasNameParts(prefix, "." + name) and
182182
node1 = expr.getTopLevel().getScope().getVariable(prefix) and
183183
node2 = expr
184184
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import * as e from 'express';
2+
import { Response } from 'express';
3+
4+
/**
5+
* @param {e.Request} req
6+
*/
7+
function t1(req) { // $ hasUnderlyingType='express'.Request SPURIOUS: hasUnderlyingType=e.Request
8+
}
9+
10+
/**
11+
* @param {Response} res
12+
*/
13+
function t2(res) { // $ MISSING: hasUnderlyingType='express'.Response SPURIOUS: hasUnderlyingType=Response
14+
}

0 commit comments

Comments
 (0)