File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import renderAllLocales from "./contentful/renderAllLocales"
99import renderDefaultLocale from "./contentful/renderDefaultLocale"
1010import renderNamespace from "./contentful/renderNamespace"
1111import renderLocalizedTypes from "./contentful/renderLocalizedTypes"
12+ import renderContentTypeId from "./contentful/renderContentTypeId"
1213
1314interface Options {
1415 localization ?: boolean
@@ -26,6 +27,7 @@ export default async function render(
2627 const typingsSource = [
2728 renderAllContentTypes ( sortedContentTypes , localization ) ,
2829 renderAllContentTypeIds ( sortedContentTypes ) ,
30+ renderEntryType ( sortedContentTypes ) ,
2931 renderAllLocales ( sortedLocales ) ,
3032 renderDefaultLocale ( sortedLocales ) ,
3133 renderLocalizedTypes ( localization ) ,
@@ -50,3 +52,10 @@ function renderAllContentTypeIds(contentTypes: ContentType[]): string {
5052 contentTypes . map ( contentType => `'${ contentType . sys . id } '` ) ,
5153 )
5254}
55+
56+ function renderEntryType ( contentTypes : ContentType [ ] ) {
57+ return renderUnion (
58+ "IEntry" ,
59+ contentTypes . map ( contentType => renderContentTypeId ( contentType . sys . id ) ) ,
60+ )
61+ }
Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ describe("render()", () => {
8282
8383 export type CONTENT_TYPE = \\"myContentType\\"
8484
85+ export type IEntry = IMyContentType
86+
8587 export type LOCALE_CODE = \\"en-US\\" | \\"pt-BR\\"
8688
8789 export type CONTENTFUL_DEFAULT_LOCALE_CODE = \\"en-US\\"
@@ -152,6 +154,8 @@ describe("render()", () => {
152154
153155 export type CONTENT_TYPE = \\"myContentType\\"
154156
157+ export type IEntry = IMyContentType
158+
155159 export type LOCALE_CODE = \\"en-US\\" | \\"pt-BR\\"
156160
157161 export type CONTENTFUL_DEFAULT_LOCALE_CODE = \\"en-US\\"
@@ -215,6 +219,8 @@ describe("render()", () => {
215219
216220 export type CONTENT_TYPE = \\"myContentType\\"
217221
222+ export type IEntry = IMyContentType
223+
218224 export type LOCALE_CODE = \\"en-US\\" | \\"pt-BR\\"
219225
220226 export type CONTENTFUL_DEFAULT_LOCALE_CODE = \\"en-US\\"
You can’t perform that action at this time.
0 commit comments