Skip to content

Commit 5a4086f

Browse files
authored
Merge pull request #1462 from nib-bturner/overloading
Improve types for builtin editor widget IDs
2 parents 0c2e44e + d5e6771 commit 5a4086f

File tree

1 file changed

+41
-4
lines changed

1 file changed

+41
-4
lines changed

index.d.ts

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,32 @@ export interface EditorLayoutMovement {
3131
afterFieldGroup(groupId?: string): void
3232
}
3333

34+
type BuiltinEditor =
35+
| 'assetLinkEditor'
36+
| 'assetLinksEditor'
37+
| 'assetGalleryEditor'
38+
| 'boolean'
39+
| 'datePicker'
40+
| 'entryLinkEditor'
41+
| 'entryLinksEditor'
42+
| 'entryCardEditor'
43+
| 'entryCardsEditor'
44+
| 'numberEditor'
45+
| 'rating'
46+
| 'locationEditor'
47+
| 'objectEditor'
48+
| 'urlEditor'
49+
| 'slugEditor'
50+
| 'listInput'
51+
| 'checkbox'
52+
| 'tagEditor'
53+
| 'multipleLine'
54+
| 'markdown'
55+
| 'singleLine'
56+
| 'dropdown'
57+
| 'radio'
58+
| 'richTextEditor'
59+
3460
type FieldType =
3561
| 'Symbol'
3662
| 'Text'
@@ -208,8 +234,8 @@ export interface IFieldGroupWidgetSettings {
208234
}
209235

210236
export interface IEntryEditor {
211-
widgetNamespace: 'editor-builtin' | 'builtin' | 'extension' | 'app',
212-
widgetId: string,
237+
widgetNamespace: 'editor-builtin' | 'builtin' | 'extension' | 'app'
238+
widgetId: string
213239
settings?: IEditorInterfaceOptions
214240
}
215241

@@ -251,7 +277,12 @@ export interface ContentType {
251277
* @param settings Widget settings
252278
*/
253279
configureEntryEditor(
254-
widgetNamespace: 'editor-builtin' | 'builtin' | 'extension' | 'app',
280+
widgetNamespace: 'builtin',
281+
widgetId: BuiltinEditor,
282+
settings?: IEditorInterfaceOptions
283+
): void
284+
configureEntryEditor(
285+
widgetNamespace: 'editor-builtin' | 'extension' | 'app',
255286
widgetId: string,
256287
settings?: IEditorInterfaceOptions
257288
): void
@@ -273,7 +304,13 @@ export interface ContentType {
273304
*/
274305
changeFieldControl(
275306
fieldId: string,
276-
widgetNamespace: 'builtin' | 'extension' | 'app',
307+
widgetNamespace: 'builtin',
308+
widgetId: BuiltinEditor,
309+
settings: IEditorInterfaceOptions
310+
): void
311+
changeFieldControl(
312+
fieldId: string,
313+
widgetNamespace: 'extension' | 'app',
277314
widgetId: string,
278315
settings?: IEditorInterfaceOptions
279316
): void

0 commit comments

Comments
 (0)