mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
errorCodes in CodeFixRequestArgs is non-optional (#25815)
This commit is contained in:
@@ -705,7 +705,7 @@ namespace ts.server.protocol {
|
||||
/**
|
||||
* Errorcodes we want to get the fixes for.
|
||||
*/
|
||||
errorCodes?: ReadonlyArray<number>;
|
||||
errorCodes: ReadonlyArray<number>;
|
||||
}
|
||||
|
||||
export interface GetCombinedCodeFixRequestArgs {
|
||||
|
||||
@@ -1767,15 +1767,12 @@ namespace ts.server {
|
||||
}
|
||||
|
||||
private getCodeFixes(args: protocol.CodeFixRequestArgs, simplifiedResult: boolean): ReadonlyArray<protocol.CodeFixAction> | ReadonlyArray<CodeFixAction> | undefined {
|
||||
if (args.errorCodes!.length === 0) { // TODO: GH#18217
|
||||
return undefined;
|
||||
}
|
||||
const { file, project } = this.getFileAndProject(args);
|
||||
|
||||
const scriptInfo = project.getScriptInfoForNormalizedPath(file)!;
|
||||
const { startPosition, endPosition } = this.getStartAndEndPosition(args, scriptInfo);
|
||||
|
||||
const codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes!, this.getFormatOptions(file), this.getPreferences(file));
|
||||
const codeActions = project.getLanguageService().getCodeFixesAtPosition(file, startPosition, endPosition, args.errorCodes, this.getFormatOptions(file), this.getPreferences(file));
|
||||
return simplifiedResult ? codeActions.map(codeAction => this.mapCodeFixAction(codeAction)) : codeActions;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user