@girs/sdk-gnome-51 5.3.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gobject-2.0/gobject-2.0.d.ts +22 -8
- package/package.json +2 -2
|
@@ -38,7 +38,10 @@ export interface SignalDefinition {
|
|
|
38
38
|
flags?: SignalFlags
|
|
39
39
|
accumulator: number
|
|
40
40
|
return_type?: GTypeInput
|
|
41
|
-
|
|
41
|
+
// `readonly` matches `SignalDefinitionType` below, and for the same reason: GJS reads the array
|
|
42
|
+
// length and its elements to build the C `GType` array (`JS::GetArrayLength` / `JS_GetElement`)
|
|
43
|
+
// and never writes to it.
|
|
44
|
+
param_types?: readonly GTypeInput[]
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
export interface MetaInfo<Props, Interfaces, Sigs> {
|
|
@@ -49,9 +52,16 @@ export interface MetaInfo<Props, Interfaces, Sigs> {
|
|
|
49
52
|
Implements?: Interfaces
|
|
50
53
|
CssName?: string
|
|
51
54
|
Template?: Uint8Array | GLib.Bytes | string
|
|
52
|
-
Children
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
// `Children`, `InternalChildren`, `Requires` and `Implements` are `readonly` because GJS only
|
|
56
|
+
// ever READS them: `registerClass` stores the array on the class and later iterates it --
|
|
57
|
+
// `for (let child of children)`, `internalChildren.forEach(...)`, `requires.filter(...)` and
|
|
58
|
+
// `[...gobjectInterfaces].reverse()`, a copy. Nothing pushes, splices or sorts in place.
|
|
59
|
+
// A mutable type made a consumer's own `const` data reject its own value: a typed export from a
|
|
60
|
+
// `.blp` template, or any `as const` list, is a `readonly` tuple and produced TS4104 against a
|
|
61
|
+
// field the caller may not write to anyway.
|
|
62
|
+
Children?: readonly string[]
|
|
63
|
+
InternalChildren?: readonly string[]
|
|
64
|
+
Requires?: readonly Object[]
|
|
55
65
|
}
|
|
56
66
|
|
|
57
67
|
export type Property<K extends ParamSpec> = K extends ParamSpec<infer T> ? T : any
|
|
@@ -72,7 +82,11 @@ type SnakeToUnderscore<T> = { [P in keyof T as P extends string ? SnakeToUndersc
|
|
|
72
82
|
// Advanced utility types for class registration
|
|
73
83
|
type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never
|
|
74
84
|
|
|
75
|
-
|
|
85
|
+
// `readonly` on every `Interfaces` constraint below, for the same reason as `MetaInfo.Implements`:
|
|
86
|
+
// a caller passing `Implements: [Gio.ListModel] as const` infers a `readonly` tuple, which a
|
|
87
|
+
// mutable-array constraint rejects (TS4104) even though GJS never writes to the array. The
|
|
88
|
+
// constraints stay satisfied by an ordinary mutable array, so existing consumers are unaffected.
|
|
89
|
+
type IFaces<Interfaces extends readonly { $gtype: GType<any> }[]> = {
|
|
76
90
|
[key in keyof Interfaces]: Interfaces[key] extends { $gtype: GType<infer I> } ? I : never
|
|
77
91
|
}
|
|
78
92
|
|
|
@@ -90,7 +104,7 @@ export type Properties<
|
|
|
90
104
|
export type RegisteredPrototype<
|
|
91
105
|
P extends {},
|
|
92
106
|
Props extends { [key: string]: ParamSpec },
|
|
93
|
-
Interfaces extends any[],
|
|
107
|
+
Interfaces extends readonly any[],
|
|
94
108
|
> = Properties<P, SnakeToUnderscore<Props>> & UnionToIntersection<Interfaces[number]> & P
|
|
95
109
|
|
|
96
110
|
type Ctor = new (...a: any[]) => object
|
|
@@ -99,7 +113,7 @@ type Init = { _init(...args: any[]): void }
|
|
|
99
113
|
export type RegisteredClass<
|
|
100
114
|
T extends Ctor,
|
|
101
115
|
Props extends { [key: string]: ParamSpec },
|
|
102
|
-
Interfaces extends { $gtype: GType<any> }[],
|
|
116
|
+
Interfaces extends readonly { $gtype: GType<any> }[],
|
|
103
117
|
> = T extends { prototype: infer P extends {} }
|
|
104
118
|
? {
|
|
105
119
|
$gtype: GType<RegisteredClass<T, Props, IFaces<Interfaces>>>
|
|
@@ -363,7 +377,7 @@ export function registerClass<P extends {}, T extends new (...args: any[]) => P>
|
|
|
363
377
|
export function registerClass<
|
|
364
378
|
T extends Ctor,
|
|
365
379
|
Props extends { [key: string]: ParamSpec },
|
|
366
|
-
Interfaces extends { $gtype: GType }[],
|
|
380
|
+
Interfaces extends readonly { $gtype: GType }[],
|
|
367
381
|
Sigs extends {
|
|
368
382
|
[key: string]: {
|
|
369
383
|
param_types?: readonly GTypeInput[]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@girs/sdk-gnome-51",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "GJS TypeScript type definitions for -1 namespaces, generated as one self-contained package",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -2402,7 +2402,7 @@
|
|
|
2402
2402
|
"branch": "51beta",
|
|
2403
2403
|
"commit": "deee4b58dde2fdd6d7bb564efc6939dee11c276fb540871162025a152a67285b"
|
|
2404
2404
|
},
|
|
2405
|
-
"generator": "5.
|
|
2405
|
+
"generator": "5.5.0",
|
|
2406
2406
|
"repository": {
|
|
2407
2407
|
"type": "git",
|
|
2408
2408
|
"url": "git+https://github.com/gjsify/types.git"
|