Skip to content

Commit 03b6580

Browse files
authored
Make @enum,@this tag construction stricter (#39791)
The type expression is required, so the type should reflect that.
1 parent 8f04f91 commit 03b6580

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

src/compiler/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3165,12 +3165,12 @@ namespace ts {
31653165
export interface JSDocEnumTag extends JSDocTag, Declaration {
31663166
readonly kind: SyntaxKind.JSDocEnumTag;
31673167
readonly parent: JSDoc;
3168-
readonly typeExpression?: JSDocTypeExpression;
3168+
readonly typeExpression: JSDocTypeExpression;
31693169
}
31703170

31713171
export interface JSDocThisTag extends JSDocTag {
31723172
readonly kind: SyntaxKind.JSDocThisTag;
3173-
readonly typeExpression?: JSDocTypeExpression;
3173+
readonly typeExpression: JSDocTypeExpression;
31743174
}
31753175

31763176
export interface JSDocTemplateTag extends JSDocTag {
@@ -6976,9 +6976,9 @@ namespace ts {
69766976
updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocTypeTag;
69776977
createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocReturnTag;
69786978
updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocReturnTag;
6979-
createJSDocThisTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocThisTag;
6979+
createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocThisTag;
69806980
updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocThisTag;
6981-
createJSDocEnumTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocEnumTag;
6981+
createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocEnumTag;
69826982
updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocEnumTag;
69836983
createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocCallbackTag;
69846984
updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocCallbackTag;

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,11 +1769,11 @@ declare namespace ts {
17691769
export interface JSDocEnumTag extends JSDocTag, Declaration {
17701770
readonly kind: SyntaxKind.JSDocEnumTag;
17711771
readonly parent: JSDoc;
1772-
readonly typeExpression?: JSDocTypeExpression;
1772+
readonly typeExpression: JSDocTypeExpression;
17731773
}
17741774
export interface JSDocThisTag extends JSDocTag {
17751775
readonly kind: SyntaxKind.JSDocThisTag;
1776-
readonly typeExpression?: JSDocTypeExpression;
1776+
readonly typeExpression: JSDocTypeExpression;
17771777
}
17781778
export interface JSDocTemplateTag extends JSDocTag {
17791779
readonly kind: SyntaxKind.JSDocTemplateTag;
@@ -3417,9 +3417,9 @@ declare namespace ts {
34173417
updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocTypeTag;
34183418
createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocReturnTag;
34193419
updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocReturnTag;
3420-
createJSDocThisTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocThisTag;
3420+
createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocThisTag;
34213421
updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocThisTag;
3422-
createJSDocEnumTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocEnumTag;
3422+
createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocEnumTag;
34233423
updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocEnumTag;
34243424
createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocCallbackTag;
34253425
updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocCallbackTag;
@@ -10419,7 +10419,7 @@ declare namespace ts {
1041910419
/** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */
1042010420
const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | undefined) => JSDocReturnTag;
1042110421
/** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */
10422-
const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | undefined) => JSDocThisTag;
10422+
const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocThisTag;
1042310423
/** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */
1042410424
const createJSDocComment: (comment?: string | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc;
1042510425
/** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */
@@ -10431,7 +10431,7 @@ declare namespace ts {
1043110431
readonly expression: Identifier | PropertyAccessEntityNameExpression;
1043210432
}, comment?: string | undefined) => JSDocAugmentsTag;
1043310433
/** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */
10434-
const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | undefined) => JSDocEnumTag;
10434+
const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocEnumTag;
1043510435
/** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */
1043610436
const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | undefined) => JSDocTemplateTag;
1043710437
/** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1769,11 +1769,11 @@ declare namespace ts {
17691769
export interface JSDocEnumTag extends JSDocTag, Declaration {
17701770
readonly kind: SyntaxKind.JSDocEnumTag;
17711771
readonly parent: JSDoc;
1772-
readonly typeExpression?: JSDocTypeExpression;
1772+
readonly typeExpression: JSDocTypeExpression;
17731773
}
17741774
export interface JSDocThisTag extends JSDocTag {
17751775
readonly kind: SyntaxKind.JSDocThisTag;
1776-
readonly typeExpression?: JSDocTypeExpression;
1776+
readonly typeExpression: JSDocTypeExpression;
17771777
}
17781778
export interface JSDocTemplateTag extends JSDocTag {
17791779
readonly kind: SyntaxKind.JSDocTemplateTag;
@@ -3417,9 +3417,9 @@ declare namespace ts {
34173417
updateJSDocTypeTag(node: JSDocTypeTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocTypeTag;
34183418
createJSDocReturnTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocReturnTag;
34193419
updateJSDocReturnTag(node: JSDocReturnTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocReturnTag;
3420-
createJSDocThisTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocThisTag;
3420+
createJSDocThisTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocThisTag;
34213421
updateJSDocThisTag(node: JSDocThisTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression | undefined, comment: string | undefined): JSDocThisTag;
3422-
createJSDocEnumTag(tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression, comment?: string): JSDocEnumTag;
3422+
createJSDocEnumTag(tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string): JSDocEnumTag;
34233423
updateJSDocEnumTag(node: JSDocEnumTag, tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment: string | undefined): JSDocEnumTag;
34243424
createJSDocCallbackTag(tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName?: Identifier | JSDocNamespaceDeclaration, comment?: string): JSDocCallbackTag;
34253425
updateJSDocCallbackTag(node: JSDocCallbackTag, tagName: Identifier | undefined, typeExpression: JSDocSignature, fullName: Identifier | JSDocNamespaceDeclaration | undefined, comment: string | undefined): JSDocCallbackTag;
@@ -6811,7 +6811,7 @@ declare namespace ts {
68116811
/** @deprecated Use `factory.createJSDocReturnTag` or the factory supplied by your transformation context instead. */
68126812
const createJSDocReturnTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | undefined) => JSDocReturnTag;
68136813
/** @deprecated Use `factory.createJSDocThisTag` or the factory supplied by your transformation context instead. */
6814-
const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | undefined) => JSDocThisTag;
6814+
const createJSDocThisTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocThisTag;
68156815
/** @deprecated Use `factory.createJSDocComment` or the factory supplied by your transformation context instead. */
68166816
const createJSDocComment: (comment?: string | undefined, tags?: readonly JSDocTag[] | undefined) => JSDoc;
68176817
/** @deprecated Use `factory.createJSDocParameterTag` or the factory supplied by your transformation context instead. */
@@ -6823,7 +6823,7 @@ declare namespace ts {
68236823
readonly expression: Identifier | PropertyAccessEntityNameExpression;
68246824
}, comment?: string | undefined) => JSDocAugmentsTag;
68256825
/** @deprecated Use `factory.createJSDocEnumTag` or the factory supplied by your transformation context instead. */
6826-
const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression?: JSDocTypeExpression | undefined, comment?: string | undefined) => JSDocEnumTag;
6826+
const createJSDocEnumTag: (tagName: Identifier | undefined, typeExpression: JSDocTypeExpression, comment?: string | undefined) => JSDocEnumTag;
68276827
/** @deprecated Use `factory.createJSDocTemplateTag` or the factory supplied by your transformation context instead. */
68286828
const createJSDocTemplateTag: (tagName: Identifier | undefined, constraint: JSDocTypeExpression | undefined, typeParameters: readonly TypeParameterDeclaration[], comment?: string | undefined) => JSDocTemplateTag;
68296829
/** @deprecated Use `factory.createJSDocTypedefTag` or the factory supplied by your transformation context instead. */

0 commit comments

Comments
 (0)