Skip to content

Commit 5e94cf6

Browse files
author
Andy
authored
Expand span of @typedef with properties to include the @typedef tag (microsoft#25950)
1 parent 2b14bcb commit 5e94cf6

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/compiler/parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6835,7 +6835,7 @@ namespace ts {
68356835
let child: JSDocTypeTag | JSDocPropertyTag | false;
68366836
let jsdocTypeLiteral: JSDocTypeLiteral | undefined;
68376837
let childTypeTag: JSDocTypeTag | undefined;
6838-
const start = scanner.getStartPos();
6838+
const start = atToken.pos;
68396839
while (child = tryParse(() => parseChildPropertyTag())) {
68406840
if (!jsdocTypeLiteral) {
68416841
jsdocTypeLiteral = <JSDocTypeLiteral>createNode(SyntaxKind.JSDocTypeLiteral, start);

tests/baselines/reference/JSDocParsing/DocComments.parsesCorrectly.typedefTagWithChildrenTags.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"typeExpression": {
3434
"kind": "JSDocTypeLiteral",
35-
"pos": 28,
35+
"pos": 8,
3636
"end": 100,
3737
"jsDocPropertyTags": [
3838
{
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @allowJs: true
4+
5+
// @Filename: /a.js
6+
/////**
7+
//// * /*def*/@typedef {object} I
8+
//// * @property {number} x
9+
//// */
10+
////
11+
/////** @type {I} */
12+
////const /*ref*/i = { x: 0 };
13+
14+
verify.goToType("ref", "def");

0 commit comments

Comments
 (0)