File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,14 @@ export type MessageDialogDefaultButtons =
88
88
| 'YesNo'
89
89
| 'YesNoCancel'
90
90
91
+ /** All possible button keys. */
92
+ type ButtonKey = 'ok' | 'cancel' | 'yes' | 'no'
93
+
94
+ /** Ban everything except a set of keys. */
95
+ type BanExcept < Allowed extends ButtonKey > = Partial <
96
+ Record < Exclude < ButtonKey , Allowed > , never >
97
+ >
98
+
91
99
/**
92
100
* The Yes, No and Cancel buttons of a message dialog.
93
101
*
@@ -100,7 +108,7 @@ export type MessageDialogButtonsYesNoCancel = {
100
108
no : string
101
109
/** The Cancel button. */
102
110
cancel : string
103
- }
111
+ } & BanExcept < 'yes' | 'no' | 'cancel' >
104
112
105
113
/**
106
114
* The Ok and Cancel buttons of a message dialog.
@@ -112,7 +120,7 @@ export type MessageDialogButtonsOkCancel = {
112
120
ok : string
113
121
/** The Cancel button. */
114
122
cancel : string
115
- }
123
+ } & BanExcept < 'ok' | 'cancel' >
116
124
117
125
/**
118
126
* The Ok button of a message dialog.
@@ -122,7 +130,7 @@ export type MessageDialogButtonsOkCancel = {
122
130
export type MessageDialogButtonsOk = {
123
131
/** The Ok button. */
124
132
ok : string
125
- }
133
+ } & BanExcept < 'ok' >
126
134
127
135
/**
128
136
* Custom buttons for a message dialog.
You can’t perform that action at this time.
0 commit comments