Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

Put imports inside declaration (outside namespace) #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vixalien
Copy link

@vixalien vixalien commented Aug 8, 2023

Otherwise it generates code like this

/// <reference lib="es2015.iterable" />
/// <reference path="./gobject2.d.ts" />
/// <reference path="./glib2.d.ts" />

/**
 * Gio 2.0
 *
 * Generated from 2.77.0
 */

declare module "gi://Gio?version=2.0" {
    namespace Gio2 {
        import GObject from ["gi://GObject?version=2.0"](gi://GObject?version=2.0);
        import GLib from ["gi://GLib?version=2.0"](gi://GLib?version=2.0);

        export namespace BusType {
            export const $gtype: GObject.GT

which throws errors:

 Error: Import declarations in a namespace cannot reference a module.ts(1147)

Solved by putting imports inside module declaration, but outside of namespace like so

/// <reference lib="es2015.iterable" />
/// <reference path="./gobject2.d.ts" />
/// <reference path="./glib2.d.ts" />

/**
 * Gio 2.0
 *
 * Generated from 2.77.0
 */

declare module "gi://Gio?version=2.0" {
    import GObject from ["gi://GObject?version=2.0"](gi://GObject?version=2.0);
    import GLib from ["gi://GLib?version=2.0"](gi://GLib?version=2.0);
    
    namespace Gio2 {
        export namespace BusType {
            export const $gtype: GObject.GType<BusType>;
        }

relates to #1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant