/
this.ts
34 lines (31 loc) · 1.29 KB
/
this.ts
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
import * as ts from 'typescript';
import { Type, IntrinsicType } from '../../models/types/index';
import { Component, ConverterTypeComponent, TypeNodeConverter } from '../components';
import { Context } from '../context';
@Component({ name: 'type:this' })
export class ThisConverter extends ConverterTypeComponent implements TypeNodeConverter<ts.Type, ts.ThisTypeNode> {
/**
* Test whether this converter can handle the given TypeScript node.
*/
public supportsNode(context: Context, node: ts.ThisTypeNode, type: ts.Type): boolean {
return node.kind === ts.SyntaxKind.ThisType;
}
/**
* Convert the type reference node to its type reflection.
*
* This is a node based converter, see [[convertTypeReferenceType]] for the type equivalent.
*
* ```
* class SomeClass { }
* var someValue:SomeClass;
* ```
*
* @param context The context object describing the current state the converter is in.
* @param node The type reference node that should be converted.
* @param type The type of the type reference node.
* @returns The type reflection representing the given reference node.
*/
public convertNode(context: Context, node: ts.ThisTypeNode, type: ts.Type): Type {
return new IntrinsicType('this');
}
}