Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create an import for the latest version in *-ambient.d.ts #174

Open
vixalien opened this issue Jun 18, 2024 · 3 comments
Open

Create an import for the latest version in *-ambient.d.ts #174

vixalien opened this issue Jun 18, 2024 · 3 comments

Comments

@vixalien
Copy link

For example Gtk generates a gtk-4.0-ambient.d.ts

declare module 'gi:https://Gtk?version=4.0' {
    const Gtk40: typeof import('./gtk-4.0.js').default;
    export default Gtk40;
}

Because this is the latest version, it would also be amazing to create the file with an additional import that doesn't include the ?version=4.0

declare module 'gi:https://Gtk?version=4.0' {
    const Gtk40: typeof import('./gtk-4.0.js').default;
    export default Gtk40;
}

declare module 'gi:https://Gtk' {
    const Gtk40: typeof import('./gtk-4.0.js').default;
    export default Gtk40;
}

But on second thought, having this feature only for modules that don't have conflicting versions would be the better idea.

@JumpLink
Copy link
Collaborator

@vixalien which version do you use? In @girs/gtk-4.0 v4.14.3-4.0.0-beta.5 gi:https://Gtk is already exported without the version affix because it's the latest version. This is also the case for the other GObject libraries. Can you give it a try?

@vixalien
Copy link
Author

Oh nice. I just used the latest stable version with npx ts-for-gir.

I'll retry and update you!

@JumpLink
Copy link
Collaborator

@vixalien With the latest version, all Ambient Modules are now generated without a version string. With the CLI argument --onlyVersionPrefix this can be deactivated, then only Ambient Modules with version strings are generated. Please give feedback if this works for you :)

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

No branches or pull requests

2 participants