diff --git a/src/generators/legacy-json/types.d.ts b/src/generators/legacy-json/types.d.ts index 0f70d81..47f8ba6 100644 --- a/src/generators/legacy-json/types.d.ts +++ b/src/generators/legacy-json/types.d.ts @@ -26,16 +26,22 @@ export interface SectionBase { desc: string; shortDesc?: string; stability?: number; - stabilityText?: string; // TODO find the type for this + stabilityText?: string; meta?: Meta; } export interface ModuleSection extends SectionBase { type: 'module'; source: string; - miscs: MiscSection[]; - modules: ModuleSection[]; - // TODO ... + miscs?: MiscSection[]; + modules?: ModuleSection[]; + classes?: SignatureSection[]; + methods?: MethodSignature[]; + properties?: PropertySection[]; + globals?: object[]; // TODO + examples?: object[]; // TODO + signatures?: SignatureSection[]; + // TODO the rest } export interface SignatureSection extends SectionBase { @@ -43,20 +49,25 @@ export interface SignatureSection extends SectionBase { signatures: MethodSignature[]; } +export interface Parameter { + name: string; + optional?: boolean; + default?: string; +} + export interface MethodSignature { - params: object[]; // TODO - return?: object; // TODO + params: Parameter[]; + return?: string; } export interface PropertySection extends SectionBase { type: 'property'; - typeof?: string; [key: string]: string | undefined; } export interface EventSection extends SectionBase { type: 'event'; - params: object[]; // TODO + params: ListItem[]; } export interface MiscSection extends SectionBase { diff --git a/src/generators/legacy-json/utils/buildSection.mjs b/src/generators/legacy-json/utils/buildSection.mjs index 1318172..06f45b0 100644 --- a/src/generators/legacy-json/utils/buildSection.mjs +++ b/src/generators/legacy-json/utils/buildSection.mjs @@ -127,7 +127,7 @@ function parseListItem(child) { // .filter(node => node.type !== 'list') // .map(node => node.) - if (current.textRaw) { + if (!current.textRaw) { throw new Error(`empty list item: ${JSON.stringify(child)}`); }