kopia lustrzana https://github.com/cloudflare/wildebeest
Merge pull request #350 from cloudflare/fix-meta-readonly-ts
fix DocumentHeadValue being modified as readonlypull/354/head
commit
2659576712
|
@ -10,6 +10,8 @@ type DocumentHeadData = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type NoReadonly<T> = { -readonly [P in keyof T]: NoReadonly<T[P]> }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a head to provide to QwikCity
|
* Generates a head to provide to QwikCity
|
||||||
*
|
*
|
||||||
|
@ -18,7 +20,7 @@ type DocumentHeadData = {
|
||||||
* @returns the QwikCity head ready to use
|
* @returns the QwikCity head ready to use
|
||||||
*/
|
*/
|
||||||
export function getDocumentHead(data: DocumentHeadData, head?: DocumentHeadValue) {
|
export function getDocumentHead(data: DocumentHeadData, head?: DocumentHeadValue) {
|
||||||
const result: DocumentHeadValue = { meta: [] }
|
const result: NoReadonly<DocumentHeadValue> = { meta: [] }
|
||||||
|
|
||||||
const setMeta = (name: string, content: string) => {
|
const setMeta = (name: string, content: string) => {
|
||||||
if (head?.meta?.some((meta) => meta.name === name)) {
|
if (head?.meta?.some((meta) => meta.name === name)) {
|
||||||
|
|
Ładowanie…
Reference in New Issue