Skip to content

Commit fce33f1

Browse files
committed
remove some done TODOs
1 parent 070da0b commit fce33f1

File tree

5 files changed

+26
-29
lines changed

5 files changed

+26
-29
lines changed

src/services/codefixes/inferFromUsage.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ namespace ts.codefix {
128128
const typeNode = getTypeNodeIfAccessible(type, parent, program, host);
129129
if (typeNode) {
130130
// Note that the codefix will never fire with an existing `@type` tag, so there is no need to merge tags
131-
const typeTag = factory.createJSDocTypeTag(/*tagName*/ undefined, factory.createJSDocTypeExpression(typeNode), /*comment*/ { text: "" });
131+
const typeTag = factory.createJSDocTypeTag(/*tagName*/ undefined, factory.createJSDocTypeExpression(typeNode), /*comment*/ undefined);
132132
addJSDocTags(changes, sourceFile, cast(parent.parent.parent, isExpressionStatement), [typeTag]);
133133
}
134134
importAdder.writeFixes(changes);
@@ -307,7 +307,7 @@ namespace ts.codefix {
307307
return;
308308
}
309309
const typeExpression = factory.createJSDocTypeExpression(typeNode);
310-
const typeTag = isGetAccessorDeclaration(declaration) ? factory.createJSDocReturnTag(/*tagName*/ undefined, typeExpression, { text: "" }) : factory.createJSDocTypeTag(/*tagName*/ undefined, typeExpression, { text: "" });
310+
const typeTag = isGetAccessorDeclaration(declaration) ? factory.createJSDocReturnTag(/*tagName*/ undefined, typeExpression, /*comment*/ undefined) : factory.createJSDocTypeTag(/*tagName*/ undefined, typeExpression, /*comment*/ undefined);
311311
addJSDocTags(changes, sourceFile, parent, [typeTag]);
312312
}
313313
else if (!tryReplaceImportTypeNodeWithAutoImport(typeNode, declaration, sourceFile, changes, importAdder, getEmitScriptTarget(program.getCompilerOptions()))) {
@@ -374,7 +374,7 @@ namespace ts.codefix {
374374
}
375375
else {
376376
const paramTags = map(inferences, ({ name, typeNode, isOptional }) =>
377-
factory.createJSDocParameterTag(/*tagName*/ undefined, name, /*isBracketed*/ !!isOptional, factory.createJSDocTypeExpression(typeNode), /* isNameFirst */ false, { text: "" }));
377+
factory.createJSDocParameterTag(/*tagName*/ undefined, name, /*isBracketed*/ !!isOptional, factory.createJSDocTypeExpression(typeNode), /* isNameFirst */ false, /*comment*/ undefined));
378378
addJSDocTags(changes, sourceFile, signature, paramTags);
379379
}
380380
}

