File tree 4 files changed +159
-0
lines changed
4 files changed +159
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ export {EnumConverter} from './enum';
6
6
export { IntrinsicConverter } from './intrinsic'
7
7
export { StringLiteralConverter } from './string-literal' ;
8
8
export { ReferenceConverter } from './reference' ;
9
+ export { ThisConverter } from './this' ;
9
10
export { TupleConverter } from './tuple' ;
10
11
export { TypeParameterConverter } from './type-parameter' ;
11
12
export { UnionConverter } from './union' ;
Original file line number Diff line number Diff line change
1
+ import * as ts from 'typescript' ;
2
+
3
+ import { Type , IntrinsicType } from '../../models/types/index' ;
4
+ import { Component , ConverterTypeComponent , TypeNodeConverter } from '../components' ;
5
+ import { Context } from '../context' ;
6
+
7
+ @Component ( { name : 'type:this' } )
8
+ export class ThisConverter extends ConverterTypeComponent implements TypeNodeConverter < ts . Type , ts . ThisTypeNode > {
9
+ /**
10
+ * Test whether this converter can handle the given TypeScript node.
11
+ */
12
+ public supportsNode ( context : Context , node : ts . ThisTypeNode , type : ts . Type ) : boolean {
13
+ return node . kind === ts . SyntaxKind . ThisType ;
14
+ }
15
+
16
+ /**
17
+ * Convert the type reference node to its type reflection.
18
+ *
19
+ * This is a node based converter, see [[convertTypeReferenceType]] for the type equivalent.
20
+ *
21
+ * ```
22
+ * class SomeClass { }
23
+ * var someValue:SomeClass;
24
+ * ```
25
+ *
26
+ * @param context The context object describing the current state the converter is in.
27
+ * @param node The type reference node that should be converted.
28
+ * @param type The type of the type reference node.
29
+ * @returns The type reflection representing the given reference node.
30
+ */
31
+ public convertNode ( context : Context , node : ts . ThisTypeNode , type : ts . Type ) : Type {
32
+ return new IntrinsicType ( 'this' ) ;
33
+ }
34
+ }
Original file line number Diff line number Diff line change
1
+ {
2
+ "id" : 0 ,
3
+ "name" : " typedoc" ,
4
+ "kind" : 0 ,
5
+ "flags" : {},
6
+ "children" : [
7
+ {
8
+ "id" : 1 ,
9
+ "name" : " \" this\" " ,
10
+ "kind" : 1 ,
11
+ "kindString" : " External module" ,
12
+ "flags" : {
13
+ "isExported" : true
14
+ },
15
+ "originalName" : " %BASE%/this/this.ts" ,
16
+ "children" : [
17
+ {
18
+ "id" : 2 ,
19
+ "name" : " ChainClass" ,
20
+ "kind" : 128 ,
21
+ "kindString" : " Class" ,
22
+ "flags" : {
23
+ "isExported" : true
24
+ },
25
+ "comment" : {
26
+ "shortText" : " ChainClass comment short text." ,
27
+ "text" : " ChainClass comment text.\n "
28
+ },
29
+ "children" : [
30
+ {
31
+ "id" : 3 ,
32
+ "name" : " chain" ,
33
+ "kind" : 2048 ,
34
+ "kindString" : " Method" ,
35
+ "flags" : {
36
+ "isExported" : true ,
37
+ "isPublic" : true
38
+ },
39
+ "signatures" : [
40
+ {
41
+ "id" : 4 ,
42
+ "name" : " chain" ,
43
+ "kind" : 4096 ,
44
+ "kindString" : " Call signature" ,
45
+ "flags" : {},
46
+ "comment" : {
47
+ "shortText" : " Chain method that returns this."
48
+ },
49
+ "type" : {
50
+ "type" : " instrinct" ,
51
+ "name" : " this"
52
+ }
53
+ }
54
+ ],
55
+ "sources" : [
56
+ {
57
+ "fileName" : " this.ts" ,
58
+ "line" : 11 ,
59
+ "character" : 13
60
+ }
61
+ ]
62
+ }
63
+ ],
64
+ "groups" : [
65
+ {
66
+ "title" : " Methods" ,
67
+ "kind" : 2048 ,
68
+ "children" : [
69
+ 3
70
+ ]
71
+ }
72
+ ],
73
+ "sources" : [
74
+ {
75
+ "fileName" : " this.ts" ,
76
+ "line" : 6 ,
77
+ "character" : 23
78
+ }
79
+ ]
80
+ }
81
+ ],
82
+ "groups" : [
83
+ {
84
+ "title" : " Classes" ,
85
+ "kind" : 128 ,
86
+ "children" : [
87
+ 2
88
+ ]
89
+ }
90
+ ],
91
+ "sources" : [
92
+ {
93
+ "fileName" : " this.ts" ,
94
+ "line" : 1 ,
95
+ "character" : 0
96
+ }
97
+ ]
98
+ }
99
+ ],
100
+ "groups" : [
101
+ {
102
+ "title" : " External modules" ,
103
+ "kind" : 1 ,
104
+ "children" : [
105
+ 1
106
+ ]
107
+ }
108
+ ]
109
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * ChainClass comment short text.
3
+ *
4
+ * ChainClass comment text.
5
+ */
6
+ export class ChainClass
7
+ {
8
+ /**
9
+ * Chain method that returns this.
10
+ */
11
+ public chain ( ) : this
12
+ {
13
+ return this ;
14
+ }
15
+ }
You can’t perform that action at this time.
0 commit comments