diff --git a/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts b/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts index d466b3e6d..f94aebde8 100644 --- a/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts +++ b/src/snyk/snykCode/views/suggestion/codeSuggestionWebviewProvider.ts @@ -1,5 +1,5 @@ import _ from 'lodash'; -import { relative } from "path" +import { relative } from 'path'; import { applyPatch } from 'diff'; import { marked } from 'marked'; import * as vscode from 'vscode'; @@ -226,7 +226,7 @@ export class CodeSuggestionWebviewProvider } case 'getAutofixDiffs': { try { - const suggestion = args.suggestion as Suggestion; + const { suggestion } = args as { suggestion: Suggestion }; const diffs: AutofixUnifiedDiffSuggestion = await vscode.commands.executeCommand( SNYK_CODE_FIX_DIFFS_COMMAND, suggestion.folderPath, @@ -241,7 +241,10 @@ export class CodeSuggestionWebviewProvider break; } case 'applyGitDiff': { - const { patch, fileUri } = args; + const { patch, fileUri } = args as { + patch: string; + fileUri: string; + }; const fileContent = readFileSync(fileUri, 'utf8'); const patchedContent = applyPatch(fileContent, patch); @@ -330,8 +333,8 @@ export class CodeSuggestionWebviewProvider editor.setDecorations(highlightDecoration, decorationOptions); // scroll to first added line - let line = editor.document.lineAt(addedLineNumbers[0]); - let range = line.range; + const line = editor.document.lineAt(addedLineNumbers[0]); + const range = line.range; editor.revealRange(range, vscode.TextEditorRevealType.Default); // remove highlight on any of: