update ChangeFreq to support typescript configurations with string literal (#6262)

* update `ChangeFreq`

* `pnpm exec changeset`

* use @Princesseuh suggested change

* Revert "use @Princesseuh suggested change"

This reverts commit a1e5660c25.

* use @Princesseuh suggested change and an `as`
This commit is contained in:
vic1707 2023-02-17 19:46:00 +01:00 committed by GitHub
parent 2e4ca0370a
commit 4fcefa34f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'@astrojs/sitemap': minor
---
update `ChangeFreq` to support typescript configurations with string literal or predefined value.

View file

@ -1,3 +1,4 @@
import { EnumChangefreq } from 'sitemap';
import type { SitemapItem, SitemapOptions } from './index.js';
import { parseUrl } from './utils/parse-url.js';
@ -44,7 +45,7 @@ export function generateSitemap(pages: string[], finalSiteUrl: string, opts: Sit
links,
lastmod,
priority,
changefreq,
changefreq: changefreq as EnumChangefreq,
};
});

View file

@ -12,7 +12,7 @@ import { generateSitemap } from './generate-sitemap.js';
import { Logger } from './utils/logger.js';
import { validateOptions } from './validate-options.js';
export type ChangeFreq = EnumChangefreq;
export type ChangeFreq = `${EnumChangefreq}`;
export type SitemapItem = Pick<
SitemapItemLoose,
'url' | 'lastmod' | 'changefreq' | 'priority' | 'links'