Skip to content

Commit db85f37

Browse files
author
Andy
authored
fixUnusedIdentifier: Don't needlessly exclude jsdoc (microsoft#25014)
1 parent 03fff50 commit db85f37

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

src/services/codefixes/fixUnusedIdentifier.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,8 @@ namespace ts.codefix {
173173
const typeParameters = getEffectiveTypeParameterDeclarations(<DeclarationWithTypeParameters>parent.parent);
174174
if (typeParameters.length === 1) {
175175
const { pos, end } = cast(typeParameters, isNodeArray);
176-
const previousToken = getTokenAtPosition(sourceFile, pos - 1, /*includeJsDocComment*/ false);
177-
const nextToken = getTokenAtPosition(sourceFile, end, /*includeJsDocComment*/ false);
176+
const previousToken = getTokenAtPosition(sourceFile, pos - 1, /*includeJsDocComment*/ true);
177+
const nextToken = getTokenAtPosition(sourceFile, end, /*includeJsDocComment*/ true);
178178
Debug.assert(previousToken.kind === SyntaxKind.LessThanToken);
179179
Debug.assert(nextToken.kind === SyntaxKind.GreaterThanToken);
180180

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/// <reference path='fourslash.ts' />
2+
3+
// @allowJs: true
4+
5+
// @Filename: /a.js
6+
/////**
7+
//// * @type {<T>() => void}
8+
//// */
9+
////export const x = 0;
10+
11+
verify.codeFix({
12+
description: "Remove declaration for: 'T'",
13+
newFileContent:
14+
`/**
15+
* @type {() => void}
16+
*/
17+
export const x = 0;`,
18+
});

0 commit comments

Comments
 (0)