From cc661f5a99e37ff608ab9cea2123613991b723fd Mon Sep 17 00:00:00 2001 From: Colin Grant Date: Wed, 19 Jan 2022 08:52:19 -0700 Subject: [PATCH] less change in the SaveableWidget interface --- packages/core/src/browser/saveable.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/core/src/browser/saveable.ts b/packages/core/src/browser/saveable.ts index cdea730a93306..772b7bbb77866 100644 --- a/packages/core/src/browser/saveable.ts +++ b/packages/core/src/browser/saveable.ts @@ -94,7 +94,7 @@ export namespace Saveable { } } - async function closeWithoutSaving(this: SaveableWidget, doRevert: boolean = true): Promise { + async function closeWithoutSaving(this: PostCreationSaveableWidget, doRevert: boolean = true): Promise { const saveable = get(this); if (saveable && doRevert && saveable.dirty && saveable.revert) { await saveable.revert(); @@ -195,15 +195,22 @@ export namespace Saveable { } } -export const close = Symbol('close'); export interface SaveableWidget extends Widget { /** * @param doRevert whether the saveable should be reverted before being saved. Defaults to `true`. */ closeWithoutSaving(doRevert?: boolean): Promise; closeWithSaving(options?: SaveableWidget.CloseOptions): Promise; +} + +export const close = Symbol('close'); +/** + * An interface describing saveable widgets that are created by the `Saveable.apply` function. + * The original `close` function is reassigned to a locally-defined `Symbol` + */ +export interface PostCreationSaveableWidget extends SaveableWidget { /** - * The original close function of the widget + * The original `close` function of the widget */ [close](): void; }