diff --git a/src/parse.ts b/src/parse.ts index f28cbaa..a796f01 100644 --- a/src/parse.ts +++ b/src/parse.ts @@ -381,6 +381,8 @@ function getPluginsConfig( const typeLiteral = properytSignature.type as ts.TypeLiteralNode; const nm = properytSignature.name.getText(); + const symbol = typeChecker.getSymbolAtLocation(properytSignature.name); + const docs = symbol ? serializeSymbol(typeChecker, symbol) : null; const i: DocsConfigInterface = { name: nm, slug: slugify(nm), @@ -390,6 +392,7 @@ function getPluginsConfig( return getInterfaceProperty(typeChecker, propertySignature); }) .filter(p => p != null) as DocsInterfaceProperty[], + docs: docs?.docs || '', }; if (i.properties.length > 0) { diff --git a/src/test/fixtures/definitions.ts b/src/test/fixtures/definitions.ts index ca3c9e2..3644080 100644 --- a/src/test/fixtures/definitions.ts +++ b/src/test/fixtures/definitions.ts @@ -2,6 +2,9 @@ declare module '@capacitor/cli' { export interface PluginsConfig { + /** + * Haptics can be configured with this options: + */ Haptics?: { /** * Configure the style. diff --git a/src/test/parse.spec.ts b/src/test/parse.spec.ts index d3dc6ac..6e6480f 100644 --- a/src/test/parse.spec.ts +++ b/src/test/parse.spec.ts @@ -147,6 +147,7 @@ describe('parse', () => { const p = pluginConfigs.find(i => i.name === `Haptics`); expect(p.slug).toBe(`haptics`); + expect(p.docs).toBe(`Haptics can be configured with this options:`); expect(p.properties).toHaveLength(2); const p0 = p.properties[0]; diff --git a/src/types.ts b/src/types.ts index de42ec9..0c4355d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -10,6 +10,7 @@ export interface DocsConfigInterface { name: string; slug: string; properties: DocsInterfaceProperty[]; + docs: string; } export interface DocsInterface {