Skip to content

Commit

Permalink
fix(astro): duplicated brackets are generated in data collections. (#…
Browse files Browse the repository at this point in the history
…11275)

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

This PR fixed #11274

* Create duplicated-brackets-generation.md
  • Loading branch information
syhily authored Jun 17, 2024
1 parent 83c565b commit bab700d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/duplicated-brackets-generation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Drop duplicated brackets in data collections schema generation.
2 changes: 1 addition & 1 deletion packages/astro/src/content/types-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -482,6 +481,7 @@ async function writeContentFiles({
);
}
}
dataTypesStr += `};\n`;
break;
}
}
Expand Down

0 comments on commit bab700d

Please sign in to comment.