File: commentsFunction.types

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (132 lines) | stat: -rw-r--r-- 3,235 bytes parent folder | download | duplicates (5)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
=== tests/cases/compiler/commentsFunction.ts ===
/** This comment should appear for foo*/
function foo() {
>foo : () => void

} /* trailing comment of function */
foo();
>foo() : void
>foo : () => void

/** This is comment for function signature*/
function fooWithParameters(/** this is comment about a*/a: string,
>fooWithParameters : (a: string, b: number) => void
>a : string

    /** this is comment for b*/
    b: number) {
>b : number

    var d = a;
>d : string
>a : string

} // trailing comment of function
fooWithParameters("a", 10);
>fooWithParameters("a", 10) : void
>fooWithParameters : (a: string, b: number) => void
>"a" : "a"
>10 : 10

/** fooFunc
 * comment
 */
var fooFunc = function FooFunctionValue(/** fooFunctionValue param */ b: string) {
>fooFunc : (b: string) => string
>function FooFunctionValue(/** fooFunctionValue param */ b: string) {    return b;} : (b: string) => string
>FooFunctionValue : (b: string) => string
>b : string

    return b;
>b : string
}

/// lamdaFoo var comment
var lambdaFoo = /** this is lambda comment*/ (/**param a*/a: number, /**param b*/b: number) => a + b;
>lambdaFoo : (a: number, b: number) => number
>(/**param a*/a: number, /**param b*/b: number) => a + b : (a: number, b: number) => number
>a : number
>b : number
>a + b : number
>a : number
>b : number

var lambddaNoVarComment = /** this is lambda multiplication*/ (/**param a*/a: number, /**param b*/b: number) => a * b;
>lambddaNoVarComment : (a: number, b: number) => number
>(/**param a*/a: number, /**param b*/b: number) => a * b : (a: number, b: number) => number
>a : number
>b : number
>a * b : number
>a : number
>b : number

lambdaFoo(10, 20);
>lambdaFoo(10, 20) : number
>lambdaFoo : (a: number, b: number) => number
>10 : 10
>20 : 20

lambddaNoVarComment(10, 20);
>lambddaNoVarComment(10, 20) : number
>lambddaNoVarComment : (a: number, b: number) => number
>10 : 10
>20 : 20

function blah(a: string /* multiline trailing comment 
>blah : (a: string) => void
>a : string

multiline */) {
}

function blah2(a: string /* single line multiple trailing comments */ /* second */) {
>blah2 : (a: string) => void
>a : string
}

function blah3(a: string // trailing commen single line
>blah3 : (a: string) => void
>a : string

    ) {
}

lambdaFoo = (a, b) => a * b; // This is trailing comment
>lambdaFoo = (a, b) => a * b : (a: number, b: number) => number
>lambdaFoo : (a: number, b: number) => number
>(a, b) => a * b : (a: number, b: number) => number
>a : number
>b : number
>a * b : number
>a : number
>b : number

/*leading comment*/() => 0; // Needs to be wrapped in parens to be a valid expression (not declaration)
>() => 0 : () => number
>0 : 0

/*leading comment*/(() => 0); //trailing comment
>(() => 0) : () => number
>() => 0 : () => number
>0 : 0

function blah4(/*1*/a: string/*2*/,/*3*/b: string/*4*/) {
>blah4 : (a: string, b: string) => void
>a : string
>b : string
}

function foo1() {
>foo1 : () => void

    // should emit this
}

function foo2() {
>foo2 : () => void

    /// This is some detached comment

    // should emit this leading comment of } too
}