Skip to content

Commit efb0790

Browse files
committed
chore: port to ts-for-gir
1 parent bbf3e04 commit efb0790

File tree

15 files changed

+518
-581
lines changed

15 files changed

+518
-581
lines changed

build-aux/flatpak/generated-sources.json

Lines changed: 295 additions & 295 deletions
Large diffs are not rendered by default.

gi-types

Submodule gi-types updated from a30f0bc to 689f364

lib/build.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@ await build({
4949
// esm
5050
format: "esm",
5151
plugins: [externalPlugin(resolve(SOURCE_DIR, "src"))],
52+
sourcemap: "inline",
5253
})
5354
.then(() => console.log("JS Build complete"));

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"license": "MIT",
1010
"dependencies": {
1111
"linkifyjs": "^4.1.1",
12-
"typescript": "^4.7.4"
12+
"typescript": "^5.8.3"
1313
},
1414
"type": "module",
1515
"devDependencies": {
@@ -26,6 +26,6 @@
2626
"scripts": {
2727
"build": "node lib/build.js",
2828
"css": "node lib/stylus.js",
29-
"typecheck": "tsc --strict --noEmit"
29+
"typecheck": "tsc --noEmit"
3030
}
3131
}

src/application.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ export class Application extends Adw.Application {
368368
}
369369

370370
show_about() {
371-
const aboutParams: Partial<Adw.AboutWindow.ConstructorProperties> = {
371+
const aboutParams: Partial<Adw.AboutWindow.ConstructorProps> = {
372372
transient_for: this.active_window,
373373
application_name: _("Sticky Notes"),
374374
application_icon: pkg.name,

src/card.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ export class StickyNoteCard extends Gtk.Box {
5656
}, this);
5757
}
5858

59-
_scrolled!: Gtk.ScrolledWindow;
60-
_modified_label!: Gtk.Label;
61-
_view_image!: Gtk.Image;
62-
_delete_button!: Gtk.Button;
59+
declare _scrolled: Gtk.ScrolledWindow;
60+
declare _modified_label: Gtk.Label;
61+
declare _view_image: Gtk.Image;
62+
declare _delete_button: Gtk.Button;
6363

6464
private _note?: Note;
6565
view: ReadonlyStickyNote;

src/notes.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,14 @@ export class StickyNotes extends Adw.ApplicationWindow {
6262
);
6363
}
6464

65-
_search!: Gtk.Box;
66-
_search_entry!: Gtk.SearchEntry;
67-
_notes_box!: Gtk.ListView;
68-
_no_notes!: Adw.StatusPage;
69-
_no_results!: Adw.StatusPage;
70-
_scrolled!: Gtk.ScrolledWindow;
71-
_menu_button!: Gtk.MenuButton;
72-
_stack!: Gtk.Stack;
65+
declare _search: Gtk.Box;
66+
declare _search_entry: Gtk.SearchEntry;
67+
declare _notes_box: Gtk.ListView;
68+
declare _no_notes: Adw.StatusPage;
69+
declare _no_results: Adw.StatusPage;
70+
declare _scrolled: Gtk.ScrolledWindow;
71+
declare _menu_button: Gtk.MenuButton;
72+
declare _stack: Gtk.Stack;
7373

7474
cards: StickyNoteCard[] = [];
7575

@@ -124,7 +124,7 @@ export class StickyNotes extends Adw.ApplicationWindow {
124124
}
125125

126126
constructor(
127-
params: Partial<Gtk.Window.ConstructorProperties>,
127+
params: Partial<Gtk.Window.ConstructorProps>,
128128
) {
129129
super(params);
130130

src/styleselector.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ import Gdk from "gi://Gdk?version=4.0";
3131

3232
import { Style, StyleNames, styles } from "./util.js";
3333

34+
const { vprintf } = imports.format;
35+
3436
let provider: Gtk.CssProvider | null = null;
3537

3638
class StyleButton extends Gtk.CheckButton {
@@ -42,7 +44,7 @@ class StyleButton extends Gtk.CheckButton {
4244

4345
super({
4446
// focus_on_click: false,
45-
tooltip_text: _("Switch to %s style").format(display_name),
47+
tooltip_text: vprintf(_("Switch to %s style"), [display_name]),
4648
width_request: 44,
4749
height_request: 44,
4850
hexpand: true,

src/themeselector.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ export class ThemeSelector extends Gtk.Widget {
2929
}
3030

3131
theme: string;
32-
_follow!: Gtk.CheckButton;
3332

34-
style_manager!: Adw.StyleManager;
33+
declare _follow: Gtk.CheckButton;
34+
35+
style_manager: Adw.StyleManager;
3536

3637
constructor(params = {}) {
3738
super(params);
@@ -60,7 +61,9 @@ export class ThemeSelector extends Gtk.Widget {
6061
}
6162

6263
_on_notify_system_supports_color_schemes() {
63-
this._follow.set_visible(this.style_manager.get_system_supports_color_schemes());
64+
this._follow.set_visible(
65+
this.style_manager.get_system_supports_color_schemes(),
66+
);
6467
}
6568

6669
_on_notify_dark() {

src/util.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ export class Tag extends GObject.Object {
131131
}
132132

133133
export class Note extends GObject.Object {
134-
private static tag_list_pspec = GObject.ParamSpec.object(
134+
private static tag_list_pspec = GObject.param_spec_object(
135135
"tag_list",
136136
"Tags",
137137
"Tags of the note",
138+
Gio.ListStore.$gtype,
138139
GObject.ParamFlags.READWRITE,
139-
Gio.ListStore,
140140
);
141141

142142
static $gtype: GObject.GType<Note>;
@@ -207,7 +207,6 @@ export class Note extends GObject.Object {
207207
this.height = note.height;
208208
this.open = note.open ?? false;
209209

210-
// @ts-expect-error incorrect types
211210
this.bind_property_full(
212211
"content",
213212
this,

0 commit comments

Comments
 (0)