diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b57a505c169..b9af8b6dd73 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -39316,7 +39316,7 @@ namespace ts { return undefined; } - const isJSDoc = findAncestor(name, or(isJSDocLink, isJSDocNameReference, isJSDocMemberName)); + const isJSDoc = findAncestor(name, or(isJSDocLinkLike, isJSDocNameReference, isJSDocMemberName)); const meaning = isJSDoc ? SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Value : SymbolFlags.Value; if (name.kind === SyntaxKind.Identifier) { if (isJSXTagName(name) && isJsxIntrinsicIdentifier(name)) { diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index acd801ef97b..7bb3d8f7577 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3785,7 +3785,7 @@ namespace ts { emit(tagName); } - function emitJSDocComment(comment: string | NodeArray | undefined) { + function emitJSDocComment(comment: string | NodeArray | undefined) { const text = getTextOfJSDocComment(comment); if (text) { writeSpace(); diff --git a/src/compiler/factory/nodeFactory.ts b/src/compiler/factory/nodeFactory.ts index 6b7fbfa478d..4b75321a84e 100644 --- a/src/compiler/factory/nodeFactory.ts +++ b/src/compiler/factory/nodeFactory.ts @@ -34,10 +34,10 @@ namespace ts { const getJSDocPrimaryTypeCreateFunction = memoizeOne((kind: T["kind"]) => () => createJSDocPrimaryTypeWorker(kind)); const getJSDocUnaryTypeCreateFunction = memoizeOne((kind: T["kind"]) => (type: T["type"]) => createJSDocUnaryTypeWorker(kind, type)); const getJSDocUnaryTypeUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, type: T["type"]) => updateJSDocUnaryTypeWorker(kind, node, type)); - const getJSDocSimpleTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, comment?: NodeArray) => createJSDocSimpleTagWorker(kind, tagName, comment)); - const getJSDocSimpleTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, comment?: NodeArray) => updateJSDocSimpleTagWorker(kind, node, tagName, comment)); - const getJSDocTypeLikeTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: NodeArray) => createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment)); - const getJSDocTypeLikeTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: NodeArray) => updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment)); + const getJSDocSimpleTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, comment?: NodeArray) => createJSDocSimpleTagWorker(kind, tagName, comment)); + const getJSDocSimpleTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, comment?: NodeArray) => updateJSDocSimpleTagWorker(kind, node, tagName, comment)); + const getJSDocTypeLikeTagCreateFunction = memoizeOne((kind: T["kind"]) => (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: NodeArray) => createJSDocTypeLikeTagWorker(kind, tagName, typeExpression, comment)); + const getJSDocTypeLikeTagUpdateFunction = memoizeOne((kind: T["kind"]) => (node: T, tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: NodeArray) => updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment)); const factory: NodeFactory = { get parenthesizer() { return parenthesizerRules(); }, @@ -349,6 +349,10 @@ namespace ts { updateJSDocMemberName, createJSDocLink, updateJSDocLink, + createJSDocLinkCode, + updateJSDocLinkCode, + createJSDocLinkPlain, + updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(SyntaxKind.JSDocTypeTag); }, get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(SyntaxKind.JSDocTypeTag); }, @@ -4246,7 +4250,7 @@ namespace ts { } // @api - function createBaseJSDocTag(kind: T["kind"], tagName: Identifier, comment: string | NodeArray | undefined) { + function createBaseJSDocTag(kind: T["kind"], tagName: Identifier, comment: string | NodeArray | undefined) { const node = createBaseNode(kind); node.tagName = tagName; node.comment = comment; @@ -4254,7 +4258,7 @@ namespace ts { } // @api - function createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag { + function createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTemplateTag, tagName ?? createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); @@ -4262,7 +4266,7 @@ namespace ts { } // @api - function updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier = getDefaultTagName(node), constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag { + function updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier = getDefaultTagName(node), constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag { return node.tagName !== tagName || node.constraint !== constraint || node.typeParameters !== typeParameters @@ -4272,7 +4276,7 @@ namespace ts { } // @api - function createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag { + function createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTypedefTag, tagName ?? createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; @@ -4281,7 +4285,7 @@ namespace ts { } // @api - function updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag { + function updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -4291,7 +4295,7 @@ namespace ts { } // @api - function createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag { + function createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag { const node = createBaseJSDocTag(SyntaxKind.JSDocParameterTag, tagName ?? createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; @@ -4301,7 +4305,7 @@ namespace ts { } // @api - function updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag { + function updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag { return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -4313,7 +4317,7 @@ namespace ts { } // @api - function createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag { + function createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag { const node = createBaseJSDocTag(SyntaxKind.JSDocPropertyTag, tagName ?? createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; @@ -4323,7 +4327,7 @@ namespace ts { } // @api - function updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag { + function updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier = getDefaultTagName(node), name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag { return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -4335,7 +4339,7 @@ namespace ts { } // @api - function createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag { + function createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag { const node = createBaseJSDocTag(SyntaxKind.JSDocCallbackTag, tagName ?? createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; @@ -4344,7 +4348,7 @@ namespace ts { } // @api - function updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag { + function updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -4354,14 +4358,14 @@ namespace ts { } // @api - function createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag { + function createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag { const node = createBaseJSDocTag(SyntaxKind.JSDocAugmentsTag, tagName ?? createIdentifier("augments"), comment); node.class = className; return node; } // @api - function updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag { + function updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag { return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -4370,21 +4374,21 @@ namespace ts { } // @api - function createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag { + function createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag { const node = createBaseJSDocTag(SyntaxKind.JSDocImplementsTag, tagName ?? createIdentifier("implements"), comment); node.class = className; return node; } // @api - function createJSDocSeeTag(tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag { + function createJSDocSeeTag(tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag { const node = createBaseJSDocTag(SyntaxKind.JSDocSeeTag, tagName ?? createIdentifier("see"), comment); node.name = name; return node; } // @api - function updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag { + function updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, name: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag { return node.tagName !== tagName || node.name !== name || node.comment !== comment @@ -4441,7 +4445,37 @@ namespace ts { } // @api - function updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag { + function createJSDocLinkCode(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkCode { + const node = createBaseNode(SyntaxKind.JSDocLinkCode); + node.name = name; + node.text = text; + return node; + } + + // @api + function updateJSDocLinkCode(node: JSDocLinkCode, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkCode { + return node.name !== name + ? update(createJSDocLinkCode(name, text), node) + : node; + } + + // @api + function createJSDocLinkPlain(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkPlain { + const node = createBaseNode(SyntaxKind.JSDocLinkPlain); + node.name = name; + node.text = text; + return node; + } + + // @api + function updateJSDocLinkPlain(node: JSDocLinkPlain, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkPlain { + return node.name !== name + ? update(createJSDocLinkPlain(name, text), node) + : node; + } + + // @api + function updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier = getDefaultTagName(node), className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag { return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -4457,7 +4491,7 @@ namespace ts { // createJSDocProtectedTag // createJSDocReadonlyTag // createJSDocDeprecatedTag - function createJSDocSimpleTagWorker(kind: T["kind"], tagName: Identifier | undefined, comment?: string | NodeArray) { + function createJSDocSimpleTagWorker(kind: T["kind"], tagName: Identifier | undefined, comment?: string | NodeArray) { const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); return node; } @@ -4470,7 +4504,7 @@ namespace ts { // updateJSDocProtectedTag // updateJSDocReadonlyTag // updateJSDocDeprecatedTag - function updateJSDocSimpleTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), comment: string | NodeArray | undefined) { + function updateJSDocSimpleTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), comment: string | NodeArray | undefined) { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocSimpleTagWorker(kind, tagName, comment), node) : @@ -4482,7 +4516,7 @@ namespace ts { // createJSDocReturnTag // createJSDocThisTag // createJSDocEnumTag - function createJSDocTypeLikeTagWorker(kind: T["kind"], tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray) { + function createJSDocTypeLikeTagWorker(kind: T["kind"], tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray) { const node = createBaseJSDocTag(kind, tagName ?? createIdentifier(getDefaultTagNameForKind(kind)), comment); node.typeExpression = typeExpression; return node; @@ -4493,7 +4527,7 @@ namespace ts { // updateJSDocReturnTag // updateJSDocThisTag // updateJSDocEnumTag - function updateJSDocTypeLikeTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined) { + function updateJSDocTypeLikeTagWorker(kind: T["kind"], node: T, tagName: Identifier = getDefaultTagName(node), typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined) { return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment @@ -4502,13 +4536,13 @@ namespace ts { } // @api - function createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag { + function createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag { const node = createBaseJSDocTag(SyntaxKind.JSDocTag, tagName, comment); return node; } // @api - function updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag { + function updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag { return node.tagName !== tagName || node.comment !== comment ? update(createJSDocUnknownTag(tagName, comment), node) @@ -4530,7 +4564,7 @@ namespace ts { } // @api - function createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined) { + function createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined) { const node = createBaseNode(SyntaxKind.JSDocComment); node.comment = comment; node.tags = asNodeArray(tags); @@ -4538,7 +4572,7 @@ namespace ts { } // @api - function updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined) { + function updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined) { return node.comment !== comment || node.tags !== tags ? update(createJSDocComment(comment, tags), node) diff --git a/src/compiler/factory/nodeTests.ts b/src/compiler/factory/nodeTests.ts index 7bd1dc2f01b..fbe8a1ccd69 100644 --- a/src/compiler/factory/nodeTests.ts +++ b/src/compiler/factory/nodeTests.ts @@ -778,6 +778,14 @@ namespace ts { return node.kind === SyntaxKind.JSDocLink; } + export function isJSDocLinkCode(node: Node): node is JSDocLinkCode { + return node.kind === SyntaxKind.JSDocLinkCode; + } + + export function isJSDocLinkPlain(node: Node): node is JSDocLinkPlain { + return node.kind === SyntaxKind.JSDocLinkPlain; + } + export function isJSDocAllType(node: Node): node is JSDocAllType { return node.kind === SyntaxKind.JSDocAllType; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 8767eb52b58..cf983ee5067 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -481,12 +481,12 @@ namespace ts { return visitNodes(cbNode, cbNodes, (node as JSDocFunctionType).parameters) || visitNode(cbNode, (node as JSDocFunctionType).type); case SyntaxKind.JSDocComment: - return (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)) + return (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)) || visitNodes(cbNode, cbNodes, (node as JSDoc).tags); case SyntaxKind.JSDocSeeTag: return visitNode(cbNode, (node as JSDocSeeTag).tagName) || visitNode(cbNode, (node as JSDocSeeTag).name) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); case SyntaxKind.JSDocNameReference: return visitNode(cbNode, (node as JSDocNameReference).name); case SyntaxKind.JSDocMemberName: @@ -498,54 +498,56 @@ namespace ts { ((node as JSDocPropertyLikeTag).isNameFirst ? visitNode(cbNode, (node as JSDocPropertyLikeTag).name) || visitNode(cbNode, (node as JSDocPropertyLikeTag).typeExpression) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)) + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)) : visitNode(cbNode, (node as JSDocPropertyLikeTag).typeExpression) || visitNode(cbNode, (node as JSDocPropertyLikeTag).name)) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); case SyntaxKind.JSDocAuthorTag: return visitNode(cbNode, (node as JSDocTag).tagName) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); case SyntaxKind.JSDocImplementsTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node as JSDocImplementsTag).class) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); case SyntaxKind.JSDocAugmentsTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node as JSDocAugmentsTag).class) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); case SyntaxKind.JSDocTemplateTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node as JSDocTemplateTag).constraint) || visitNodes(cbNode, cbNodes, (node as JSDocTemplateTag).typeParameters) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); case SyntaxKind.JSDocTypedefTag: return visitNode(cbNode, (node as JSDocTag).tagName) || ((node as JSDocTypedefTag).typeExpression && (node as JSDocTypedefTag).typeExpression!.kind === SyntaxKind.JSDocTypeExpression ? visitNode(cbNode, (node as JSDocTypedefTag).typeExpression) || visitNode(cbNode, (node as JSDocTypedefTag).fullName) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)) + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)) : visitNode(cbNode, (node as JSDocTypedefTag).fullName) || visitNode(cbNode, (node as JSDocTypedefTag).typeExpression)) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); case SyntaxKind.JSDocCallbackTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node as JSDocCallbackTag).fullName) || visitNode(cbNode, (node as JSDocCallbackTag).typeExpression) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); case SyntaxKind.JSDocReturnTag: case SyntaxKind.JSDocTypeTag: case SyntaxKind.JSDocThisTag: case SyntaxKind.JSDocEnumTag: return visitNode(cbNode, (node as JSDocTag).tagName) || visitNode(cbNode, (node as JSDocReturnTag | JSDocTypeTag | JSDocThisTag | JSDocEnumTag).typeExpression) || - (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); case SyntaxKind.JSDocSignature: return forEach((node as JSDocSignature).typeParameters, cbNode) || forEach((node as JSDocSignature).parameters, cbNode) || visitNode(cbNode, (node as JSDocSignature).type); case SyntaxKind.JSDocLink: - return visitNode(cbNode, (node as JSDocLink).name); + case SyntaxKind.JSDocLinkCode: + case SyntaxKind.JSDocLinkPlain: + return visitNode(cbNode, (node as JSDocLink | JSDocLinkCode | JSDocLinkPlain).name); case SyntaxKind.JSDocTypeLiteral: return forEach((node as JSDocTypeLiteral).jsDocPropertyTags, cbNode); case SyntaxKind.JSDocTag: @@ -556,7 +558,7 @@ namespace ts { case SyntaxKind.JSDocReadonlyTag: case SyntaxKind.JSDocDeprecatedTag: return visitNode(cbNode, (node as JSDocTag).tagName) - || (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); + || (typeof (node as JSDoc).comment === "string" ? undefined : visitNodes(cbNode, cbNodes, (node as JSDoc).comment as NodeArray | undefined)); case SyntaxKind.PartiallyEmittedExpression: return visitNode(cbNode, (node as PartiallyEmittedExpression).expression); } @@ -7425,7 +7427,7 @@ namespace ts { let linkEnd: number; let commentsPos: number | undefined; let comments: string[] = []; - const parts: (JSDocLink | JSDocText)[] = []; + const parts: JSDocComment[] = []; // + 3 for leading /**, - 5 in total for /** */ return scanner.scanRange(start + 3, length - 5, () => { @@ -7681,10 +7683,10 @@ namespace ts { return parseTagComments(margin, indentText.slice(margin)); } - function parseTagComments(indent: number, initialMargin?: string): string | NodeArray | undefined { + function parseTagComments(indent: number, initialMargin?: string): string | NodeArray | undefined { const commentsPos = getNodePos(); let comments: string[] = []; - const parts: (JSDocLink | JSDocText)[] = []; + const parts: JSDocComment[] = []; let linkEnd; let state = JSDocState.BeginningOfLine; let previousWhitespace = true; @@ -7800,7 +7802,8 @@ namespace ts { } function parseJSDocLink(start: number) { - if (!tryParse(parseJSDocLinkPrefix)) { + const linkType = tryParse(parseJSDocLinkPrefix); + if (!linkType) { return undefined; } nextTokenJSDoc(); // start at token after link, then skip any whitespace @@ -7822,15 +7825,22 @@ namespace ts { text.push(scanner.getTokenText()); nextTokenJSDoc(); } - return finishNode(factory.createJSDocLink(name, text.join("")), start, scanner.getTextPos()); + const create = linkType === "link" ? factory.createJSDocLink + : linkType === "linkcode" ? factory.createJSDocLinkCode + : factory.createJSDocLinkPlain; + return finishNode(create(name, text.join("")), start, scanner.getTextPos()); } function parseJSDocLinkPrefix() { skipWhitespaceOrAsterisk(); - return token() === SyntaxKind.OpenBraceToken + if (token() === SyntaxKind.OpenBraceToken && nextTokenJSDoc() === SyntaxKind.AtToken - && tokenIsIdentifierOrKeyword(nextTokenJSDoc()) - && scanner.getTokenValue() === "link"; + && tokenIsIdentifierOrKeyword(nextTokenJSDoc())) { + const kind = scanner.getTokenValue(); + if(kind === "link" || kind === "linkcode" || kind === "linkplain") { + return kind; + } + } } function parseUnknownTag(start: number, tagName: Identifier, indent: number, indentText: string) { @@ -7969,7 +7979,7 @@ namespace ts { commentEnd = scanner.getStartPos(); } const allParts = typeof comments !== "string" - ? createNodeArray(concatenate([finishNode(textOnly, commentStart, commentEnd)], comments) as (JSDocText | JSDocLink)[], commentStart) // cast away readonly + ? createNodeArray(concatenate([finishNode(textOnly, commentStart, commentEnd)], comments) as JSDocComment[], commentStart) // cast away readonly : textOnly.text + comments; return finishNode(factory.createJSDocAuthorTag(tagName, allParts), start); } @@ -8030,7 +8040,7 @@ namespace ts { return node; } - function parseSimpleTag(start: number, createTag: (tagName: Identifier | undefined, comment?: string | NodeArray) => JSDocTag, tagName: Identifier, margin: number, indentText: string): JSDocTag { + function parseSimpleTag(start: number, createTag: (tagName: Identifier | undefined, comment?: string | NodeArray) => JSDocTag, tagName: Identifier, margin: number, indentText: string): JSDocTag { return finishNode(createTag(tagName, parseTrailingTagComments(start, getNodePos(), margin, indentText)), start); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 1bea370566c..f395014baad 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -378,6 +378,8 @@ namespace ts { JSDocTypeLiteral, JSDocSignature, JSDocLink, + JSDocLinkCode, + JSDocLinkPlain, JSDocTag, JSDocAugmentsTag, JSDocImplementsTag, @@ -3190,13 +3192,13 @@ namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: string | NodeArray; + readonly comment?: string | NodeArray; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: string | NodeArray; + readonly comment?: string | NodeArray; } export interface JSDocLink extends Node { @@ -3205,6 +3207,20 @@ namespace ts { text: string; } + export interface JSDocLinkCode extends Node { + readonly kind: SyntaxKind.JSDocLinkCode; + readonly name?: EntityName | JSDocMemberName; + text: string; + } + + export interface JSDocLinkPlain extends Node { + readonly kind: SyntaxKind.JSDocLinkPlain; + readonly name?: EntityName | JSDocMemberName; + text: string; + } + + export type JSDocComment = JSDocText | JSDocLink | JSDocLinkCode | JSDocLinkPlain; + export interface JSDocText extends Node { readonly kind: SyntaxKind.JSDocText; text: string; @@ -7297,56 +7313,60 @@ namespace ts { updateJSDocMemberName(node: JSDocMemberName, left: EntityName | JSDocMemberName, right: Identifier): JSDocMemberName; createJSDocLink(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLink; updateJSDocLink(node: JSDocLink, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLink; + createJSDocLinkCode(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkCode; + updateJSDocLinkCode(node: JSDocLinkCode, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkCode; + createJSDocLinkPlain(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkPlain; + updateJSDocLinkPlain(node: JSDocLinkPlain, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkPlain; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; - createJSDocOverrideTag(tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; - updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + createJSDocOverrideTag(tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; + updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; createJSDocText(text: string): JSDocText; updateJSDocText(node: JSDocText, text: string): JSDocText; - createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; // // JSX diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 71a1fda5509..0e1fde7d4cd 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -1898,14 +1898,14 @@ namespace ts { while (node.parent.kind === SyntaxKind.QualifiedName) { node = node.parent; } - return node.parent.kind === SyntaxKind.TypeQuery || isJSDocLink(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === SyntaxKind.TypeQuery || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); case SyntaxKind.JSDocMemberName: while (isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === SyntaxKind.TypeQuery || isJSDocLink(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === SyntaxKind.TypeQuery || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node); case SyntaxKind.Identifier: - if (node.parent.kind === SyntaxKind.TypeQuery || isJSDocLink(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === SyntaxKind.TypeQuery || isJSDocLinkLike(node.parent) || isJSDocNameReference(node.parent) || isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through diff --git a/src/compiler/utilitiesPublic.ts b/src/compiler/utilitiesPublic.ts index 85bfb7f6ccf..b1569085379 100644 --- a/src/compiler/utilitiesPublic.ts +++ b/src/compiler/utilitiesPublic.ts @@ -901,9 +901,10 @@ namespace ts { } /** Gets the text of a jsdoc comment, flattening links to their text. */ - export function getTextOfJSDocComment(comment?: string | NodeArray) { + export function getTextOfJSDocComment(comment?: string | NodeArray) { return typeof comment === "string" ? comment : comment?.map(c => + // TODO: Other kinds here c.kind === SyntaxKind.JSDocText ? c.text : `{@link ${c.name ? entityNameToString(c.name) + " " : ""}${c.text}}`).join(""); } @@ -1875,7 +1876,7 @@ namespace ts { return node.kind === SyntaxKind.JSDocComment || node.kind === SyntaxKind.JSDocNamepathType || node.kind === SyntaxKind.JSDocText - || node.kind === SyntaxKind.JSDocLink + || isJSDocLinkLike(node) || isJSDocTag(node) || isJSDocTypeLiteral(node) || isJSDocSignature(node); @@ -1968,5 +1969,8 @@ namespace ts { return node.kind === SyntaxKind.StringLiteral || node.kind === SyntaxKind.NoSubstitutionTemplateLiteral; } + export function isJSDocLinkLike(node: Node): node is JSDocLink | JSDocLinkCode | JSDocLinkPlain { + return node.kind === SyntaxKind.JSDocLink || node.kind === SyntaxKind.JSDocLinkCode || node.kind === SyntaxKind.JSDocLinkPlain; + } // #endregion } diff --git a/src/services/codefixes/inferFromUsage.ts b/src/services/codefixes/inferFromUsage.ts index f9eaefcebab..15f64a271cd 100644 --- a/src/services/codefixes/inferFromUsage.ts +++ b/src/services/codefixes/inferFromUsage.ts @@ -282,6 +282,7 @@ namespace ts.codefix { program: Program, host: LanguageServiceHost, cancellationToken: CancellationToken, + ): void { const param = firstOrUndefined(setAccessorDeclaration.parameters); if (param && isIdentifier(setAccessorDeclaration.name) && isIdentifier(param.name)) { @@ -380,7 +381,7 @@ namespace ts.codefix { } export function addJSDocTags(changes: textChanges.ChangeTracker, sourceFile: SourceFile, parent: HasJSDoc, newTags: readonly JSDocTag[]): void { - const comments = flatMap(parent.jsDoc, j => typeof j.comment === "string" ? factory.createJSDocText(j.comment) : j.comment) as (JSDocText | JSDocLink)[]; + const comments = flatMap(parent.jsDoc, j => typeof j.comment === "string" ? factory.createJSDocText(j.comment) : j.comment) as JSDocComment[]; const oldTags = flatMapToMutable(parent.jsDoc, j => j.tags); const unmergedNewTags = newTags.filter(newTag => !oldTags || !oldTags.some((tag, i) => { const merged = tryMergeJsdocTags(tag, newTag); diff --git a/src/services/jsDoc.ts b/src/services/jsDoc.ts index e32c9a08a7b..a10f736f25b 100644 --- a/src/services/jsDoc.ts +++ b/src/services/jsDoc.ts @@ -131,7 +131,7 @@ namespace ts.JsDoc { return tags; } - function getDisplayPartsFromComment(comment: string | readonly (JSDocText | JSDocLink)[], checker: TypeChecker | undefined): SymbolDisplayPart[] { + function getDisplayPartsFromComment(comment: string | readonly JSDocComment[], checker: TypeChecker | undefined): SymbolDisplayPart[] { if (typeof comment === "string") { return [textPart(comment)]; } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 6016ad9f70d..6ffa3607c8c 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -105,7 +105,7 @@ namespace ts { else if (isDeclarationName(node)) { return getMeaningFromDeclaration(node.parent); } - else if (isEntityName(node) && findAncestor(node, or(isJSDocNameReference, isJSDocLink, isJSDocMemberName))) { + else if (isEntityName(node) && findAncestor(node, or(isJSDocNameReference, isJSDocLinkLike, isJSDocMemberName))) { return SemanticMeaning.All; } else if (isTypeReference(node)) { @@ -2233,8 +2233,11 @@ namespace ts { return displayPart(text, SymbolDisplayPartKind.link); } - export function buildLinkParts(link: JSDocLink, checker?: TypeChecker): SymbolDisplayPart[] { - const parts = [linkPart("{@link ")]; + export function buildLinkParts(link: JSDocLink | JSDocLinkCode | JSDocLinkPlain, checker?: TypeChecker): SymbolDisplayPart[] { + const prefix = isJSDocLink(link) ? "link" + : isJSDocLinkCode(link) ? "linkcode" + : "linkplain"; + const parts = [linkPart(`{@${prefix} `)]; if (!link.name) { if (link.text) {parts.push(linkTextPart(link.text));} } diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 8cf0e4b30d1..dcbd016c31e 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -424,35 +424,37 @@ declare namespace ts { JSDocTypeLiteral = 316, JSDocSignature = 317, JSDocLink = 318, - JSDocTag = 319, - JSDocAugmentsTag = 320, - JSDocImplementsTag = 321, - JSDocAuthorTag = 322, - JSDocDeprecatedTag = 323, - JSDocClassTag = 324, - JSDocPublicTag = 325, - JSDocPrivateTag = 326, - JSDocProtectedTag = 327, - JSDocReadonlyTag = 328, - JSDocOverrideTag = 329, - JSDocCallbackTag = 330, - JSDocEnumTag = 331, - JSDocParameterTag = 332, - JSDocReturnTag = 333, - JSDocThisTag = 334, - JSDocTypeTag = 335, - JSDocTemplateTag = 336, - JSDocTypedefTag = 337, - JSDocSeeTag = 338, - JSDocPropertyTag = 339, - SyntaxList = 340, - NotEmittedStatement = 341, - PartiallyEmittedExpression = 342, - CommaListExpression = 343, - MergeDeclarationMarker = 344, - EndOfDeclarationMarker = 345, - SyntheticReferenceExpression = 346, - Count = 347, + JSDocLinkCode = 319, + JSDocLinkPlain = 320, + JSDocTag = 321, + JSDocAugmentsTag = 322, + JSDocImplementsTag = 323, + JSDocAuthorTag = 324, + JSDocDeprecatedTag = 325, + JSDocClassTag = 326, + JSDocPublicTag = 327, + JSDocPrivateTag = 328, + JSDocProtectedTag = 329, + JSDocReadonlyTag = 330, + JSDocOverrideTag = 331, + JSDocCallbackTag = 332, + JSDocEnumTag = 333, + JSDocParameterTag = 334, + JSDocReturnTag = 335, + JSDocThisTag = 336, + JSDocTypeTag = 337, + JSDocTemplateTag = 338, + JSDocTypedefTag = 339, + JSDocSeeTag = 340, + JSDocPropertyTag = 341, + SyntaxList = 342, + NotEmittedStatement = 343, + PartiallyEmittedExpression = 344, + CommaListExpression = 345, + MergeDeclarationMarker = 346, + EndOfDeclarationMarker = 347, + SyntheticReferenceExpression = 348, + Count = 349, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -481,9 +483,9 @@ declare namespace ts { LastStatement = 250, FirstNode = 159, FirstJSDocNode = 303, - LastJSDocNode = 339, - FirstJSDocTagNode = 319, - LastJSDocTagNode = 339, + LastJSDocNode = 341, + FirstJSDocTagNode = 321, + LastJSDocTagNode = 341, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; @@ -1758,18 +1760,29 @@ declare namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: string | NodeArray; + readonly comment?: string | NodeArray; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: string | NodeArray; + readonly comment?: string | NodeArray; } export interface JSDocLink extends Node { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName | JSDocMemberName; text: string; } + export interface JSDocLinkCode extends Node { + readonly kind: SyntaxKind.JSDocLinkCode; + readonly name?: EntityName | JSDocMemberName; + text: string; + } + export interface JSDocLinkPlain extends Node { + readonly kind: SyntaxKind.JSDocLinkPlain; + readonly name?: EntityName | JSDocMemberName; + text: string; + } + export type JSDocComment = JSDocText | JSDocLink | JSDocLinkCode | JSDocLinkPlain; export interface JSDocText extends Node { readonly kind: SyntaxKind.JSDocText; text: string; @@ -3511,56 +3524,60 @@ declare namespace ts { updateJSDocMemberName(node: JSDocMemberName, left: EntityName | JSDocMemberName, right: Identifier): JSDocMemberName; createJSDocLink(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLink; updateJSDocLink(node: JSDocLink, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLink; + createJSDocLinkCode(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkCode; + updateJSDocLinkCode(node: JSDocLinkCode, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkCode; + createJSDocLinkPlain(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkPlain; + updateJSDocLinkPlain(node: JSDocLinkPlain, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkPlain; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; - createJSDocOverrideTag(tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; - updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + createJSDocOverrideTag(tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; + updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; createJSDocText(text: string): JSDocText; updateJSDocText(node: JSDocText, text: string): JSDocText; - createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; @@ -4248,7 +4265,7 @@ declare namespace ts { /** Gets all JSDoc tags of a specified kind */ function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): readonly JSDocTag[]; /** Gets the text of a jsdoc comment, flattening links to their text. */ - function getTextOfJSDocComment(comment?: string | NodeArray): string | undefined; + function getTextOfJSDocComment(comment?: string | NodeArray): string | undefined; /** * Gets the effective type parameters. If the node was parsed in a * JavaScript file, gets the type parameters from the `@template` tag from JSDoc. @@ -4323,6 +4340,7 @@ declare namespace ts { function hasOnlyExpressionInitializer(node: Node): node is HasExpressionInitializer; function isObjectLiteralElement(node: Node): node is ObjectLiteralElement; function isStringLiteralLike(node: Node): node is StringLiteralLike; + function isJSDocLinkLike(node: Node): node is JSDocLink | JSDocLinkCode | JSDocLinkPlain; } declare namespace ts { const factory: NodeFactory; @@ -4570,6 +4588,8 @@ declare namespace ts { function isJSDocNameReference(node: Node): node is JSDocNameReference; function isJSDocMemberName(node: Node): node is JSDocMemberName; function isJSDocLink(node: Node): node is JSDocLink; + function isJSDocLinkCode(node: Node): node is JSDocLinkCode; + function isJSDocLinkPlain(node: Node): node is JSDocLinkPlain; function isJSDocAllType(node: Node): node is JSDocAllType; function isJSDocUnknownType(node: Node): node is JSDocUnknownType; function isJSDocNullableType(node: Node): node is JSDocNullableType; @@ -10847,51 +10867,51 @@ declare namespace ts { /** @deprecated Use `factory.createJSDocTypeExpression` or the factory supplied by your transformation context instead. */ const createJSDocTypeExpression: (type: TypeNode) => JSDocTypeExpression; /** @deprecated Use `factory.createJSDocTypeTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocTypeTag; + const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocTypeTag; /** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */ - const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | NodeArray | undefined) => JSDocReturnTag; + const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | NodeArray | undefined) => JSDocReturnTag; /** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */ - const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocThisTag; + const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocThisTag; /** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */ - const createJSDocComment: (comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; + const createJSDocComment: (comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ - const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocParameterTag; + const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocParameterTag; /** @deprecated Use `factory.createJSDocClassTag` or the factory supplied by your transformation context instead. */ - const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocClassTag; + const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocClassTag; /** @deprecated Use `factory.createJSDocAugmentsTag` or the factory supplied by your transformation context instead. */ const createJSDocAugmentsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | NodeArray | undefined) => JSDocAugmentsTag; + }, comment?: string | NodeArray | undefined) => JSDocAugmentsTag; /** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */ - const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocEnumTag; + const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocEnumTag; /** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */ - const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray | undefined) => JSDocTemplateTag; + const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray | undefined) => JSDocTemplateTag; /** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocTypedefTag; + const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocTypedefTag; /** @deprecated Use `factory.createJSDocCallbackTag` or the factory supplied by your transformation context instead. */ - const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocCallbackTag; + const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocCallbackTag; /** @deprecated Use `factory.createJSDocSignature` or the factory supplied by your transformation context instead. */ const createJSDocSignature: (typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag | undefined) => JSDocSignature; /** @deprecated Use `factory.createJSDocPropertyTag` or the factory supplied by your transformation context instead. */ - const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocPropertyTag; + const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocPropertyTag; /** @deprecated Use `factory.createJSDocTypeLiteral` or the factory supplied by your transformation context instead. */ const createJSDocTypeLiteral: (jsDocPropertyTags?: readonly JSDocPropertyLikeTag[] | undefined, isArrayType?: boolean | undefined) => JSDocTypeLiteral; /** @deprecated Use `factory.createJSDocImplementsTag` or the factory supplied by your transformation context instead. */ const createJSDocImplementsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | NodeArray | undefined) => JSDocImplementsTag; + }, comment?: string | NodeArray | undefined) => JSDocImplementsTag; /** @deprecated Use `factory.createJSDocAuthorTag` or the factory supplied by your transformation context instead. */ - const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocAuthorTag; + const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocAuthorTag; /** @deprecated Use `factory.createJSDocPublicTag` or the factory supplied by your transformation context instead. */ - const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPublicTag; + const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPublicTag; /** @deprecated Use `factory.createJSDocPrivateTag` or the factory supplied by your transformation context instead. */ - const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPrivateTag; + const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPrivateTag; /** @deprecated Use `factory.createJSDocProtectedTag` or the factory supplied by your transformation context instead. */ - const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocProtectedTag; + const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocProtectedTag; /** @deprecated Use `factory.createJSDocReadonlyTag` or the factory supplied by your transformation context instead. */ - const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocReadonlyTag; + const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocReadonlyTag; /** @deprecated Use `factory.createJSDocUnknownTag` or the factory supplied by your transformation context instead. */ - const createJSDocTag: (tagName: Identifier, comment?: string | NodeArray | undefined) => JSDocUnknownTag; + const createJSDocTag: (tagName: Identifier, comment?: string | NodeArray | undefined) => JSDocUnknownTag; /** @deprecated Use `factory.createJsxElement` or the factory supplied by your transformation context instead. */ const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement; /** @deprecated Use `factory.updateJsxElement` or the factory supplied by your transformation context instead. */ diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 3d66425c7b5..a3d17250a21 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -424,35 +424,37 @@ declare namespace ts { JSDocTypeLiteral = 316, JSDocSignature = 317, JSDocLink = 318, - JSDocTag = 319, - JSDocAugmentsTag = 320, - JSDocImplementsTag = 321, - JSDocAuthorTag = 322, - JSDocDeprecatedTag = 323, - JSDocClassTag = 324, - JSDocPublicTag = 325, - JSDocPrivateTag = 326, - JSDocProtectedTag = 327, - JSDocReadonlyTag = 328, - JSDocOverrideTag = 329, - JSDocCallbackTag = 330, - JSDocEnumTag = 331, - JSDocParameterTag = 332, - JSDocReturnTag = 333, - JSDocThisTag = 334, - JSDocTypeTag = 335, - JSDocTemplateTag = 336, - JSDocTypedefTag = 337, - JSDocSeeTag = 338, - JSDocPropertyTag = 339, - SyntaxList = 340, - NotEmittedStatement = 341, - PartiallyEmittedExpression = 342, - CommaListExpression = 343, - MergeDeclarationMarker = 344, - EndOfDeclarationMarker = 345, - SyntheticReferenceExpression = 346, - Count = 347, + JSDocLinkCode = 319, + JSDocLinkPlain = 320, + JSDocTag = 321, + JSDocAugmentsTag = 322, + JSDocImplementsTag = 323, + JSDocAuthorTag = 324, + JSDocDeprecatedTag = 325, + JSDocClassTag = 326, + JSDocPublicTag = 327, + JSDocPrivateTag = 328, + JSDocProtectedTag = 329, + JSDocReadonlyTag = 330, + JSDocOverrideTag = 331, + JSDocCallbackTag = 332, + JSDocEnumTag = 333, + JSDocParameterTag = 334, + JSDocReturnTag = 335, + JSDocThisTag = 336, + JSDocTypeTag = 337, + JSDocTemplateTag = 338, + JSDocTypedefTag = 339, + JSDocSeeTag = 340, + JSDocPropertyTag = 341, + SyntaxList = 342, + NotEmittedStatement = 343, + PartiallyEmittedExpression = 344, + CommaListExpression = 345, + MergeDeclarationMarker = 346, + EndOfDeclarationMarker = 347, + SyntheticReferenceExpression = 348, + Count = 349, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -481,9 +483,9 @@ declare namespace ts { LastStatement = 250, FirstNode = 159, FirstJSDocNode = 303, - LastJSDocNode = 339, - FirstJSDocTagNode = 319, - LastJSDocTagNode = 339, + LastJSDocNode = 341, + FirstJSDocTagNode = 321, + LastJSDocTagNode = 341, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; @@ -1758,18 +1760,29 @@ declare namespace ts { readonly kind: SyntaxKind.JSDocComment; readonly parent: HasJSDoc; readonly tags?: NodeArray; - readonly comment?: string | NodeArray; + readonly comment?: string | NodeArray; } export interface JSDocTag extends Node { readonly parent: JSDoc | JSDocTypeLiteral; readonly tagName: Identifier; - readonly comment?: string | NodeArray; + readonly comment?: string | NodeArray; } export interface JSDocLink extends Node { readonly kind: SyntaxKind.JSDocLink; readonly name?: EntityName | JSDocMemberName; text: string; } + export interface JSDocLinkCode extends Node { + readonly kind: SyntaxKind.JSDocLinkCode; + readonly name?: EntityName | JSDocMemberName; + text: string; + } + export interface JSDocLinkPlain extends Node { + readonly kind: SyntaxKind.JSDocLinkPlain; + readonly name?: EntityName | JSDocMemberName; + text: string; + } + export type JSDocComment = JSDocText | JSDocLink | JSDocLinkCode | JSDocLinkPlain; export interface JSDocText extends Node { readonly kind: SyntaxKind.JSDocText; text: string; @@ -3511,56 +3524,60 @@ declare namespace ts { updateJSDocMemberName(node: JSDocMemberName, left: EntityName | JSDocMemberName, right: Identifier): JSDocMemberName; createJSDocLink(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLink; updateJSDocLink(node: JSDocLink, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLink; + createJSDocLinkCode(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkCode; + updateJSDocLinkCode(node: JSDocLinkCode, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkCode; + createJSDocLinkPlain(name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkPlain; + updateJSDocLinkPlain(node: JSDocLinkPlain, name: EntityName | JSDocMemberName | undefined, text: string): JSDocLinkPlain; createJSDocTypeLiteral(jsDocPropertyTags?: readonly JSDocPropertyLikeTag[], isArrayType?: boolean): JSDocTypeLiteral; updateJSDocTypeLiteral(node: JSDocTypeLiteral, jsDocPropertyTags: readonly JSDocPropertyLikeTag[] | undefined, isArrayType: boolean | undefined): JSDocTypeLiteral; createJSDocSignature(typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag): JSDocSignature; updateJSDocSignature(node: JSDocSignature, typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type: JSDocReturnTag | undefined): JSDocSignature; - createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag; - updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag; - createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag; - updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag; - createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag; - updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag; - createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag; - updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag; - createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocTypeTag; - updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocTypeTag; - createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; - updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; - createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray): JSDocReturnTag; - updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocReturnTag; - createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocThisTag; - updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocThisTag; - createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocEnumTag; - updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocEnumTag; - createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag; - updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag; - createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag; - updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag; - createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag; - updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag; - createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocAuthorTag; - updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocAuthorTag; - createJSDocClassTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocClassTag; - updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocClassTag; - createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPublicTag; - updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPublicTag; - createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPrivateTag; - updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPrivateTag; - createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocProtectedTag; - updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocProtectedTag; - createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocReadonlyTag; - updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocReadonlyTag; - createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag; - updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag; - createJSDocDeprecatedTag(tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; - updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; - createJSDocOverrideTag(tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; - updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; + createJSDocTemplateTag(tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray): JSDocTemplateTag; + updateJSDocTemplateTag(node: JSDocTemplateTag, tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment: string | NodeArray | undefined): JSDocTemplateTag; + createJSDocTypedefTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | JSDocTypeLiteral, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocTypedefTag; + updateJSDocTypedefTag(node: JSDocTypedefTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | JSDocTypeLiteral | undefined, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocTypedefTag; + createJSDocParameterTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocParameterTag; + updateJSDocParameterTag(node: JSDocParameterTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocParameterTag; + createJSDocPropertyTag(tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression, isNameFirst?: boolean, comment?: string | NodeArray): JSDocPropertyTag; + updateJSDocPropertyTag(node: JSDocPropertyTag, tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression: JSDocTypeExpression | undefined, isNameFirst: boolean, comment: string | NodeArray | undefined): JSDocPropertyTag; + createJSDocTypeTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocTypeTag; + updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocTypeTag; + createJSDocSeeTag(tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + updateJSDocSeeTag(node: JSDocSeeTag, tagName: Identifier | undefined, nameExpression: JSDocNameReference | undefined, comment?: string | NodeArray): JSDocSeeTag; + createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string | NodeArray): JSDocReturnTag; + updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocReturnTag; + createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocThisTag; + updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | NodeArray | undefined): JSDocThisTag; + createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray): JSDocEnumTag; + updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | NodeArray | undefined): JSDocEnumTag; + createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string | NodeArray): JSDocCallbackTag; + updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | NodeArray | undefined): JSDocCallbackTag; + createJSDocAugmentsTag(tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment?: string | NodeArray): JSDocAugmentsTag; + updateJSDocAugmentsTag(node: JSDocAugmentsTag, tagName: Identifier | undefined, className: JSDocAugmentsTag["class"], comment: string | NodeArray | undefined): JSDocAugmentsTag; + createJSDocImplementsTag(tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment?: string | NodeArray): JSDocImplementsTag; + updateJSDocImplementsTag(node: JSDocImplementsTag, tagName: Identifier | undefined, className: JSDocImplementsTag["class"], comment: string | NodeArray | undefined): JSDocImplementsTag; + createJSDocAuthorTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocAuthorTag; + updateJSDocAuthorTag(node: JSDocAuthorTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocAuthorTag; + createJSDocClassTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocClassTag; + updateJSDocClassTag(node: JSDocClassTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocClassTag; + createJSDocPublicTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPublicTag; + updateJSDocPublicTag(node: JSDocPublicTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPublicTag; + createJSDocPrivateTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocPrivateTag; + updateJSDocPrivateTag(node: JSDocPrivateTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocPrivateTag; + createJSDocProtectedTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocProtectedTag; + updateJSDocProtectedTag(node: JSDocProtectedTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocProtectedTag; + createJSDocReadonlyTag(tagName: Identifier | undefined, comment?: string | NodeArray): JSDocReadonlyTag; + updateJSDocReadonlyTag(node: JSDocReadonlyTag, tagName: Identifier | undefined, comment: string | NodeArray | undefined): JSDocReadonlyTag; + createJSDocUnknownTag(tagName: Identifier, comment?: string | NodeArray): JSDocUnknownTag; + updateJSDocUnknownTag(node: JSDocUnknownTag, tagName: Identifier, comment: string | NodeArray | undefined): JSDocUnknownTag; + createJSDocDeprecatedTag(tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + updateJSDocDeprecatedTag(node: JSDocDeprecatedTag, tagName: Identifier, comment?: string | NodeArray): JSDocDeprecatedTag; + createJSDocOverrideTag(tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; + updateJSDocOverrideTag(node: JSDocOverrideTag, tagName: Identifier, comment?: string | NodeArray): JSDocOverrideTag; createJSDocText(text: string): JSDocText; updateJSDocText(node: JSDocText, text: string): JSDocText; - createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; - updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; + createJSDocComment(comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined): JSDoc; + updateJSDocComment(node: JSDoc, comment: string | NodeArray | undefined, tags: readonly JSDocTag[] | undefined): JSDoc; createJsxElement(openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; updateJsxElement(node: JsxElement, openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement): JsxElement; createJsxSelfClosingElement(tagName: JsxTagNameExpression, typeArguments: readonly TypeNode[] | undefined, attributes: JsxAttributes): JsxSelfClosingElement; @@ -4248,7 +4265,7 @@ declare namespace ts { /** Gets all JSDoc tags of a specified kind */ function getAllJSDocTagsOfKind(node: Node, kind: SyntaxKind): readonly JSDocTag[]; /** Gets the text of a jsdoc comment, flattening links to their text. */ - function getTextOfJSDocComment(comment?: string | NodeArray): string | undefined; + function getTextOfJSDocComment(comment?: string | NodeArray): string | undefined; /** * Gets the effective type parameters. If the node was parsed in a * JavaScript file, gets the type parameters from the `@template` tag from JSDoc. @@ -4323,6 +4340,7 @@ declare namespace ts { function hasOnlyExpressionInitializer(node: Node): node is HasExpressionInitializer; function isObjectLiteralElement(node: Node): node is ObjectLiteralElement; function isStringLiteralLike(node: Node): node is StringLiteralLike; + function isJSDocLinkLike(node: Node): node is JSDocLink | JSDocLinkCode | JSDocLinkPlain; } declare namespace ts { const factory: NodeFactory; @@ -4570,6 +4588,8 @@ declare namespace ts { function isJSDocNameReference(node: Node): node is JSDocNameReference; function isJSDocMemberName(node: Node): node is JSDocMemberName; function isJSDocLink(node: Node): node is JSDocLink; + function isJSDocLinkCode(node: Node): node is JSDocLinkCode; + function isJSDocLinkPlain(node: Node): node is JSDocLinkPlain; function isJSDocAllType(node: Node): node is JSDocAllType; function isJSDocUnknownType(node: Node): node is JSDocUnknownType; function isJSDocNullableType(node: Node): node is JSDocNullableType; @@ -7085,51 +7105,51 @@ declare namespace ts { /** @deprecated Use `factory.createJSDocTypeExpression` or the factory supplied by your transformation context instead. */ const createJSDocTypeExpression: (type: TypeNode) => JSDocTypeExpression; /** @deprecated Use `factory.createJSDocTypeTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocTypeTag; + const createJSDocTypeTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocTypeTag; /** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */ - const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | NodeArray | undefined) => JSDocReturnTag; + const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | NodeArray | undefined) => JSDocReturnTag; /** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */ - const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocThisTag; + const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocThisTag; /** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */ - const createJSDocComment: (comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; + const createJSDocComment: (comment?: string | NodeArray | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc; /** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */ - const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocParameterTag; + const createJSDocParameterTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocParameterTag; /** @deprecated Use `factory.createJSDocClassTag` or the factory supplied by your transformation context instead. */ - const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocClassTag; + const createJSDocClassTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocClassTag; /** @deprecated Use `factory.createJSDocAugmentsTag` or the factory supplied by your transformation context instead. */ const createJSDocAugmentsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | NodeArray | undefined) => JSDocAugmentsTag; + }, comment?: string | NodeArray | undefined) => JSDocAugmentsTag; /** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */ - const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocEnumTag; + const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | NodeArray | undefined) => JSDocEnumTag; /** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */ - const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray | undefined) => JSDocTemplateTag; + const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | NodeArray | undefined) => JSDocTemplateTag; /** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */ - const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocTypedefTag; + const createJSDocTypedefTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeLiteral | JSDocTypeExpression | undefined, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocTypedefTag; /** @deprecated Use `factory.createJSDocCallbackTag` or the factory supplied by your transformation context instead. */ - const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocCallbackTag; + const createJSDocCallbackTag: (tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration | undefined, comment?: string | NodeArray | undefined) => JSDocCallbackTag; /** @deprecated Use `factory.createJSDocSignature` or the factory supplied by your transformation context instead. */ const createJSDocSignature: (typeParameters: readonly JSDocTemplateTag[] | undefined, parameters: readonly JSDocParameterTag[], type?: JSDocReturnTag | undefined) => JSDocSignature; /** @deprecated Use `factory.createJSDocPropertyTag` or the factory supplied by your transformation context instead. */ - const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocPropertyTag; + const createJSDocPropertyTag: (tagName: Identifier | undefined, name: EntityName, isBracketed: boolean, typeExpression?: JSDocTypeExpression | undefined, isNameFirst?: boolean | undefined, comment?: string | NodeArray | undefined) => JSDocPropertyTag; /** @deprecated Use `factory.createJSDocTypeLiteral` or the factory supplied by your transformation context instead. */ const createJSDocTypeLiteral: (jsDocPropertyTags?: readonly JSDocPropertyLikeTag[] | undefined, isArrayType?: boolean | undefined) => JSDocTypeLiteral; /** @deprecated Use `factory.createJSDocImplementsTag` or the factory supplied by your transformation context instead. */ const createJSDocImplementsTag: (tagName: Identifier | undefined, className: ExpressionWithTypeArguments & { readonly expression: Identifier | PropertyAccessEntityNameExpression; - }, comment?: string | NodeArray | undefined) => JSDocImplementsTag; + }, comment?: string | NodeArray | undefined) => JSDocImplementsTag; /** @deprecated Use `factory.createJSDocAuthorTag` or the factory supplied by your transformation context instead. */ - const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocAuthorTag; + const createJSDocAuthorTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocAuthorTag; /** @deprecated Use `factory.createJSDocPublicTag` or the factory supplied by your transformation context instead. */ - const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPublicTag; + const createJSDocPublicTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPublicTag; /** @deprecated Use `factory.createJSDocPrivateTag` or the factory supplied by your transformation context instead. */ - const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPrivateTag; + const createJSDocPrivateTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocPrivateTag; /** @deprecated Use `factory.createJSDocProtectedTag` or the factory supplied by your transformation context instead. */ - const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocProtectedTag; + const createJSDocProtectedTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocProtectedTag; /** @deprecated Use `factory.createJSDocReadonlyTag` or the factory supplied by your transformation context instead. */ - const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocReadonlyTag; + const createJSDocReadonlyTag: (tagName: Identifier | undefined, comment?: string | NodeArray | undefined) => JSDocReadonlyTag; /** @deprecated Use `factory.createJSDocUnknownTag` or the factory supplied by your transformation context instead. */ - const createJSDocTag: (tagName: Identifier, comment?: string | NodeArray | undefined) => JSDocUnknownTag; + const createJSDocTag: (tagName: Identifier, comment?: string | NodeArray | undefined) => JSDocUnknownTag; /** @deprecated Use `factory.createJsxElement` or the factory supplied by your transformation context instead. */ const createJsxElement: (openingElement: JsxOpeningElement, children: readonly JsxChild[], closingElement: JsxClosingElement) => JsxElement; /** @deprecated Use `factory.updateJsxElement` or the factory supplied by your transformation context instead. */ diff --git a/tests/baselines/reference/findAllReferencesLinkTag3.baseline.jsonc b/tests/baselines/reference/findAllReferencesLinkTag3.baseline.jsonc new file mode 100644 index 00000000000..81777f237c1 --- /dev/null +++ b/tests/baselines/reference/findAllReferencesLinkTag3.baseline.jsonc @@ -0,0 +1,876 @@ +// === /tests/cases/fourslash/findAllReferencesLinkTag3.ts === +// namespace NPR { +// export class Consider { +// This = class { +// show() { } +// } +// [|m|]/*FIND ALL REFS*/() { } +// } +// /** +// * {@linkcode Consider.prototype.[|m|]} +// * {@linkplain Consider#[|m|]} +// * {@linkcode Consider#This#show} +// * {@linkplain Consider.This.show} +// * {@linkcode NPR.Consider#This#show} +// * {@linkplain NPR.Consider.This#show} +// * {@linkcode NPR.Consider#This.show} # doesn't parse trailing . +// * {@linkcode NPR.Consider.This.show} +// */ +// export function ref() { } +// } +// /** +// * {@linkplain NPR.Consider#This#show hello hello} +// * {@linkplain NPR.Consider.This#show} +// * {@linkcode NPR.Consider#This.show} # doesn't parse trailing . +// * {@linkcode NPR.Consider.This.show} +// */ +// export function outerref() { } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "kind": "method", + "name": "(method) NPR.Consider.m(): void", + "textSpan": { + "start": 108, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NPR", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Consider", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "m", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 108, + "length": 7 + } + }, + "references": [ + { + "textSpan": { + "start": 108, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "contextSpan": { + "start": 108, + "length": 7 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 167, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 198, + "length": 1 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllReferencesLinkTag3.ts === +// namespace NPR { +// export class Consider { +// This = class { +// [|show|]/*FIND ALL REFS*/() { } +// } +// m() { } +// } +// /** +// * {@linkcode Consider.prototype.m} +// * {@linkplain Consider#m} +// * {@linkcode Consider#This#[|show|]} +// * {@linkplain Consider.This.[|show|]} +// * {@linkcode NPR.Consider#This#[|show|]} +// * {@linkplain NPR.Consider.This#[|show|]} +// * {@linkcode NPR.Consider#This.show} # doesn't parse trailing . +// * {@linkcode NPR.Consider.This.[|show|]} +// */ +// export function ref() { } +// } +// /** +// * {@linkplain NPR.Consider#This#[|show|] hello hello} +// * {@linkplain NPR.Consider.This#[|show|]} +// * {@linkcode NPR.Consider#This.show} # doesn't parse trailing . +// * {@linkcode NPR.Consider.This.[|show|]} +// */ +// export function outerref() { } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "kind": "method", + "name": "(method) (Anonymous class).show(): void", + "textSpan": { + "start": 79, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(Anonymous class)", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "show", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "contextSpan": { + "start": 79, + "length": 10 + } + }, + "references": [ + { + "textSpan": { + "start": 79, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "contextSpan": { + "start": 79, + "length": 10 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 233, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 272, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 314, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 357, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 468, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 551, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 602, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 705, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllReferencesLinkTag3.ts === +// namespace NPR { +// export class Consider { +// [|This|]/*FIND ALL REFS*/ = class { +// show() { } +// } +// m() { } +// } +// /** +// * {@linkcode Consider.prototype.m} +// * {@linkplain Consider#m} +// * {@linkcode Consider#[|This|]#show} +// * {@linkplain Consider.[|This|].show} +// * {@linkcode NPR.Consider#[|This|]#show} +// * {@linkplain NPR.Consider.[|This|]#show} +// * {@linkcode NPR.Consider#[|This|].show} # doesn't parse trailing . +// * {@linkcode NPR.Consider.[|This|].show} +// */ +// export function ref() { } +// } +// /** +// * {@linkplain NPR.Consider#[|This|]#show hello hello} +// * {@linkplain NPR.Consider.[|This|]#show} +// * {@linkcode NPR.Consider#[|This|].show} # doesn't parse trailing . +// * {@linkcode NPR.Consider.[|This|].show} +// */ +// export function outerref() { } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "kind": "property", + "name": "(property) NPR.Consider.This: typeof (Anonymous class)", + "textSpan": { + "start": 52, + "length": 4 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "property", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NPR", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Consider", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "This", + "kind": "propertyName" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "typeof", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "(Anonymous class)", + "kind": "className" + } + ], + "contextSpan": { + "start": 52, + "length": 47 + } + }, + "references": [ + { + "textSpan": { + "start": 52, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "contextSpan": { + "start": 52, + "length": 47 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 228, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 267, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 309, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 352, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 394, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 463, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 546, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 597, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 635, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 700, + "length": 4 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllReferencesLinkTag3.ts === +// namespace NPR { +// export class [|Consider|]/*FIND ALL REFS*/ { +// This = class { +// show() { } +// } +// m() { } +// } +// /** +// * {@linkcode [|Consider|].prototype.m} +// * {@linkplain [|Consider|]#m} +// * {@linkcode [|Consider|]#This#show} +// * {@linkplain [|Consider|].This.show} +// * {@linkcode NPR.[|Consider|]#This#show} +// * {@linkplain NPR.[|Consider|].This#show} +// * {@linkcode NPR.[|Consider|]#This.show} # doesn't parse trailing . +// * {@linkcode NPR.[|Consider|].This.show} +// */ +// export function ref() { } +// } +// /** +// * {@linkplain NPR.[|Consider|]#This#show hello hello} +// * {@linkplain NPR.[|Consider|].This#show} +// * {@linkcode NPR.[|Consider|]#This.show} # doesn't parse trailing . +// * {@linkcode NPR.[|Consider|].This.show} +// */ +// export function outerref() { } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "kind": "class", + "name": "class NPR.Consider", + "textSpan": { + "start": 33, + "length": 8 + }, + "displayParts": [ + { + "text": "class", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NPR", + "kind": "moduleName" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "Consider", + "kind": "className" + } + ], + "contextSpan": { + "start": 20, + "length": 101 + } + }, + "references": [ + { + "textSpan": { + "start": 33, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "contextSpan": { + "start": 20, + "length": 101 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 148, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 189, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 219, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 258, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 300, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 343, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 385, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 454, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 537, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 588, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 626, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 691, + "length": 8 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] + +// === /tests/cases/fourslash/findAllReferencesLinkTag3.ts === +// namespace [|NPR|]/*FIND ALL REFS*/ { +// export class Consider { +// This = class { +// show() { } +// } +// m() { } +// } +// /** +// * {@linkcode Consider.prototype.m} +// * {@linkplain Consider#m} +// * {@linkcode Consider#This#show} +// * {@linkplain Consider.This.show} +// * {@linkcode [|NPR|].Consider#This#show} +// * {@linkplain [|NPR|].Consider.This#show} +// * {@linkcode [|NPR|].Consider#This.show} # doesn't parse trailing . +// * {@linkcode [|NPR|].Consider.This.show} +// */ +// export function ref() { } +// } +// /** +// * {@linkplain [|NPR|].Consider#This#show hello hello} +// * {@linkplain [|NPR|].Consider.This#show} +// * {@linkcode [|NPR|].Consider#This.show} # doesn't parse trailing . +// * {@linkcode [|NPR|].Consider.This.show} +// */ +// export function outerref() { } + +[ + { + "definition": { + "containerKind": "", + "containerName": "", + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "kind": "module", + "name": "namespace NPR", + "textSpan": { + "start": 10, + "length": 3 + }, + "displayParts": [ + { + "text": "namespace", + "kind": "keyword" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "NPR", + "kind": "moduleName" + } + ], + "contextSpan": { + "start": 0, + "length": 513 + } + }, + "references": [ + { + "textSpan": { + "start": 10, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "contextSpan": { + "start": 0, + "length": 513 + }, + "isWriteAccess": true, + "isDefinition": true + }, + { + "textSpan": { + "start": 296, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 339, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 381, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 450, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 533, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 584, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 622, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + }, + { + "textSpan": { + "start": 687, + "length": 3 + }, + "fileName": "/tests/cases/fourslash/findAllReferencesLinkTag3.ts", + "isWriteAccess": false, + "isDefinition": false + } + ] + } +] \ No newline at end of file diff --git a/tests/baselines/reference/quickInfoLinkCodePlain.baseline b/tests/baselines/reference/quickInfoLinkCodePlain.baseline new file mode 100644 index 00000000000..bea69b5fc4b --- /dev/null +++ b/tests/baselines/reference/quickInfoLinkCodePlain.baseline @@ -0,0 +1,111 @@ +[ + { + "marker": { + "fileName": "/tests/cases/fourslash/quickInfoLinkCodePlain.ts", + "position": 210, + "name": "" + }, + "quickInfo": { + "kind": "method", + "kindModifiers": "deprecated", + "textSpan": { + "start": 209, + "length": 1 + }, + "displayParts": [ + { + "text": "(", + "kind": "punctuation" + }, + { + "text": "method", + "kind": "text" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "C", + "kind": "className" + }, + { + "text": ".", + "kind": "punctuation" + }, + { + "text": "m", + "kind": "methodName" + }, + { + "text": "(", + "kind": "punctuation" + }, + { + "text": ")", + "kind": "punctuation" + }, + { + "text": ":", + "kind": "punctuation" + }, + { + "text": " ", + "kind": "space" + }, + { + "text": "void", + "kind": "keyword" + } + ], + "documentation": [], + "tags": [ + { + "name": "deprecated", + "text": [ + { + "text": "Use ", + "kind": "text" + }, + { + "text": "{@linkplain ", + "kind": "link" + }, + { + "text": "PerspectiveCamera#setFocalLength .setFocalLength()", + "kind": "linkText" + }, + { + "text": "}", + "kind": "link" + }, + { + "text": " and ", + "kind": "text" + }, + { + "text": "{@linkcode ", + "kind": "link" + }, + { + "text": "PerspectiveCamera#filmGauge .filmGauge", + "kind": "linkText" + }, + { + "text": "}", + "kind": "link" + }, + { + "text": " instead.", + "kind": "text" + } + ] + } + ] + } + } +] \ No newline at end of file diff --git a/tests/cases/fourslash/findAllReferencesLinkTag3.ts b/tests/cases/fourslash/findAllReferencesLinkTag3.ts new file mode 100644 index 00000000000..1783e07a104 --- /dev/null +++ b/tests/cases/fourslash/findAllReferencesLinkTag3.ts @@ -0,0 +1,28 @@ +/// +//// namespace NPR/*5*/ { +//// export class Consider/*4*/ { +//// This/*3*/ = class { +//// show/*2*/() { } +//// } +//// m/*1*/() { } +//// } +//// /** +//// * {@linkcode Consider.prototype.m} +//// * {@linkplain Consider#m} +//// * {@linkcode Consider#This#show} +//// * {@linkplain Consider.This.show} +//// * {@linkcode NPR.Consider#This#show} +//// * {@linkplain NPR.Consider.This#show} +//// * {@linkcode NPR.Consider#This.show} # doesn't parse trailing . +//// * {@linkcode NPR.Consider.This.show} +//// */ +//// export function ref() { } +//// } +//// /** +//// * {@linkplain NPR.Consider#This#show hello hello} +//// * {@linkplain NPR.Consider.This#show} +//// * {@linkcode NPR.Consider#This.show} # doesn't parse trailing . +//// * {@linkcode NPR.Consider.This.show} +//// */ +//// export function outerref() { } +verify.baselineFindAllReferences('1', '2', '3', '4', '5') diff --git a/tests/cases/fourslash/quickInfoLinkCodePlain.ts b/tests/cases/fourslash/quickInfoLinkCodePlain.ts new file mode 100644 index 00000000000..f9f0da678f1 --- /dev/null +++ b/tests/cases/fourslash/quickInfoLinkCodePlain.ts @@ -0,0 +1,12 @@ +/// + +//// export class C { +//// /** +//// * @deprecated Use {@linkplain PerspectiveCamera#setFocalLength .setFocalLength()} and {@linkcode PerspectiveCamera#filmGauge .filmGauge} instead. +//// */ +//// m() { } +//// } +//// new C().m/**/ + +verify.noErrors() +verify.baselineQuickInfo();