mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Test:contextual typing of arguments obj in JS files
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
=== tests/cases/compiler/foo.js ===
|
||||
// Repro for #16585
|
||||
const x = {
|
||||
>x : Symbol(x, Decl(foo.js, 1, 5))
|
||||
|
||||
bar() {
|
||||
>bar : Symbol(bar, Decl(foo.js, 1, 11))
|
||||
|
||||
setTimeout(function() { arguments }, 0);
|
||||
>setTimeout : Symbol(setTimeout, Decl(lib.dom.d.ts, --, --), Decl(lib.dom.d.ts, --, --))
|
||||
>arguments : Symbol(arguments)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
=== tests/cases/compiler/foo.js ===
|
||||
// Repro for #16585
|
||||
const x = {
|
||||
>x : { [x: string]: any; bar(): void; }
|
||||
>{ bar() { setTimeout(function() { arguments }, 0); }} : { [x: string]: any; bar(): void; }
|
||||
|
||||
bar() {
|
||||
>bar : () => void
|
||||
|
||||
setTimeout(function() { arguments }, 0);
|
||||
>setTimeout(function() { arguments }, 0) : number
|
||||
>setTimeout : { (handler: (...args: any[]) => void, timeout: number): number; (handler: any, timeout?: any, ...args: any[]): number; }
|
||||
>function() { arguments } : (...args: any[]) => void
|
||||
>arguments : IArguments
|
||||
>0 : 0
|
||||
}
|
||||
}
|
||||
|
||||
11
tests/cases/compiler/contextuallyTypeArgumentsKeyword.ts
Normal file
11
tests/cases/compiler/contextuallyTypeArgumentsKeyword.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
// @noEmit: true
|
||||
// @allowJs: true
|
||||
// @checkJs: true
|
||||
// @lib: es2017, dom
|
||||
// @Filename: foo.js
|
||||
// Repro for #16585
|
||||
const x = {
|
||||
bar() {
|
||||
setTimeout(function() { arguments }, 0);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user