src/services/jsDoc.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ namespace ts.JsDoc {
128128
if (links) {
129129
return mapDefined(links, link => {
130130
if (!link.name) return;
131-
// TODO: Test this, I think getSymbolAtLocation eventually calls checkQualifiedName and then returns resolvedSymbol, but it's hard to be sure
132131
const symbol = checker.getSymbolAtLocation(link.name);
133132
if (!symbol || !symbol.valueDeclaration) return;
134133
return {

src/services/services.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@ namespace ts {
359359
}
360360
}
361361

362-
// TODO: Maybe link symbol resolution should be lazy so this function doesn't need to provide a checker
363362
getJsDocTags(checker: TypeChecker): JSDocTagInfo[] {
364363
if (this.tags === undefined) {
365364
this.tags = JsDoc.getJsDocTagsFromDeclarations(checker, this.declarations);

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,13 +1750,13 @@ declare namespace ts {
17501750
readonly tagName: Identifier;
17511751
readonly comment?: JSDocComment;
17521752
}
1753-
export interface JSDocLinkNode extends Node {
1753+
export interface JSDocLink extends Node {
17541754
readonly kind: SyntaxKind.JSDocLink;
17551755
readonly name?: EntityName;
17561756
}
17571757
export interface JSDocComment {
17581758
text: string;
1759-
links?: JSDocLinkNode[];
1759+
links?: JSDocLink[];
17601760
}
17611761
export interface JSDocUnknownTag extends JSDocTag {
17621762
readonly kind: SyntaxKind.JSDocTag;
@@ -3462,8 +3462,8 @@ declare namespace ts {
34623462
updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression;
34633463
createJSDocNameReference(name: EntityName): JSDocNameReference;
34643464
updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference;
3465-
createJSDocLinkNode(name: EntityName): JSDocLinkNode;
3466-
updateJSDocLinkNode(node: JSDocLinkNode, name: EntityName): JSDocLinkNode;
3465+
createJSDocLinkNode(name: EntityName): JSDocLink;
3466+
updateJSDocLinkNode(node: JSDocLink, name: EntityName): JSDocLink;
34673467
createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral;
34683468
updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral;
34693469
createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature;
@@ -5992,9 +5992,9 @@ declare namespace ts {
59925992
interface JSDocTagInfo {
59935993
name: string;
59945994
text?: string;
5995-
links?: readonly JSDocLink[];
5995+
links?: readonly JSDocLinkInfo[];
59965996
}
5997-
interface JSDocLink extends DocumentSpan {
5997+
interface JSDocLinkInfo extends DocumentSpan {
59985998
target: DocumentSpan;
59995999
}
60006000
interface QuickInfo {
@@ -6003,7 +6003,7 @@ declare namespace ts {
60036003
textSpan: TextSpan;
60046004
displayParts?: SymbolDisplayPart[];
60056005
documentation?: SymbolDisplayPart[];
6006-
tags?: readonly JSDocTagInfo[];
6006+
tags?: JSDocTagInfo[];
60076007
}
60086008
type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
60096009
interface RenameInfoSuccess {
@@ -6050,7 +6050,7 @@ declare namespace ts {
60506050
separatorDisplayParts: SymbolDisplayPart[];
60516051
parameters: SignatureHelpParameter[];
60526052
documentation: SymbolDisplayPart[];
6053-
tags: readonly JSDocTagInfo[];
6053+
tags: JSDocTagInfo[];
60546054
}
60556055
/**
60566056
* Represents a set of signature help items, and the preferred item that should be selected.
@@ -6102,7 +6102,7 @@ declare namespace ts {
61026102
kindModifiers: string;
61036103
displayParts: SymbolDisplayPart[];
61046104
documentation?: SymbolDisplayPart[];
6105-
tags?: readonly JSDocTagInfo[];
6105+
tags?: JSDocTagInfo[];
61066106
codeActions?: CodeAction[];
61076107
source?: SymbolDisplayPart[];
61086108
}
@@ -7204,9 +7204,9 @@ declare namespace ts.server.protocol {
72047204
interface JSDocTagInfo {
72057205
name: string;
72067206
text?: string;
7207-
links?: readonly JSDocLink[];
7207+
links?: JSDocLinkInfo[];
72087208
}
7209-
interface JSDocLink extends DocumentSpan {
7209+
interface JSDocLinkInfo extends DocumentSpan {
72107210
target: FileSpan;
72117211
}
72127212
interface TextSpanWithContext extends TextSpan {
@@ -7936,7 +7936,7 @@ declare namespace ts.server.protocol {
79367936
/**
79377937
* JSDoc tags associated with symbol.
79387938
*/
7939-
tags: readonly JSDocTagInfo[];
7939+
tags: JSDocTagInfo[];
79407940
}
79417941
/**
79427942
* Quickinfo response message.
@@ -8208,7 +8208,7 @@ declare namespace ts.server.protocol {
82088208
/**
82098209
* JSDoc tags for the symbol.
82108210
*/
8211-
tags?: readonly JSDocTagInfo[];
8211+
tags?: JSDocTagInfo[];
82128212
/**
82138213
* The associated code actions for this entry
82148214
*/
@@ -8291,9 +8291,8 @@ declare namespace ts.server.protocol {
82918291
documentation: SymbolDisplayPart[];
82928292
/**
82938293
* The signature's JSDoc tags
8294-
* TODO: Changing this doesn't cause the build to fail! Need tests and probably a scan of session.ts
82958294
*/
8296-
tags: readonly JSDocTagInfo[];
8295+
tags: JSDocTagInfo[];
82978296
}
82988297
/**
82998298
* Signature help items found in the response of a signature help request.

tests/baselines/reference/api/typescript.d.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1750,13 +1750,13 @@ declare namespace ts {
17501750
readonly tagName: Identifier;
17511751
readonly comment?: JSDocComment;
17521752
}
1753-
export interface JSDocLinkNode extends Node {
1753+
export interface JSDocLink extends Node {
17541754
readonly kind: SyntaxKind.JSDocLink;
17551755
readonly name?: EntityName;
17561756
}
17571757
export interface JSDocComment {
17581758
text: string;
1759-
links?: JSDocLinkNode[];
1759+
links?: JSDocLink[];
17601760
}
17611761
export interface JSDocUnknownTag extends JSDocTag {
17621762
readonly kind: SyntaxKind.JSDocTag;
@@ -3462,8 +3462,8 @@ declare namespace ts {
34623462
updateJSDocTypeExpression(node: JSDocTypeExpression, type: TypeNode): JSDocTypeExpression;
34633463
createJSDocNameReference(name: EntityName): JSDocNameReference;
34643464
updateJSDocNameReference(node: JSDocNameReference, name: EntityName): JSDocNameReference;
3465-
createJSDocLinkNode(name: EntityName): JSDocLinkNode;
3466-
updateJSDocLinkNode(node: JSDocLinkNode, name: EntityName): JSDocLinkNode;
3465+
createJSDocLinkNode(name: EntityName): JSDocLink;
3466+
updateJSDocLinkNode(node: JSDocLink, name: EntityName): JSDocLink;
34673467
createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral;
34683468
updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral;
34693469
createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature;
@@ -5992,9 +5992,9 @@ declare namespace ts {
59925992
interface JSDocTagInfo {
59935993
name: string;
59945994
text?: string;
5995-
links?: readonly JSDocLink[];
5995+
links?: readonly JSDocLinkInfo[];
59965996
}
5997-
interface JSDocLink extends DocumentSpan {
5997+
interface JSDocLinkInfo extends DocumentSpan {
59985998
target: DocumentSpan;
59995999
}
60006000
interface QuickInfo {
@@ -6003,7 +6003,7 @@ declare namespace ts {
60036003
textSpan: TextSpan;
60046004
displayParts?: SymbolDisplayPart[];
60056005
documentation?: SymbolDisplayPart[];
6006-
tags?: readonly JSDocTagInfo[];
6006+
tags?: JSDocTagInfo[];
60076007
}
60086008
type RenameInfo = RenameInfoSuccess | RenameInfoFailure;
60096009
interface RenameInfoSuccess {
@@ -6050,7 +6050,7 @@ declare namespace ts {
60506050
separatorDisplayParts: SymbolDisplayPart[];
60516051
parameters: SignatureHelpParameter[];
60526052
documentation: SymbolDisplayPart[];
6053-
tags: readonly JSDocTagInfo[];
6053+
tags: JSDocTagInfo[];
60546054
}
60556055
/**
60566056
* Represents a set of signature help items, and the preferred item that should be selected.
@@ -6102,7 +6102,7 @@ declare namespace ts {
61026102
kindModifiers: string;
61036103
displayParts: SymbolDisplayPart[];
61046104
documentation?: SymbolDisplayPart[];
6105-
tags?: readonly JSDocTagInfo[];
6105+
tags?: JSDocTagInfo[];
61066106
codeActions?: CodeAction[];
61076107
source?: SymbolDisplayPart[];
61086108
}

0 commit comments

Comments
 (0)