diff --git a/src/services/textChanges.ts b/src/services/textChanges.ts
index 24349565296e9..35fef848fa362 100644
--- a/src/services/textChanges.ts
+++ b/src/services/textChanges.ts
@@ -469,7 +469,7 @@ namespace ts.textChanges {
public insertTypeParameters(sourceFile: SourceFile, node: SignatureDeclaration, typeParameters: readonly TypeParameterDeclaration[]): void {
// If no `(`, is an arrow function `x => x`, so use the pos of the first parameter
const start = (findChildOfKind(node, SyntaxKind.OpenParenToken, sourceFile) || first(node.parameters)).getStart(sourceFile);
- this.insertNodesAt(sourceFile, start, typeParameters, { prefix: "<", suffix: ">" });
+ this.insertNodesAt(sourceFile, start, typeParameters, { prefix: "<", suffix: ">", joiner: ", " });
}
private getOptionsForInsertNodeBefore(before: Node, inserted: Node, blankLineBetween: boolean): InsertNodeOptions {
diff --git a/tests/cases/fourslash/annotateWithTypeFromJSDoc23.ts b/tests/cases/fourslash/annotateWithTypeFromJSDoc23.ts
new file mode 100644
index 0000000000000..55f9e53bd94f6
--- /dev/null
+++ b/tests/cases/fourslash/annotateWithTypeFromJSDoc23.ts
@@ -0,0 +1,32 @@
+///
+// @strict: true
+/////**
+//// * @typedef Foo
+//// * @template L, R
+//// */
+/////**
+//// * @param {function(R): boolean} a
+//// * @param {function(R): L} b
+//// * @returns {function(R): Foo.}
+//// * @template L, R
+//// */
+////function foo(a, b) {
+////}
+
+verify.codeFix({
+ description: ts.Diagnostics.Annotate_with_type_from_JSDoc.message,
+ index: 2,
+ newFileContent:
+`/**
+ * @typedef Foo
+ * @template L, R
+ */
+/**
+ * @param {function(R): boolean} a
+ * @param {function(R): L} b
+ * @returns {function(R): Foo.}
+ * @template L, R
+ */
+function foo(a: (arg0: R) => boolean, b: (arg0: R) => L): (arg0: R) => Foo {
+}`,
+});