{%- for import in imports %}
import "./{{ import }}.d.ts"
{%- endfor %}


{%- for name, versions in namespaces|items %}
{%- for version in versions %}
import "./{{ name }}-{{ version }}.d.ts"
{%- endfor %}
{%- endfor %}


{%- if short_paths %}
import "./aliases.d.ts"
{%- endif %}


declare global {
    interface LegacyGiImports {
        {%- for name, versions in namespaces|items %}
        {{ name }}: {%- for version in versions -%}
            | typeof import("gi://{{ name }}?version={{ version }}").default
        {%- endfor %}
        {%- endfor %}
    }
}

interface Gi {
    {%- for name, versions in namespaces|items %}
    {%- for version in versions %}
    require(namespace: "{{ name }}", version: "{{ version }}"): typeof import("gi://{{ name }}?version={{ version }}").default
    {%- endfor %}
    require(namespace: "{{ name }}"): {%- for version in versions -%}
        | typeof import("gi://{{ name }}?version={{ version }}").default
    {%- endfor %}
    {%- endfor %}
}

const gi: Gi
export default gi
