From 54cd5c323d5277194f9da9999d1595312d689c44 Mon Sep 17 00:00:00 2001 From: mikewrighton Date: Wed, 20 Sep 2023 20:07:54 +0200 Subject: [PATCH] feat(typewriter): Add docTags map to DocsSpec interface. (#538) Add `docTags` field to the DocSpec interface. This is a dependency of https://github.com/aws/aws-cdk/issues/26839. --------- Co-authored-by: Mike Wrighton --- packages/@cdklabs/typewriter/src/documented.ts | 6 ++++++ packages/@cdklabs/typewriter/src/renderer/typescript.ts | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/packages/@cdklabs/typewriter/src/documented.ts b/packages/@cdklabs/typewriter/src/documented.ts index 853ef9ad2..83f1f2b02 100644 --- a/packages/@cdklabs/typewriter/src/documented.ts +++ b/packages/@cdklabs/typewriter/src/documented.ts @@ -85,6 +85,12 @@ export interface DocsSpec { * @default none */ see?: string; + /** + * A map of document tags where the key represents the tag name. + * + * @default none + */ + docTags?: Record; /** * Description of the default * diff --git a/packages/@cdklabs/typewriter/src/renderer/typescript.ts b/packages/@cdklabs/typewriter/src/renderer/typescript.ts index 44be2826f..c316c9f6c 100644 --- a/packages/@cdklabs/typewriter/src/renderer/typescript.ts +++ b/packages/@cdklabs/typewriter/src/renderer/typescript.ts @@ -714,7 +714,13 @@ export class TypeScriptRenderer extends Renderer { if (options?.forceStruct) { line('@struct'); } + tagged('deprecated', el.docs?.deprecated); + + for (const key in el.docs?.docTags) { + tagged(key, el.docs?.docTags[key]); + } + tagged('stability', el.docs?.stability); tagged('default -', el.docs?.default); tagged('returns', el.docs?.returns);