Skip to content

Commit

Permalink
Fix for invalid enums, should fix #181
Browse files Browse the repository at this point in the history
  • Loading branch information
JumpLink committed Jul 21, 2024
1 parent e6285b4 commit f67c236
Show file tree
Hide file tree
Showing 32 changed files with 39 additions and 37 deletions.
2 changes: 1 addition & 1 deletion examples/adw-1-hello/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/adw-1-hello-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Typescript hello-world example using Libadwaita",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gio-2-cat/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gio-2-cat-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Gtk 3 example app that shows how to use Gio-2.0 to read a file from the local file system",
"main": "index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion examples/gio-2-dbus/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gio-2-dbus-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "GJS example showing how to build a DBus server/client",
"main": "index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion examples/gio-2-list-model/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gio-2-list-model-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "An example of implementing the GListModel interface in GJS",
"main": "index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion examples/glib-2-spawn-command/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/glib-2-spawn-command-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/glib-2-variant/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/glib-2-variant-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "ts-for-gir GVariant example based on https://gjs.guide/guides/glib/gvariant.html",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-browser/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-browser-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"type": "module",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-builder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-builder-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"type": "module",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-calc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-calc-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Gtk 3 calculator example app",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-editor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-editor-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"type": "module",
"targets": {
".": {
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-hello-2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-hello-2-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Gtk 3 example app to demonstrate how you can connect to Gtk signals",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-hello/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-hello-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"type": "module",
"private": true,
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-template/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-template-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Gtk 3 example app to demonstrate how you can use .ui template XML files",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-3-webkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-3-webkit-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Gtk 3 example app to demonstrate how you can use WebKit2",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-4-application/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-4-application-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Gtk 4 example app to demonstrate how you can use and extend Gtk.Application",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-4-custom-widget/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gjs-gtk-4-custom-widget-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "This example shows the usage of custom widgets and virtual functions in GJS",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-4-gettext/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-4-gettext-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Gtk 3 example app that shows how you can translate strings with gettext",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-4-list-store/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-4-list-store-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "It takes the hassle away from building Gtk4 application in Python So you can create a cool application, without all the boilerplate code",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-4-template-vite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-4-template-vite",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Gtk 4 example app to demonstrate how you can use .ui template XML files over the Vite bundler",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/gtk-4-template/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/gtk-4-template",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Gtk 4 example app to demonstrate how you can use .ui template XML files over GJS itself",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/run-async/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/run-async-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Gtk 3 example app that shows how you can translate strings with gettext",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/soup-3-http/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/soup-3-http-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "GJS example showing how to build a http server/client using Soap 3",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/soup-3-websocket/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/soup-3-websocket-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Soup 3 example app to demonstrate how you can use WebSockets",
"type": "module",
"private": true,
Expand Down
2 changes: 1 addition & 1 deletion examples/timers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir-example/timers-example",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Simple GJS Gtk 4 example app to demonstrate how you can use .ui template XML files",
"type": "module",
"private": true,
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ts-for-gir",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Typescript .d.ts generator from GIR for gjs",
"type": "module",
"private": true,
Expand Down Expand Up @@ -39,7 +39,7 @@
"build:types:packages:gtk4:no-install": "yarn ts-for-gir generate --configName='.ts-for-gir.packages-gtk4.rc.js'",
"build:types:packages:gtk4": "yarn build:types:packages:gtk4:no-install && yarn install",
"copy:girs": "yarn start copy --configName='.ts-for-gir.copy-all.rc.js' --verbose",
"validate": "yarn workspaces foreach -v --all --parallel run validate",
"validate": "yarn workspaces foreach -v --all --parallel run validate && yarn validate:types:packages",
"validate:types": "yarn workspaces foreach -v --all --parallel run validate:types",
"validate:examples": "yarn workspaces foreach -v --all --include '@ts-for-gir-example/*' --parallel run validate",
"validate:types:packages": "yarn workspaces foreach -v --all --parallel --include '@girs/*' run test",
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir/cli",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "TypeScript type definition generator for GObject introspection GIR files",
"module": "lib/index.js",
"main": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/generator-base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir/generator-base",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Base generator for ts-for-gir",
"module": "lib/index.js",
"main": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/generator-html-doc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir/generator-html-doc",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "HTML Documentation generator for ts-for-gir",
"module": "lib/index.js",
"main": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/generator-typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir/generator-typescript",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "TypeScript type definition generator for ts-for-gir",
"module": "lib/index.js",
"main": "lib/index.js",
Expand Down
12 changes: 7 additions & 5 deletions packages/generator-typescript/src/module-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -779,11 +779,6 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
const desc: string[] = []
const { name, namespace } = girEnum

desc.push(`export namespace ${name} {`)
desc.push(` export const $gtype: ${namespace.namespace !== 'GObject' ? 'GObject.' : ''}GType<${name}>;`)
desc.push(`}`)
desc.push(``)

desc.push(...this.addGirDocComment(girEnum.doc, [], indentCount))

// Enums can't have numerical keys
Expand All @@ -797,6 +792,13 @@ export class ModuleGenerator extends FormatGenerator<string[]> {
return desc
}

desc.push(``)
desc.push(...this.addGirDocComment(girEnum.doc, [], indentCount))
desc.push(`export namespace ${name} {`)
desc.push(` export const $gtype: ${namespace.namespace !== 'GObject' ? 'GObject.' : ''}GType<${name}>;`)
desc.push(`}`)
desc.push(``)

desc.push(this.generateExport('enum', name, '{', indentCount))
if (girEnum.members) {
for (const girEnumMember of girEnum.members.values()) {
Expand Down
2 changes: 1 addition & 1 deletion packages/lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ts-for-gir/lib",
"version": "4.0.0-beta.9",
"version": "4.0.0-beta.10",
"description": "Typescript .d.ts generator from GIR for gjs",
"module": "lib/index.js",
"main": "lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion types
Submodule types updated 1575 files

0 comments on commit f67c236

Please sign in to comment.