From a446431a5233139b8d4daee08ea57fd6cabb9965 Mon Sep 17 00:00:00 2001 From: Martin <7252614+Lhoerion@users.noreply.github.com> Date: Sat, 24 Apr 2021 22:44:32 +0200 Subject: [PATCH] feat: Add disableAliases option (#1576) Resolves #1571 --- src/lib/converter/symbols.ts | 6 +++++- src/lib/utils/options/declaration.ts | 1 + src/lib/utils/options/sources/typedoc.ts | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/converter/symbols.ts b/src/lib/converter/symbols.ts index cf6136e0b..a68c99201 100644 --- a/src/lib/converter/symbols.ts +++ b/src/lib/converter/symbols.ts @@ -73,6 +73,7 @@ export function convertSymbol( // but aren't aliased symbols because `export *` was used. const previous = context.project.getReflectionFromSymbol(symbol); if ( + !context.converter.application.options.getValue("disableAliases") && previous && previous.parent?.kindOf(ReflectionKind.Module | ReflectionKind.Project) ) { @@ -704,7 +705,10 @@ function convertAlias( const reflection = context.project.getReflectionFromSymbol( context.resolveAliasedSymbol(symbol) ); - if (!reflection) { + if ( + !reflection || + context.converter.application.options.getValue("disableAliases") + ) { // We don't have this, convert it. convertSymbol( context, diff --git a/src/lib/utils/options/declaration.ts b/src/lib/utils/options/declaration.ts index cf5fa2252..67598226d 100644 --- a/src/lib/utils/options/declaration.ts +++ b/src/lib/utils/options/declaration.ts @@ -46,6 +46,7 @@ export interface TypeDocOptionMap { excludeNotDocumented: boolean; excludeInternal: boolean; disableSources: boolean; + disableAliases: boolean; includes: string; media: string; diff --git a/src/lib/utils/options/sources/typedoc.ts b/src/lib/utils/options/sources/typedoc.ts index 15fa05456..e2eace1a8 100644 --- a/src/lib/utils/options/sources/typedoc.ts +++ b/src/lib/utils/options/sources/typedoc.ts @@ -72,6 +72,11 @@ export function addTypeDocOptions(options: Pick) { "Disables setting the source of a reflection when documenting it.", type: ParameterType.Boolean, }); + options.addDeclaration({ + name: "disableAliases", + help: "Disables creating aliases for shared reflections.", + type: ParameterType.Boolean, + }); options.addDeclaration({ name: "includes", help: