Skip to content

Commit 4e04a74

Browse files
committed
Test:contextual typing of arguments obj in JS files
1 parent 2fdb5b8 commit 4e04a74

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
=== tests/cases/compiler/foo.js ===
2+
// Repro for #16585
3+
const x = {
4+
>x : Symbol(x, Decl(foo.js, 1, 5))
5+
6+
bar() {
7+
>bar : Symbol(bar, Decl(foo.js, 1, 11))
8+
9+
setTimeout(function() { arguments }, 0);
10+
>setTimeout : Symbol(setTimeout, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
11+
>arguments : Symbol(arguments)
12+
}
13+
}
14+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
=== tests/cases/compiler/foo.js ===
2+
// Repro for #16585
3+
const x = {
4+
>x : { [x: string]: any; bar(): void; }
5+
>{ bar() { setTimeout(function() { arguments }, 0); }} : { [x: string]: any; bar(): void; }
6+
7+
bar() {
8+
>bar : () => void
9+
10+
setTimeout(function() { arguments }, 0);
11+
>setTimeout(function() { arguments }, 0) : number
12+
>setTimeout : { (handler: (...args: any[]) => void, timeout: number): number; (handler: any, timeout?: any, ...args: any[]): number; }
13+
>function() { arguments } : (...args: any[]) => void
14+
>arguments : IArguments
15+
>0 : 0
16+
}
17+
}
18+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// @noEmit: true
2+
// @allowJs: true
3+
// @checkJs: true
4+
// @lib: es2017, dom
5+
// @Filename: foo.js
6+
// Repro for #16585
7+
const x = {
8+
bar() {
9+
setTimeout(function() { arguments }, 0);
10+
}
11+
}

0 commit comments

Comments
 (0)