File: signaturesUseJSDocForOptionalParameters.types

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (53 lines) | stat: -rw-r--r-- 2,435 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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
=== tests/cases/compiler/jsDocOptionality.js ===
function MyClass() {
>MyClass : () => void

  this.prop = null;
>this.prop = null : null
>this.prop : any
>this : any
>prop : any
>null : null
}
/**
 * @param  {string} required
 * @param  {string} [notRequired]
 * @returns {MyClass}
 */
MyClass.prototype.optionalParam = function(required, notRequired) {
>MyClass.prototype.optionalParam = function(required, notRequired) {    return this;} : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>MyClass.prototype.optionalParam : any
>MyClass.prototype : any
>MyClass : () => void
>prototype : any
>optionalParam : any
>function(required, notRequired) {    return this;} : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>required : string
>notRequired : string

    return this;
>this : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }

};
let pInst = new MyClass();
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>new MyClass() : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>MyClass : () => void

let c1 = pInst.optionalParam('hello')
>c1 : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam('hello') : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>'hello' : "hello"

let c2 = pInst.optionalParam('hello', null)
>c2 : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam('hello', null) : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>pInst.optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>pInst : { prop: null; optionalParam: (required: string, notRequired?: string) => typeof MyClass; }
>optionalParam : (required: string, notRequired?: string) => { prop: null; optionalParam: any; }
>'hello' : "hello"
>null : null