diff --git a/common/changes/@microsoft/tsdoc/fix-remove-circular-reference_2022-07-16-02-33.json b/common/changes/@microsoft/tsdoc/fix-remove-circular-reference_2022-07-16-02-33.json new file mode 100644 index 00000000..559a94bf --- /dev/null +++ b/common/changes/@microsoft/tsdoc/fix-remove-circular-reference_2022-07-16-02-33.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "packageName": "@microsoft/tsdoc", + "comment": "Fix circular reference by type import", + "type": "patch" + } + ], + "packageName": "@microsoft/tsdoc", + "email": "7829098+magic-akari@users.noreply.github.com" +} \ No newline at end of file diff --git a/tsdoc/src/emitters/TSDocEmitter.ts b/tsdoc/src/emitters/TSDocEmitter.ts index bec376d2..c2442f62 100644 --- a/tsdoc/src/emitters/TSDocEmitter.ts +++ b/tsdoc/src/emitters/TSDocEmitter.ts @@ -1,7 +1,6 @@ -import { +import type { DocNode, DocComment, - DocNodeKind, DocPlainText, DocSection, DocBlock, @@ -25,6 +24,7 @@ import { DocMemberSelector, DocParamBlock } from '../nodes'; +import { DocNodeKind } from '../nodes'; import { IStringBuilder } from './StringBuilder'; import { DocNodeTransforms } from '../transforms/DocNodeTransforms'; import { StandardTags } from '../details/StandardTags'; diff --git a/tsdoc/src/nodes/DocComment.ts b/tsdoc/src/nodes/DocComment.ts index d7d447ec..5a45b830 100644 --- a/tsdoc/src/nodes/DocComment.ts +++ b/tsdoc/src/nodes/DocComment.ts @@ -4,6 +4,7 @@ import { StandardModifierTagSet } from '../details/StandardModifierTagSet'; import { DocBlock } from './DocBlock'; import { DocInheritDocTag } from './DocInheritDocTag'; import { StringBuilder } from '../emitters/StringBuilder'; +import { TSDocEmitter } from '../emitters/TSDocEmitter'; import { DocParamCollection } from './DocParamCollection'; /** @@ -175,12 +176,8 @@ export class DocComment extends DocNode { */ public emitAsTsdoc(): string { const stringBuilder: StringBuilder = new StringBuilder(); - // eslint-disable-next-line @typescript-eslint/no-use-before-define const emitter: TSDocEmitter = new TSDocEmitter(); emitter.renderComment(stringBuilder, this); return stringBuilder.toString(); } } - -// Circular reference -import { TSDocEmitter } from '../emitters/TSDocEmitter'; diff --git a/tsdoc/src/nodes/DocDeclarationReference.ts b/tsdoc/src/nodes/DocDeclarationReference.ts index 4c213163..0d52e7ad 100644 --- a/tsdoc/src/nodes/DocDeclarationReference.ts +++ b/tsdoc/src/nodes/DocDeclarationReference.ts @@ -3,6 +3,7 @@ import { DocMemberReference } from './DocMemberReference'; import { TokenSequence } from '../parser/TokenSequence'; import { DocExcerpt, ExcerptKind } from './DocExcerpt'; import { StringBuilder } from '../emitters/StringBuilder'; +import { TSDocEmitter } from '../emitters/TSDocEmitter'; /** * Constructor parameters for {@link DocDeclarationReference}. @@ -143,7 +144,6 @@ export class DocDeclarationReference extends DocNode { */ public emitAsTsdoc(): string { const stringBuilder: StringBuilder = new StringBuilder(); - // eslint-disable-next-line @typescript-eslint/no-use-before-define const emitter: TSDocEmitter = new TSDocEmitter(); emitter.renderDeclarationReference(stringBuilder, this); return stringBuilder.toString(); @@ -160,6 +160,3 @@ export class DocDeclarationReference extends DocNode { ]; } } - -// Circular reference -import { TSDocEmitter } from '../emitters/TSDocEmitter'; diff --git a/tsdoc/src/nodes/DocHtmlEndTag.ts b/tsdoc/src/nodes/DocHtmlEndTag.ts index 12d5edaa..6c724893 100644 --- a/tsdoc/src/nodes/DocHtmlEndTag.ts +++ b/tsdoc/src/nodes/DocHtmlEndTag.ts @@ -2,6 +2,7 @@ import { DocNode, DocNodeKind, IDocNodeParameters, IDocNodeParsedParameters } fr import { TokenSequence } from '../parser/TokenSequence'; import { DocExcerpt, ExcerptKind } from './DocExcerpt'; import { StringBuilder } from '../emitters/StringBuilder'; +import { TSDocEmitter } from '../emitters/TSDocEmitter'; /** * Constructor parameters for {@link DocHtmlEndTag}. @@ -95,7 +96,6 @@ export class DocHtmlEndTag extends DocNode { public emitAsHtml(): string { // NOTE: Here we're assuming that the TSDoc representation for a tag is also a valid HTML expression. const stringBuilder: StringBuilder = new StringBuilder(); - // eslint-disable-next-line @typescript-eslint/no-use-before-define const emitter: TSDocEmitter = new TSDocEmitter(); emitter.renderHtmlTag(stringBuilder, this); return stringBuilder.toString(); @@ -111,6 +111,3 @@ export class DocHtmlEndTag extends DocNode { ]; } } - -// Circular reference -import { TSDocEmitter } from '../emitters/TSDocEmitter'; diff --git a/tsdoc/src/nodes/DocHtmlStartTag.ts b/tsdoc/src/nodes/DocHtmlStartTag.ts index ff541f4a..e4a9c66e 100644 --- a/tsdoc/src/nodes/DocHtmlStartTag.ts +++ b/tsdoc/src/nodes/DocHtmlStartTag.ts @@ -3,6 +3,7 @@ import { DocHtmlAttribute } from './DocHtmlAttribute'; import { TokenSequence } from '../parser/TokenSequence'; import { DocExcerpt, ExcerptKind } from './DocExcerpt'; import { StringBuilder } from '../emitters/StringBuilder'; +import { TSDocEmitter } from '../emitters/TSDocEmitter'; /** * Constructor parameters for {@link DocHtmlStartTag}. @@ -147,7 +148,6 @@ export class DocHtmlStartTag extends DocNode { public emitAsHtml(): string { // NOTE: Here we're assuming that the TSDoc representation for a tag is also a valid HTML expression. const stringBuilder: StringBuilder = new StringBuilder(); - // eslint-disable-next-line @typescript-eslint/no-use-before-define const emitter: TSDocEmitter = new TSDocEmitter(); emitter.renderHtmlTag(stringBuilder, this); return stringBuilder.toString(); @@ -164,6 +164,3 @@ export class DocHtmlStartTag extends DocNode { ]; } } - -// Circular reference -import { TSDocEmitter } from '../emitters/TSDocEmitter';