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 : typeof MyClass
this.prop = null;
>this.prop = null : null
>this.prop : any
>this : this
>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) => MyClass
>MyClass.prototype.optionalParam : any
>MyClass.prototype : any
>MyClass : typeof MyClass
>prototype : any
>optionalParam : any
>function(required, notRequired) { return this;} : (required: string, notRequired?: string) => MyClass
>required : string
>notRequired : string
return this;
>this : this
};
let pInst = new MyClass();
>pInst : MyClass
>new MyClass() : MyClass
>MyClass : typeof MyClass
let c1 = pInst.optionalParam('hello')
>c1 : MyClass
>pInst.optionalParam('hello') : MyClass
>pInst.optionalParam : (required: string, notRequired?: string) => MyClass
>pInst : MyClass
>optionalParam : (required: string, notRequired?: string) => MyClass
>'hello' : "hello"
let c2 = pInst.optionalParam('hello', null)
>c2 : MyClass
>pInst.optionalParam('hello', null) : MyClass
>pInst.optionalParam : (required: string, notRequired?: string) => MyClass
>pInst : MyClass
>optionalParam : (required: string, notRequired?: string) => MyClass
>'hello' : "hello"
>null : null
|