Skip to content

Commit

Permalink
Fix typescript error T2339
Browse files Browse the repository at this point in the history
  • Loading branch information
upgle committed Jan 19, 2024
1 parent b8f1b1f commit feccd60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions src/commands/editAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import * as fs from 'fs';
import * as vscode from 'vscode';
import * as os from 'os';
import * as path from 'path';
import { Exec } from 'openwhisk';
import { showConfirmMessage } from '../common';

const actionEditMap: { [key: string]: WskAction } = {};
Expand All @@ -43,16 +44,17 @@ export async function editAction(action: WskAction): Promise<void> {
vscode.window.showErrorMessage("Can't edit sequence action type");
return;
}
if (content.exec.binary) {

if ((content.exec as Exec).binary) {
vscode.window.showErrorMessage("Can't edit binary action code");
return;
}
if ((content.exec.kind as string) === 'blackbox' && !content.exec.code) {
if ((content.exec.kind as string) === 'blackbox' && !(content.exec as Exec).code) {
vscode.window.showErrorMessage("Can't edit blackbox action without action code");
return;
}
if (content.exec.code) {
fs.writeFileSync(localFilePath, content.exec.code);
if ((content.exec as Exec).code) {
fs.writeFileSync(localFilePath, (content.exec as Exec).code);
}

vscode.workspace.openTextDocument(localFilePath).then((textDocument: vscode.TextDocument) => {
Expand Down
4 changes: 2 additions & 2 deletions src/wskContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export class ActionCodeProvider implements vscode.TextDocumentContentProvider {
if (content.exec.kind === 'sequence') {
return 'Codeview does not support sequence actions.';
}
if ((content.exec.kind as string) === 'blackbox' && !content.exec.code) {
if ((content.exec.kind as string) === 'blackbox' && !(content.exec as openwhisk.Exec).code) {
return 'Codeview does not support native docker actions.';
}
return Promise.resolve(content.exec.code);
return Promise.resolve((content.exec as openwhisk.Exec).code);
}
}

Expand Down

0 comments on commit feccd60

Please sign in to comment.