Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5bc8a8d

Browse filesBrowse files
ajafffRyanCavanaugh
authored andcommitted
JSDocTypeTag.typeExpression is not optional (microsoft#30452)
1 parent 9efea31 commit 5bc8a8d
Copy full SHA for 5bc8a8d

7 files changed

+9-9Lines changed: 9 additions & 9 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/compiler/checker.ts‎

Copy file name to clipboardExpand all lines: src/compiler/checker.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18613,7 +18613,7 @@ namespace ts {
1861318613
case SyntaxKind.ParenthesizedExpression: {
1861418614
// Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast.
1861518615
const tag = isInJSFile(parent) ? getJSDocTypeTag(parent) : undefined;
18616-
return tag ? getTypeFromTypeNode(tag.typeExpression!.type) : getContextualType(<ParenthesizedExpression>parent, contextFlags);
18616+
return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(<ParenthesizedExpression>parent, contextFlags);
1861718617
}
1861818618
case SyntaxKind.JsxExpression:
1861918619
return getContextualTypeForJsxExpression(<JsxExpression>parent);
@@ -24231,7 +24231,7 @@ namespace ts {
2423124231
function checkParenthesizedExpression(node: ParenthesizedExpression, checkMode?: CheckMode): Type {
2423224232
const tag = isInJSFile(node) ? getJSDocTypeTag(node) : undefined;
2423324233
if (tag) {
24234-
return checkAssertionWorker(tag, tag.typeExpression!.type, node.expression, checkMode);
24234+
return checkAssertionWorker(tag, tag.typeExpression.type, node.expression, checkMode);
2423524235
}
2423624236
return checkExpression(node.expression, checkMode);
2423724237
}
Collapse file

‎src/compiler/factory.ts‎

Copy file name to clipboardExpand all lines: src/compiler/factory.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2189,7 +2189,7 @@ namespace ts {
21892189
}
21902190

21912191
/* @internal */
2192-
export function createJSDocTypeTag(typeExpression?: JSDocTypeExpression, comment?: string): JSDocTypeTag {
2192+
export function createJSDocTypeTag(typeExpression: JSDocTypeExpression, comment?: string): JSDocTypeTag {
21932193
const tag = createJSDocTag<JSDocTypeTag>(SyntaxKind.JSDocTypeTag, "type");
21942194
tag.typeExpression = typeExpression;
21952195
tag.comment = comment;
Collapse file

‎src/compiler/parser.ts‎

Copy file name to clipboardExpand all lines: src/compiler/parser.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6855,7 +6855,7 @@ namespace ts {
68556855
}
68566856

68576857
function parseReturnTag(start: number, tagName: Identifier): JSDocReturnTag {
6858-
if (forEach(tags, t => t.kind === SyntaxKind.JSDocReturnTag)) {
6858+
if (some(tags, isJSDocReturnTag)) {
68596859
parseErrorAt(tagName.pos, scanner.getTokenPos(), Diagnostics._0_tag_already_specified, tagName.escapedText);
68606860
}
68616861

@@ -6866,7 +6866,7 @@ namespace ts {
68666866
}
68676867

68686868
function parseTypeTag(start: number, tagName: Identifier): JSDocTypeTag {
6869-
if (forEach(tags, t => t.kind === SyntaxKind.JSDocTypeTag)) {
6869+
if (some(tags, isJSDocTypeTag)) {
68706870
parseErrorAt(tagName.pos, scanner.getTokenPos(), Diagnostics._0_tag_already_specified, tagName.escapedText);
68716871
}
68726872

Collapse file

‎src/compiler/types.ts‎

Copy file name to clipboardExpand all lines: src/compiler/types.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2482,7 +2482,7 @@ namespace ts {
24822482

24832483
export interface JSDocTypeTag extends JSDocTag {
24842484
kind: SyntaxKind.JSDocTypeTag;
2485-
typeExpression?: JSDocTypeExpression;
2485+
typeExpression: JSDocTypeExpression;
24862486
}
24872487

24882488
export interface JSDocTypedefTag extends JSDocTag, NamedDeclaration {
Collapse file

‎src/services/jsDoc.ts‎

Copy file name to clipboardExpand all lines: src/services/jsDoc.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ namespace ts.JsDoc {
134134
case SyntaxKind.JSDocTemplateTag:
135135
return withList((tag as JSDocTemplateTag).typeParameters);
136136
case SyntaxKind.JSDocTypeTag:
137-
return withNode((tag as JSDocTypeTag).typeExpression!);
137+
return withNode((tag as JSDocTypeTag).typeExpression);
138138
case SyntaxKind.JSDocTypedefTag:
139139
case SyntaxKind.JSDocCallbackTag:
140140
case SyntaxKind.JSDocPropertyTag:
Collapse file

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

Copy file name to clipboardExpand all lines: tests/baselines/reference/api/tsserverlibrary.d.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ declare namespace ts {
16031603
}
16041604
interface JSDocTypeTag extends JSDocTag {
16051605
kind: SyntaxKind.JSDocTypeTag;
1606-
typeExpression?: JSDocTypeExpression;
1606+
typeExpression: JSDocTypeExpression;
16071607
}
16081608
interface JSDocTypedefTag extends JSDocTag, NamedDeclaration {
16091609
parent: JSDoc;
Collapse file

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

Copy file name to clipboardExpand all lines: tests/baselines/reference/api/typescript.d.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ declare namespace ts {
16031603
}
16041604
interface JSDocTypeTag extends JSDocTag {
16051605
kind: SyntaxKind.JSDocTypeTag;
1606-
typeExpression?: JSDocTypeExpression;
1606+
typeExpression: JSDocTypeExpression;
16071607
}
16081608
interface JSDocTypedefTag extends JSDocTag, NamedDeclaration {
16091609
parent: JSDoc;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.