0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-31 23:31:30 -05:00

fix(astro): duplicated brackets are generated in data collections. (#11275)

* fix(astro): duplicated brackets are generated in data collections.

This PR fixed #11274

* Create duplicated-brackets-generation.md
This commit is contained in:
Yufan Sheng 2024-06-18 00:46:57 +08:00 committed by GitHub
parent 83c565b36c
commit bab700d690
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Drop duplicated brackets in data collections schema generation.

View file

@ -449,7 +449,6 @@ async function writeContentFiles({
for (const entryKey of Object.keys(collection.entries).sort()) {
const dataType = collectionConfig?.schema ? `InferEntrySchema<${collectionKey}>` : 'any';
dataTypesStr += `${entryKey}: {\n id: ${entryKey};\n collection: ${collectionKey};\n data: ${dataType}\n};\n`;
dataTypesStr += `};\n`;
}
if (settings.config.experimental.contentCollectionJsonSchema && collectionConfig?.schema) {
@ -482,6 +481,7 @@ async function writeContentFiles({
);
}
}
dataTypesStr += `};\n`;
break;
}
}