Skip to content

Commit 5b3ff4c

Browse files
committed
Mark @typedef as a type declaration
This is only important right now for marking uses of deprecated tags due to the way that deprecated type references are computed. But I'm surprised it hasn't caused problems elsewhere. Fixes #39466
1 parent 5b4cbc9 commit 5b3ff4c

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/compiler/checker.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36110,13 +36110,14 @@ namespace ts {
3611036110
name.parent.name === name;
3611136111
}
3611236112

36113-
function isTypeDeclaration(node: Node): node is TypeParameterDeclaration | ClassDeclaration | InterfaceDeclaration | TypeAliasDeclaration | EnumDeclaration | ImportClause | ImportSpecifier | ExportSpecifier {
36113+
function isTypeDeclaration(node: Node): node is TypeParameterDeclaration | ClassDeclaration | InterfaceDeclaration | TypeAliasDeclaration | JSDocTypedefTag | EnumDeclaration | ImportClause | ImportSpecifier | ExportSpecifier {
3611436114
switch (node.kind) {
3611536115
case SyntaxKind.TypeParameter:
3611636116
case SyntaxKind.ClassDeclaration:
3611736117
case SyntaxKind.InterfaceDeclaration:
3611836118
case SyntaxKind.TypeAliasDeclaration:
3611936119
case SyntaxKind.EnumDeclaration:
36120+
case SyntaxKind.JSDocTypedefTag:
3612036121
return true;
3612136122
case SyntaxKind.ImportClause:
3612236123
return (node as ImportClause).isTypeOnly;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
///<reference path="fourslash.ts" />
2+
3+
// @checkJs: true
4+
// @allowJs: true
5+
// @Filename: jsdocDeprecated_suggestion5.js
6+
//// /** @typedef {{ email: string, nickName?: string }} U2 */
7+
//// /** @type {U2} */
8+
//// const u2 = { email: "" }
9+
10+
verify.getSuggestionDiagnostics([])

0 commit comments

Comments
 (0)