Repository: jupyterlab/retrolab (language: python)

Issue:
Change shell.currentWidget signature
To revert https://github.com/jtpio/jupyterlab-classic/pull/101 for `0.2.0`.


Discussion / hints:

Fix patch:
diff --git a/packages/application/src/shell.ts b/packages/application/src/shell.ts
index 4910378a..70dc9d3b 100644
--- a/packages/application/src/shell.ts
+++ b/packages/application/src/shell.ts
@@ -85,8 +85,8 @@ export class RetroShell extends Widget implements JupyterFrontEnd.IShell {
   /**
    * The current widget in the shell's main area.
    */
-  get currentWidget(): Widget {
-    return this._main.widgets[0];
+  get currentWidget(): Widget | null {
+    return this._main.widgets[0] ?? null;
   }
 
   /**


Test patch:
diff --git a/packages/application/test/shell.spec.ts b/packages/application/test/shell.spec.ts
index a1296ef0..e0910a1b 100644
--- a/packages/application/test/shell.spec.ts
+++ b/packages/application/test/shell.spec.ts
@@ -45,15 +45,15 @@ describe('Shell', () => {
 
   describe('#currentWidget', () => {
     it('should be the current widget in the shell main area', () => {
-      expect(shell.currentWidget).toBe(undefined);
+      expect(shell.currentWidget).toBe(null);
       const widget = new Widget();
       widget.node.tabIndex = -1;
       widget.id = 'foo';
-      expect(shell.currentWidget).toBe(undefined);
+      expect(shell.currentWidget).toBe(null);
       shell.add(widget, 'main');
       expect(shell.currentWidget).toBe(widget);
       widget.parent = null;
-      expect(shell.currentWidget).toBe(undefined);
+      expect(shell.currentWidget).toBe(null);
     });
   });