Skip to content

Commit ec5e3cf

Browse files
committed
fix types.ts
1 parent 22c002c commit ec5e3cf

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

lib/types.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export type TemplateMessage = {
182182

183183
export type ImageMapAction = ImageMapURIAction | ImageMapMessageAction;
184184

185-
export type ImageMapActionBase = { area: ImageMapArea };
185+
export type ImageMapActionBase = { area: Area };
186186

187187
export type ImageMapURIAction = {
188188
type: "uri";
@@ -194,7 +194,7 @@ export type ImageMapMessageAction = {
194194
text: string;
195195
} & ImageMapActionBase;
196196

197-
export type ImageMapArea = {
197+
export type Area = {
198198
x: number;
199199
y: number;
200200
width: number;
@@ -212,13 +212,13 @@ export type TemplateButtons = {
212212
thumbnailImageUrl?: string;
213213
title?: string;
214214
text: string;
215-
actions: TemplateAction<{ label: string }>[];
215+
actions: Action<{ label: string }>[];
216216
};
217217

218218
export type TemplateConfirm = {
219219
type: "confirm";
220220
text: string;
221-
actions: TemplateAction<{ label: string }>[];
221+
actions: Action<{ label: string }>[];
222222
};
223223

224224
export type TemplateCarousel = { type: "carousel"; columns: TemplateColumn[] };
@@ -227,7 +227,7 @@ export type TemplateColumn = {
227227
thumbnailImageUrl?: string;
228228
title?: string;
229229
text: string;
230-
actions: TemplateAction<{ label: string }>[];
230+
actions: Action<{ label: string }>[];
231231
};
232232

233233
export type TemplateImageCarousel = {
@@ -237,10 +237,10 @@ export type TemplateImageCarousel = {
237237

238238
export type TemplateImageColumn = {
239239
imageUrl: string;
240-
action: TemplateAction<{ label?: string }>;
240+
action: Action<{ label?: string }>;
241241
};
242242

243-
export type TemplateAction<Label> =
243+
export type Action<Label> =
244244
| TemplatePostbackAction & Label
245245
| TemplateMessageAction & Label
246246
| TemplateURIAction & Label
@@ -276,15 +276,12 @@ export type Size = {
276276
height: number;
277277
};
278278

279-
export type RichMenuArea = {
280-
bounds: ImageMapArea;
281-
action: TemplateAction<any>;
282-
};
279+
export type RichMenuId = { richMenuId: string };
283280

284281
export type RichMenu = {
285282
size: Size;
286283
selected: boolean;
287284
name: string;
288285
chatBarText: string;
289-
areas: RichMenuArea[];
286+
areas: Array<{ bounds: Area; action: Action<{}> }>;
290287
};

0 commit comments

Comments
 (0)