Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix circular reference by type import #327

Merged
merged 2 commits into from
Jul 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"changes": [
{
"packageName": "@microsoft/tsdoc",
"comment": "Fix circular reference by type import",
"type": "patch"
}
],
"packageName": "@microsoft/tsdoc",
"email": "[email protected]"
}
4 changes: 2 additions & 2 deletions tsdoc/src/emitters/TSDocEmitter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
import type {
DocNode,
DocComment,
DocNodeKind,
DocPlainText,
DocSection,
DocBlock,
Expand All @@ -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';
Expand Down
5 changes: 1 addition & 4 deletions tsdoc/src/nodes/DocComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

/**
Expand Down Expand Up @@ -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';
5 changes: 1 addition & 4 deletions tsdoc/src/nodes/DocDeclarationReference.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down Expand Up @@ -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();
Expand All @@ -160,6 +160,3 @@ export class DocDeclarationReference extends DocNode {
];
}
}

// Circular reference
import { TSDocEmitter } from '../emitters/TSDocEmitter';
5 changes: 1 addition & 4 deletions tsdoc/src/nodes/DocHtmlEndTag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down Expand Up @@ -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();
Expand All @@ -111,6 +111,3 @@ export class DocHtmlEndTag extends DocNode {
];
}
}

// Circular reference
import { TSDocEmitter } from '../emitters/TSDocEmitter';
5 changes: 1 addition & 4 deletions tsdoc/src/nodes/DocHtmlStartTag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand Down Expand Up @@ -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();
Expand All @@ -164,6 +164,3 @@ export class DocHtmlStartTag extends DocNode {
];
}
}

// Circular reference
import { TSDocEmitter } from '../emitters/TSDocEmitter';