[gnome-sound-recorder/wip/cdavis/typescript] recordingListWidget: Don't assume the type in `bind_model ()`



commit ffaf2e6e41606fff04d60c69abef3789f2a494d3
Author: Christopher Davis <christopherdavis gnome org>
Date:   Tue Aug 23 19:24:13 2022 -0400

    recordingListWidget: Don't assume the type in `bind_model ()`
    
    `bind_model ()` *needs* a GObject. Before we ignored this and
    told the TypeScript type checker to assume the item is
    a `Recording`.
    
    This commit takes `item` as a `GObject.Object` and casts it
    to a `Recording` in the closure. This allows us to remove another
    `ts-expect-error` comment.

 src/recordingListWidget.ts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/recordingListWidget.ts b/src/recordingListWidget.ts
index 1520ba5..d17692e 100644
--- a/src/recordingListWidget.ts
+++ b/src/recordingListWidget.ts
@@ -58,8 +58,8 @@ export class RecordingsListWidget extends Adw.Bin {
             }
         });
 
-        // @ts-expect-error TypeScript gets `bind_model()` wrong
-        this.list.bind_model(model, (recording: Recording) => {
+        this.list.bind_model(model, (item: GObject.Object) => {
+            const recording = item as Recording;
             const row = new Row(recording);
 
             row.waveform.connect('gesture-pressed', () => {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]