Skip to content

Commit e3c8640

Browse files
committed
some types
Signed-off-by: flakey5 <[email protected]>
1 parent 08c1365 commit e3c8640

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

src/generators/legacy-json/types.d.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,37 +26,48 @@ export interface SectionBase {
2626
desc: string;
2727
shortDesc?: string;
2828
stability?: number;
29-
stabilityText?: string; // TODO find the type for this
29+
stabilityText?: string;
3030
meta?: Meta;
3131
}
3232

3333
export interface ModuleSection extends SectionBase {
3434
type: 'module';
3535
source: string;
36-
miscs: MiscSection[];
37-
modules: ModuleSection[];
38-
// TODO ...
36+
miscs?: MiscSection[];
37+
modules?: ModuleSection[];
38+
classes?: SignatureSection[];
39+
methods?: MethodSignature[];
40+
properties?: PropertySection[];
41+
globals?: object[]; // TODO
42+
examples?: object[]; // TODO
43+
signatures?: SignatureSection[];
44+
// TODO the rest
3945
}
4046

4147
export interface SignatureSection extends SectionBase {
4248
type: 'class' | 'ctor' | 'classMethod' | 'method';
4349
signatures: MethodSignature[];
4450
}
4551

52+
export interface Parameter {
53+
name: string;
54+
optional?: boolean;
55+
default?: string;
56+
}
57+
4658
export interface MethodSignature {
47-
params: object[]; // TODO
48-
return?: object; // TODO
59+
params: Parameter[];
60+
return?: string;
4961
}
5062

5163
export interface PropertySection extends SectionBase {
5264
type: 'property';
53-
typeof?: string;
5465
[key: string]: string | undefined;
5566
}
5667

5768
export interface EventSection extends SectionBase {
5869
type: 'event';
59-
params: object[]; // TODO
70+
params: ListItem[];
6071
}
6172

6273
export interface MiscSection extends SectionBase {

src/generators/legacy-json/utils/buildSection.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ function parseListItem(child) {
127127
// .filter(node => node.type !== 'list')
128128
// .map(node => node.)
129129

130-
if (current.textRaw) {
130+
if (!current.textRaw) {
131131
throw new Error(`empty list item: ${JSON.stringify(child)}`);
132132
}
133133

0 commit comments

Comments
 (0)