File tree 2 files changed +15
-0
lines changed
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"
9
9
import renderDefaultLocale from "./contentful/renderDefaultLocale"
10
10
import renderNamespace from "./contentful/renderNamespace"
11
11
import renderLocalizedTypes from "./contentful/renderLocalizedTypes"
12
+ import renderContentTypeId from "./contentful/renderContentTypeId"
12
13
13
14
interface Options {
14
15
localization ?: boolean
@@ -26,6 +27,7 @@ export default async function render(
26
27
const typingsSource = [
27
28
renderAllContentTypes ( sortedContentTypes , localization ) ,
28
29
renderAllContentTypeIds ( sortedContentTypes ) ,
30
+ renderEntryType ( sortedContentTypes ) ,
29
31
renderAllLocales ( sortedLocales ) ,
30
32
renderDefaultLocale ( sortedLocales ) ,
31
33
renderLocalizedTypes ( localization ) ,
@@ -50,3 +52,10 @@ function renderAllContentTypeIds(contentTypes: ContentType[]): string {
50
52
contentTypes . map ( contentType => `'${ contentType . sys . id } '` ) ,
51
53
)
52
54
}
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()", () => {
82
82
83
83
export type CONTENT_TYPE = \\"myContentType\\"
84
84
85
+ export type IEntry = IMyContentType
86
+
85
87
export type LOCALE_CODE = \\"en-US\\" | \\"pt-BR\\"
86
88
87
89
export type CONTENTFUL_DEFAULT_LOCALE_CODE = \\"en-US\\"
@@ -152,6 +154,8 @@ describe("render()", () => {
152
154
153
155
export type CONTENT_TYPE = \\"myContentType\\"
154
156
157
+ export type IEntry = IMyContentType
158
+
155
159
export type LOCALE_CODE = \\"en-US\\" | \\"pt-BR\\"
156
160
157
161
export type CONTENTFUL_DEFAULT_LOCALE_CODE = \\"en-US\\"
@@ -215,6 +219,8 @@ describe("render()", () => {
215
219
216
220
export type CONTENT_TYPE = \\"myContentType\\"
217
221
222
+ export type IEntry = IMyContentType
223
+
218
224
export type LOCALE_CODE = \\"en-US\\" | \\"pt-BR\\"
219
225
220
226
export type CONTENTFUL_DEFAULT_LOCALE_CODE = \\"en-US\\"
You can’t perform that action at this time.
0 commit comments