Skip to content

Commit b21c1fd

Browse files
author
Andy
authored
errorCodes in CodeFixRequestArgs is non-optional (#25815)
1 parent 31d599a commit b21c1fd

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

src/server/protocol.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ namespace ts.server.protocol {
705705
/**
706706
* Errorcodes we want to get the fixes for.
707707
*/
708-
errorCodes?: ReadonlyArray<number>;
708+
errorCodes: ReadonlyArray<number>;
709709
}
710710

711711
export interface GetCombinedCodeFixRequestArgs {

src/server/session.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1767,15 +1767,12 @@ namespace ts.server {
17671767
}
17681768

17691769
private getCodeFixes(args: protocol.CodeFixRequestArgs, simplifiedResult: boolean): ReadonlyArray<protocol.CodeFixAction> | ReadonlyArray<CodeFixAction> | undefined {
1770-
if (args.errorCodes!.length === 0) { // TODO: GH#18217
1771-
return undefined;
1772-
}
17731770
const { file, project } = this.getFileAndProject(args);
17741771

17751772
const scriptInfo = project.getScriptInfoForNormalizedPath(file)!;
17761773
const { startPosition, endPosition } = this.getStartAndEndPosition(args, scriptInfo);
17771774

1778-
const codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes!, this.getFormatOptions(file), this.getPreferences(file));
1775+
const codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes, this.getFormatOptions(file), this.getPreferences(file));
17791776
return simplifiedResult ? codeActions.map(codeAction => this.mapCodeFixAction(codeAction)) : codeActions;
17801777
}
17811778

tests/baselines/reference/api/tsserverlibrary.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6280,7 +6280,7 @@ declare namespace ts.server.protocol {
62806280
/**
62816281
* Errorcodes we want to get the fixes for.
62826282
*/
6283-
errorCodes?: ReadonlyArray<number>;
6283+
errorCodes: ReadonlyArray<number>;
62846284
}
62856285
interface GetCombinedCodeFixRequestArgs {
62866286
scope: GetCombinedCodeFixScope;

0 commit comments

Comments
 (0)