File: inferSecondaryParameter.types

package info (click to toggle)
node-typescript 2.1.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 203,960 kB
  • sloc: sh: 11; makefile: 5
file content (34 lines) | stat: -rw-r--r-- 967 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
=== tests/cases/compiler/inferSecondaryParameter.ts ===
// type inference on 'bug' should give 'any'

interface Ib { m(test: string, fn: Function); }
>Ib : Ib
>m : (test: string, fn: Function) => any
>test : string
>fn : Function
>Function : Function

var b: Ib = { m: function (test: string, fn: Function) { } };
>b : Ib
>Ib : Ib
>{ m: function (test: string, fn: Function) { } } : { m: (test: string, fn: Function) => void; }
>m : (test: string, fn: Function) => void
>function (test: string, fn: Function) { } : (test: string, fn: Function) => void
>test : string
>fn : Function
>Function : Function

b.m("test", function (bug) {
>b.m("test", function (bug) {    var a: number = bug;}) : any
>b.m : (test: string, fn: Function) => any
>b : Ib
>m : (test: string, fn: Function) => any
>"test" : "test"
>function (bug) {    var a: number = bug;} : (bug: any) => void
>bug : any

    var a: number = bug;
>a : number
>bug : any

});