1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | export function parse(content: string, options?: Options): Annotation;
|
15 |
|
16 |
|
17 |
|
18 | export function unwrapComment(doc: string): string;
|
19 |
|
20 | interface Options {
|
21 | |
22 |
|
23 |
|
24 |
|
25 | unwrap?: boolean;
|
26 | |
27 |
|
28 |
|
29 |
|
30 |
|
31 | tags?: string[];
|
32 | |
33 |
|
34 |
|
35 |
|
36 | recoverable?: boolean;
|
37 | |
38 |
|
39 |
|
40 |
|
41 | sloppy?: boolean;
|
42 | |
43 |
|
44 |
|
45 |
|
46 | strict?: boolean;
|
47 | |
48 |
|
49 |
|
50 |
|
51 | preserveWhitespace?: boolean;
|
52 | |
53 |
|
54 |
|
55 |
|
56 | lineNumbers?: boolean;
|
57 | }
|
58 |
|
59 |
|
60 |
|
61 |
|
62 | interface Annotation {
|
63 |
|
64 | description: string;
|
65 | tags: Tag[];
|
66 | }
|
67 |
|
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | export interface Tag {
|
85 |
|
86 | title: string;
|
87 |
|
88 | name?: string;
|
89 |
|
90 | description: string|null;
|
91 |
|
92 | type?: Type|null;
|
93 | kind?: string;
|
94 |
|
95 | errors?: string[];
|
96 | }
|
97 |
|
98 | export type Type =
|
99 | (type.AllLiteral | type.ArrayType | type.FieldType | type.FunctionType |
|
100 | type.NameExpression | type.NonNullableType | type.NullableLiteral |
|
101 | type.NullableType | type.NullLiteral | type.OptionalType |
|
102 | type.ParameterType | type.RecordType | type.RestType |
|
103 | type.TypeApplication | type.UndefinedLiteral | type.UnionType |
|
104 | type.VoidLiteral);
|
105 |
|
106 | export module type {
|
107 | export interface AllLiteral { type: 'AllLiteral' }
|
108 | export interface ArrayType { type: 'ArrayType', elements: Type[] }
|
109 | export interface FieldType { type: 'FieldType', key: string, value?: Type }
|
110 | export interface FunctionType {
|
111 | type: 'FunctionType';
|
112 | 'this': Type;
|
113 | 'new': Type, params: Type[];
|
114 | result: Type[]
|
115 | }
|
116 | export interface NameExpression { type: 'NameExpression', name: string }
|
117 | export interface NonNullableType {
|
118 | type: 'NonNullableType', prefix: boolean, expression: Type
|
119 | }
|
120 | export interface NullableLiteral { type: 'NullableLiteral' }
|
121 | export interface NullableType {
|
122 | type: 'NullableType', prefix: boolean, expression: Type
|
123 | }
|
124 | export interface NullLiteral { type: 'NullLiteral' }
|
125 | export interface OptionalType { type: 'OptionalType', expression: Type }
|
126 | export interface ParameterType {
|
127 | type: 'ParameterType', name: string, expression: Type
|
128 | }
|
129 | export interface RecordType { type: 'RecordType', fields: Type[] }
|
130 | export interface RestType {
|
131 | type: 'RestType';
|
132 | expression?: Type;
|
133 | }
|
134 | export interface TypeApplication {
|
135 | type: 'TypeApplication', expression: Type, applications: Type[]
|
136 | }
|
137 | export interface UndefinedLiteral { type: 'UndefinedLiteral' }
|
138 | export interface UnionType { type: 'UnionType', elements: Type[] }
|
139 | export interface VoidLiteral { type: 'VoidLiteral' }
|
140 |
|
141 | export function stringify(type: Type): string;
|
142 | export function parseType(src: string, options?: {midstream: boolean}): Type;
|
143 | export function parseParamType(
|
144 | src: string, options?: {midstream: boolean}): Type;
|
145 |
|
146 | export const Syntax: {
|
147 | NullableLiteral: 'NullableLiteral',
|
148 | AllLiteral: 'AllLiteral',
|
149 | NullLiteral: 'NullLiteral',
|
150 | UndefinedLiteral: 'UndefinedLiteral',
|
151 | VoidLiteral: 'VoidLiteral',
|
152 | UnionType: 'UnionType',
|
153 | ArrayType: 'ArrayType',
|
154 | RecordType: 'RecordType',
|
155 | FieldType: 'FieldType',
|
156 | FunctionType: 'FunctionType',
|
157 | ParameterType: 'ParameterType',
|
158 | RestType: 'RestType',
|
159 | NonNullableType: 'NonNullableType',
|
160 | OptionalType: 'OptionalType',
|
161 | NullableType: 'NullableType',
|
162 | NameExpression: 'NameExpression',
|
163 | TypeApplication: 'TypeApplication'
|
164 | }
|
165 | }
|
166 |
|
167 | export const version: string;
|
168 | export const parseType: typeof type.parseType;
|
169 | export const parseParamType: typeof type.parseParamType;
|
170 | export const Syntax: typeof type.Syntax;
|