Skip to content

Commit b698b4e

Browse files
committed
JS: Add test for missing type flow through generics
1 parent 11607e5 commit b698b4e

File tree

1 file changed

+46
-0
lines changed
  • javascript/ql/test/library-tests/UnderlyingTypes

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import * as express from 'express';
2+
3+
type Box1<T> = {
4+
value: T;
5+
other: string;
6+
};
7+
function t1(b: Box1<express.Request>) {
8+
b.value; // $ MISSING: hasUnderlyingType='express'.Request
9+
b.other;
10+
}
11+
12+
interface Box2<T> {
13+
value: T;
14+
other: string;
15+
}
16+
function t2(b: Box2<express.Request>) {
17+
b.value; // $ MISSING: hasUnderlyingType='express'.Request
18+
b.other;
19+
}
20+
21+
class Box3<T> {
22+
value: T;
23+
other: string;
24+
}
25+
function t3(b: Box3<express.Request>) {
26+
b.value; // $ MISSING: hasUnderlyingType='express'.Request
27+
b.other;
28+
}
29+
30+
abstract class Box4<T> {
31+
abstract getValue(): T;
32+
abstract getOther(): string;
33+
}
34+
function t4(b: Box4<express.Request>) {
35+
b.getValue(); // $ MISSING: hasUnderlyingType='express'.Request
36+
b.getOther();
37+
}
38+
39+
type Box5<T> = {
40+
value: T & { blah: string };
41+
other: string;
42+
};
43+
function t5(b: Box5<express.Request>) {
44+
b.value; // $ MISSING: hasUnderlyingType='express'.Request
45+
b.other;
46+
}

0 commit comments

Comments
 (0)