mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-13 01:33:08 -05:00
fix(55796): JSDoc does not support @this when using an arrow function as method in class (#55877)
Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
This commit is contained in:
@@ -780,6 +780,7 @@ import {
|
||||
JSDocSatisfiesTag,
|
||||
JSDocSignature,
|
||||
JSDocTemplateTag,
|
||||
JSDocThisTag,
|
||||
JSDocTypeAssertion,
|
||||
JSDocTypedefTag,
|
||||
JSDocTypeExpression,
|
||||
@@ -41240,6 +41241,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
function checkJSDocParameterTag(node: JSDocParameterTag) {
|
||||
checkSourceElement(node.typeExpression);
|
||||
}
|
||||
|
||||
function checkJSDocPropertyTag(node: JSDocPropertyTag) {
|
||||
checkSourceElement(node.typeExpression);
|
||||
}
|
||||
@@ -41255,6 +41257,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
}
|
||||
|
||||
function checkJSDocThisTag(node: JSDocThisTag) {
|
||||
const host = getEffectiveJSDocHost(node);
|
||||
if (host && isArrowFunction(host)) {
|
||||
error(node.tagName, Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
|
||||
}
|
||||
}
|
||||
|
||||
function checkJSDocImplementsTag(node: JSDocImplementsTag): void {
|
||||
const classLike = getEffectiveJSDocHost(node);
|
||||
if (!classLike || !isClassDeclaration(classLike) && !isClassExpression(classLike)) {
|
||||
@@ -45973,6 +45982,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
return checkJSDocAccessibilityModifiers(node as JSDocPublicTag | JSDocProtectedTag | JSDocPrivateTag);
|
||||
case SyntaxKind.JSDocSatisfiesTag:
|
||||
return checkJSDocSatisfiesTag(node as JSDocSatisfiesTag);
|
||||
case SyntaxKind.JSDocThisTag:
|
||||
return checkJSDocThisTag(node as JSDocThisTag);
|
||||
case SyntaxKind.IndexedAccessType:
|
||||
return checkIndexedAccessType(node as IndexedAccessTypeNode);
|
||||
case SyntaxKind.MappedType:
|
||||
|
||||
Reference in New Issue
Block a user