Skip to content

Commit

Permalink
some types
Browse files Browse the repository at this point in the history
Signed-off-by: flakey5 <[email protected]>
  • Loading branch information
flakey5 committed Sep 9, 2024
1 parent d8d9587 commit c4e35e2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
27 changes: 19 additions & 8 deletions src/generators/legacy-json/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,37 +26,48 @@ 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 {
type: 'class' | 'ctor' | 'classMethod' | 'method';
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 {
Expand Down
2 changes: 1 addition & 1 deletion src/generators/legacy-json/utils/buildSection.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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)}`);
}

Expand Down

0 comments on commit c4e35e2

Please sign in to comment.