Skip to content

Commit 7a5ec34

Browse files
committed
Merge branch 'master' into import_assertion
2 parents aa8b856 + ec77bff commit 7a5ec34

File tree

160 files changed

+22610
-1919
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+22610
-1919
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/compiler/checker.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5187,7 +5187,7 @@ namespace ts {
51875187
function preserveCommentsOn<T extends Node>(node: T) {
51885188
if (some(propertySymbol.declarations, d => d.kind === SyntaxKind.JSDocPropertyTag)) {
51895189
const d = propertySymbol.declarations?.find(d => d.kind === SyntaxKind.JSDocPropertyTag)! as JSDocPropertyTag;
5190-
const commentText = d.comment;
5190+
const commentText = getTextOfJSDocComment(d.comment);
51915191
if (commentText) {
51925192
setSyntheticLeadingComments(node, [{ kind: SyntaxKind.MultiLineCommentTrivia, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]);
51935193
}
@@ -6703,7 +6703,7 @@ namespace ts {
67036703
const typeParams = getSymbolLinks(symbol).typeParameters;
67046704
const typeParamDecls = map(typeParams, p => typeParameterToDeclaration(p, context));
67056705
const jsdocAliasDecl = symbol.declarations?.find(isJSDocTypeAlias);
6706-
const commentText = jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : undefined;
6706+
const commentText = getTextOfJSDocComment(jsdocAliasDecl ? jsdocAliasDecl.comment || jsdocAliasDecl.parent.comment : undefined);
67076707
const oldFlags = context.flags;
67086708
context.flags |= NodeBuilderFlags.InTypeAlias;
67096709
const oldEnclosingDecl = context.enclosingDeclaration;
@@ -38589,6 +38589,10 @@ namespace ts {
3858938589
const meaning = SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Value;
3859038590
return resolveEntityName(<EntityName>name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true, getHostSignatureFromJSDoc(name));
3859138591
}
38592+
else if (isJSDocLink(name.parent)) {
38593+
const meaning = SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Value;
38594+
return resolveEntityName(<EntityName>name, meaning, /*ignoreErrors*/ true);
38595+
}
3859238596

3859338597
if (name.parent.kind === SyntaxKind.TypePredicate) {
3859438598
return resolveEntityName(<Identifier>name, /*meaning*/ SymbolFlags.FunctionScopedVariable);

src/compiler/emitter.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3598,13 +3598,16 @@ namespace ts {
35983598
function emitJSDoc(node: JSDoc) {
35993599
write("/**");
36003600
if (node.comment) {
3601-
const lines = node.comment.split(/\r\n?|\n/g);
3602-
for (const line of lines) {
3603-
writeLine();
3604-
writeSpace();
3605-
writePunctuation("*");
3606-
writeSpace();
3607-
write(line);
3601+
const text = getTextOfJSDocComment(node.comment);
3602+
if (text) {
3603+
const lines = text.split(/\r\n?|\n/g);
3604+
for (const line of lines) {
3605+
writeLine();
3606+
writeSpace();
3607+
writePunctuation("*");
3608+
writeSpace();
3609+
write(line);
3610+
}
36083611
}
36093612
}
36103613
if (node.tags) {
@@ -3737,10 +3740,11 @@ namespace ts {
37373740
emit(tagName);
37383741
}
37393742

3740-
function emitJSDocComment(comment: string | undefined) {
3741-
if (comment) {
3743+
function emitJSDocComment(comment: NodeArray<JSDocText | JSDocLink> | undefined) {
3744+
const text = getTextOfJSDocComment(comment);
3745+
if (text) {
37423746
writeSpace();
3743-
write(comment);
3747+
write(text);
37443748
}
37453749
}
37463750

0 commit comments

Comments
 (0)