Skip to content

Commit

Permalink
fix up types
Browse files Browse the repository at this point in the history
  • Loading branch information
jwunderl committed Sep 19, 2024
1 parent fbd8456 commit c4fd26c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions localtypings/pxteditor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1296,7 +1296,14 @@ declare namespace pxt.editor {

interface BaseAssetEditorResponse {
id?: number;
/**
* indicate if operation started or completed successfully
*/
success: boolean;
/**
* Error object if any
*/
error?: any;
}

interface OpenAssetEditorResponse extends BaseAssetEditorResponse {
Expand Down
6 changes: 3 additions & 3 deletions pxtservices/iframeDriver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ export abstract class IframeDriver {
}

protected resolvePendingMessage(event: MessageEvent) {
const data = event.data as pxt.editor.EditorMessageResponse;
if (data.id && this.pendingMessages[data.id]) {
const resp = event.data as pxt.editor.EditorMessageResponse;
const resp = event.data as pxt.editor.EditorMessageResponse | pxt.editor.AssetEditorResponse;

if (resp.id && this.pendingMessages[resp.id]) {
const pending = this.pendingMessages[resp.id!];
delete this.pendingMessages[resp.id!];

Expand Down

0 comments on commit c4fd26c

Please sign in to comment.