@ts-for-gir/generator-typescript 4.0.0-beta.39 → 4.0.0-beta.40
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/package.json +5 -5
- package/src/module-generator.ts +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ts-for-gir/generator-typescript",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.40",
|
|
4
4
|
"description": "TypeScript type definition generator for ts-for-gir",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"module": "src/index.ts",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"typescript": "^5.9.3"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@gi.ts/parser": "^4.0.0-beta.
|
|
41
|
-
"@ts-for-gir/generator-base": "^4.0.0-beta.
|
|
42
|
-
"@ts-for-gir/lib": "^4.0.0-beta.
|
|
43
|
-
"@ts-for-gir/templates": "^4.0.0-beta.
|
|
40
|
+
"@gi.ts/parser": "^4.0.0-beta.40",
|
|
41
|
+
"@ts-for-gir/generator-base": "^4.0.0-beta.40",
|
|
42
|
+
"@ts-for-gir/lib": "^4.0.0-beta.40",
|
|
43
|
+
"@ts-for-gir/templates": "^4.0.0-beta.40",
|
|
44
44
|
"ejs": "^4.0.1",
|
|
45
45
|
"xml2js": "^0.6.2"
|
|
46
46
|
}
|
package/src/module-generator.ts
CHANGED
|
@@ -823,8 +823,6 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
|
|
|
823
823
|
const desc: string[] = [];
|
|
824
824
|
const { name, namespace } = girEnum;
|
|
825
825
|
|
|
826
|
-
desc.push(...this.addGirDocComment(girEnum.doc, [], indentCount));
|
|
827
|
-
|
|
828
826
|
// Enums can't have numerical keys
|
|
829
827
|
const isInvalidEnum = Array.from(girEnum.members.keys()).some(
|
|
830
828
|
(name) => name.match(/^[0-9]+$/) || name === "NaN" || name === "Infinity",
|
|
@@ -836,14 +834,15 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
|
|
|
836
834
|
return desc;
|
|
837
835
|
}
|
|
838
836
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
837
|
+
if (girEnum.isRegistered) {
|
|
838
|
+
desc.push(`export namespace ${name} {`);
|
|
839
|
+
const gtypeNamespace = namespace.namespace === "GObject" ? "" : "GObject.";
|
|
840
|
+
desc.push(` export const $gtype: ${gtypeNamespace}GType<${name}>;`);
|
|
841
|
+
desc.push("}");
|
|
842
|
+
desc.push("");
|
|
843
|
+
}
|
|
846
844
|
|
|
845
|
+
desc.push(...this.addGirDocComment(girEnum.doc, [], indentCount));
|
|
847
846
|
desc.push(this.generateExport("enum", name, "{", indentCount));
|
|
848
847
|
if (girEnum.members) {
|
|
849
848
|
for (const girEnumMember of girEnum.members.values()) {
|
|
@@ -852,6 +851,7 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
|
|
|
852
851
|
}
|
|
853
852
|
}
|
|
854
853
|
desc.push("}");
|
|
854
|
+
desc.push("");
|
|
855
855
|
return desc;
|
|
856
856
|
}
|
|
857
857
|
|
|
@@ -1765,7 +1765,7 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
|
|
|
1765
1765
|
|
|
1766
1766
|
// $gtype compatibility
|
|
1767
1767
|
const gtypeNamespace = this.namespace.namespace === "GObject" ? "" : "GObject.";
|
|
1768
|
-
def.push(`static $gtype: ${gtypeNamespace}GType<${girClass.
|
|
1768
|
+
def.push(`static $gtype: ${gtypeNamespace}GType<${girClass.gtype}>;`);
|
|
1769
1769
|
|
|
1770
1770
|
if (girClass.__ts__indexSignature) {
|
|
1771
1771
|
def.push(`\n${girClass.__ts__indexSignature}\n`);
|