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 e281e5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/commands/editAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@ export async function editAction(action: WskAction): Promise<void> {
vscode.window.showErrorMessage("Can't edit sequence action type");
return;
}
if (content.exec.binary) {

if ('binary' in content.exec) {
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' && !('code' in content.exec)) {
vscode.window.showErrorMessage("Can't edit blackbox action without action code");
return;
}
if (content.exec.code) {
if ('code' in content.exec) {
fs.writeFileSync(localFilePath, content.exec.code);
}

Expand Down
5 changes: 3 additions & 2 deletions src/wskContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ export class ActionCodeProvider implements vscode.TextDocumentContentProvider {
const ow = openwhisk({ api_key: auth.api_key, apihost: auth.apihost });

const content = await ow.actions.get(WskAction.removeExtension(uri.path));
if (content.exec.kind === 'sequence') {
if (content.exec.kind === 'sequence' || !('code' in content.exec)) {
return 'Codeview does not support sequence actions.';
}
if ((content.exec.kind as string) === 'blackbox' && !content.exec.code) {

if ((content.exec.kind as string) === 'blackbox' && !('code' in content.exec)) {
return 'Codeview does not support native docker actions.';
}
return Promise.resolve(content.exec.code);
Expand Down

0 comments on commit e281e5e

Please sign in to comment.