Skip to content

Backticks used in JSDoc in a particular way cause tsserver to crash #31868

Closed
@westonpace

Description

@westonpace

TypeScript Version: 3.5.1

Search Terms: JSDoc backticks tsserver crash no intellisense

Code

/**
* @param `arg` str: string argument that will be shown in message
*/
function hello(arg: string) {
    console.log(arg);
}

hello('World');

Expected behavior:
This compiles fine with tsc. When loaded into VSCode however tsserver crashes without any meaningful error message.

Actual behavior:
tsserver should not crash. An error would be fine if this is invalid JSDoc (I don't actually know JSDoc).

Playground Link:
Since this only happens in tsserver I have no playground link

Related Issues:
I believe this may be related to this change: c3a9429

The issue is not present in 3.4

The function parseBracketNameInPropertyAndParamTag calls parseExpectedTokenJSDoc(SyntaxKind.BacktickToken); and parseExpectedTokenJSDoc then calls ts.tokenToString(t) on SyntaxKind.BacktickToken and this returns undefined. This undefined then blows up in an assert later on.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad output

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions