Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6856,7 +6856,7 @@ namespace ts {

function parseTypedefTag(atToken: AtToken, tagName: Identifier, indent: number): JSDocTypedefTag {
const typeExpression = tryParseTypeExpression();
skipWhitespace();
skipWhitespaceOrAsterisk();

const typedefTag = <JSDocTypedefTag>createNode(SyntaxKind.JSDocTypedefTag, atToken.pos);
typedefTag.atToken = atToken;
Expand Down
23 changes: 23 additions & 0 deletions tests/baselines/reference/typedefTagWrapping.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
=== tests/cases/conformance/jsdoc/mod1.js ===
/**
* @typedef {function(string): boolean}
* MyType
*/

/**
* Tries to use a type whose name is on a different
* line than the typedef tag.
* @param {MyType} func The function to call.
* @param {string} arg The argument to call it with.
* @returns {boolean} The return.
*/
function callIt(func, arg) {
>callIt : Symbol(callIt, Decl(mod1.js, 0, 0))
>func : Symbol(func, Decl(mod1.js, 12, 16))
>arg : Symbol(arg, Decl(mod1.js, 12, 21))

return func(arg);
>func : Symbol(func, Decl(mod1.js, 12, 16))
>arg : Symbol(arg, Decl(mod1.js, 12, 21))
}

24 changes: 24 additions & 0 deletions tests/baselines/reference/typedefTagWrapping.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
=== tests/cases/conformance/jsdoc/mod1.js ===
/**
* @typedef {function(string): boolean}
* MyType
*/

/**
* Tries to use a type whose name is on a different
* line than the typedef tag.
* @param {MyType} func The function to call.
* @param {string} arg The argument to call it with.
* @returns {boolean} The return.
*/
function callIt(func, arg) {
>callIt : (func: (arg0: string) => boolean, arg: string) => boolean
>func : (arg0: string) => boolean
>arg : string

return func(arg);
>func(arg) : boolean
>func : (arg0: string) => boolean
>arg : string
}

20 changes: 20 additions & 0 deletions tests/cases/conformance/jsdoc/typedefTagWrapping.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: mod1.js

/**
* @typedef {function(string): boolean}
* MyType
*/

/**
* Tries to use a type whose name is on a different
* line than the typedef tag.
* @param {MyType} func The function to call.
* @param {string} arg The argument to call it with.
* @returns {boolean} The return.
*/
function callIt(func, arg) {
return func(arg);
}