Skip to content

Commit 7779e9b

Browse files
committed
JS: Add test with FNs for contextual typing
1 parent 7de5fd0 commit 7779e9b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import * as express from 'express';
2+
3+
interface Options {
4+
handle(req: express.Request): void; // $ hasUnderlyingType='express'.Request
5+
}
6+
7+
declare function doSomething(options: Options);
8+
9+
function t1() {
10+
doSomething({
11+
handle(req) { // $ MISSING: hasUnderlyingType='express'.Request
12+
}
13+
});
14+
}
15+
16+
function t2(callback: ((opts: Options) => void) | undefined) {
17+
callback({
18+
handle(req) { } // $ MISSING: hasUnderlyingType='express'.Request
19+
})
20+
callback!({
21+
handle(req) { } // $ MISSING: hasUnderlyingType='express'.Request
22+
})
23+
}
24+
25+
function t3(): Options {
26+
return {
27+
handle(req) { } // $ MISSING: hasUnderlyingType='express'.Request
28+
}
29+
}

0 commit comments

Comments
 (0)