Skip to content

Commit ae2b13f

Browse files
committed
expose svelte2tsx component documentation
1 parent cad755f commit ae2b13f

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

packages/svelte2tsx/index.d.ts

+16-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,24 @@ export interface SvelteCompiledToTsx {
33
map: import("magic-string").SourceMap;
44
exportedNames: IExportedNames;
55
events: ComponentEvents;
6+
componentDocumentation: string;
7+
slots: Map<string, Map<string, string>>;
8+
generics: {
9+
definitions: string[];
10+
references: string[];
11+
};
612
}
713

8-
export interface IExportedNames {
9-
has(name: string): boolean;
10-
}
14+
export type IExportedNames = Map<
15+
string,
16+
{
17+
isLet: boolean;
18+
type?: string;
19+
identifierText?: string;
20+
required?: boolean;
21+
doc?: string;
22+
}
23+
>;
1124

1225
export interface ComponentEvents {
1326
getAll(): { name: string; type: string; doc?: string }[];

packages/svelte2tsx/src/svelte2tsx/index.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,13 @@ declare function __sveltets_1_createSvelteComponentTyped<Props, Events, Slots>(
451451
code: str.toString(),
452452
map: str.generateMap({ hires: true, source: options?.filename }),
453453
exportedNames: exportedNames.getExportsMap(),
454-
events: events.createAPI()
454+
events: events.createAPI(),
455+
componentDocumentation: componentDocumentation.getFormatted(),
456+
slots,
457+
generics: {
458+
definition: generics.toDefinitionString(),
459+
references: generics.toReferencesString()
460+
}
455461
};
456462
}
457463
}

0 commit comments

Comments
 (0)