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

feat: Export types like SitemapUrl #429

Open
MickL opened this issue Mar 12, 2025 · 4 comments
Open

feat: Export types like SitemapUrl #429

MickL opened this issue Mar 12, 2025 · 4 comments
Labels
enhancement New feature or request

Comments

@MickL
Copy link

MickL commented Mar 12, 2025

🆒 Your use case

I am having a third party backend api (Nitro) and I want to create an endpoint for sitemap urls. For this I need to return an array of SitemapUrl. I would love to use this interface:

import type { SitemapUrl } from '@nuxtjs/sitemap';

export default defineSitemapEventHandler(async (): Promise<SitemapUrl[]> => {
  // ...
});

But unfortunately this interface is not exported from the package. This interface also contains more interfaces that should be exported as well: Changefreq, AlternativeEntry, GoogleNewsEntry, ImageEntry and VideoEntry.

🆕 The solution you'd like

Export SitemapUrl and the other interfaces. I see in the code they are, but they dont end up to be importable.

🔍 Alternatives you've considered

Currently I copy line 329 to line 429 into my project.

@MickL MickL added the enhancement New feature or request label Mar 12, 2025
@harlan-zw
Copy link
Collaborator

@MickL
Copy link
Author

MickL commented Mar 13, 2025

I cant because the API is an external API, not a Nuxt project. If you would just export the types this would help a lot.

@harlan-zw
Copy link
Collaborator

harlan-zw commented Mar 13, 2025

Oh I see, sorry, I misunderstood the issue. I would just suggest copy+pasting the types as I may make changes to the interface that could break your implementation.

I'm open to creating a Nitro Sitemap module in the future, which may be a better thing to track.

@harlan-zw harlan-zw reopened this Mar 13, 2025
@MickL
Copy link
Author

MickL commented Mar 13, 2025

But when you make changes this is exactly the point of not copy pasting, and instead importing from the package itself :)

Btw Nitro Sitemap module would be amazing for me personally! However this issue is also in the perspective of every other external API.

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

No branches or pull requests

2 participants