UNPKG

1.34 kBTypeScriptView Raw
1import * as ts from 'typescript';
2import { Component, AbstractComponent } from '../utils/component';
3import { Reflection } from '../models/reflections/abstract';
4import { Type } from '../models/types/abstract';
5import { Context } from './context';
6import { Converter } from './converter';
7export { Component };
8export declare abstract class ConverterComponent extends AbstractComponent<Converter> {
9}
10export declare abstract class ConverterNodeComponent<T extends ts.Node> extends ConverterComponent {
11 abstract supports: ts.SyntaxKind[];
12 abstract convert(context: Context, node: T): Reflection | undefined;
13}
14export declare abstract class ConverterTypeComponent extends ConverterComponent {
15 priority: number;
16}
17export interface TypeConverter<T extends ts.Type, N extends ts.Node> extends ConverterTypeComponent, TypeTypeConverter<T>, TypeNodeConverter<T, N> {
18}
19export interface TypeTypeConverter<T extends ts.Type> extends ConverterTypeComponent {
20 supportsType(context: Context, type: T): boolean;
21 convertType(context: Context, type: T): Type | undefined;
22}
23export interface TypeNodeConverter<T extends ts.Type, N extends ts.Node> extends ConverterTypeComponent {
24 supportsNode(context: Context, node: N, type: T | undefined): boolean;
25 convertNode(context: Context, node: N, type: T | undefined): Type | undefined;
26}