From 6be2dabff6c35fb79d85ba39b692c5d06cd53125 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Wed, 25 Mar 2020 06:50:09 +0900 Subject: Use typed completions on console --- src/console/Completions.ts | 11 +++++++++++ src/console/actions/index.ts | 5 +++-- src/console/reducers/index.ts | 3 ++- 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 src/console/Completions.ts diff --git a/src/console/Completions.ts b/src/console/Completions.ts new file mode 100644 index 0000000..ec9135f --- /dev/null +++ b/src/console/Completions.ts @@ -0,0 +1,11 @@ +type Completions = { + readonly name: string; + readonly items: { + readonly caption?: string; + readonly content?: string; + readonly url?: string; + readonly icon?: string; + }[]; +}[] + +export default Completions; \ No newline at end of file diff --git a/src/console/actions/index.ts b/src/console/actions/index.ts index 3770496..d36f8cd 100644 --- a/src/console/actions/index.ts +++ b/src/console/actions/index.ts @@ -1,4 +1,5 @@ -// console commands +import Completions from "../Completions"; + export const CONSOLE_HIDE = 'console.hide'; export const CONSOLE_SHOW_COMMAND = 'console.show.command'; export const CONSOLE_SHOW_ERROR = 'console.show.error'; @@ -44,7 +45,7 @@ interface SetConsoleTextAction { interface SetCompletionsAction { type: typeof CONSOLE_SET_COMPLETIONS; - completions: any[]; + completions: Completions; completionSource: string; } diff --git a/src/console/reducers/index.ts b/src/console/reducers/index.ts index 048a24f..677a982 100644 --- a/src/console/reducers/index.ts +++ b/src/console/reducers/index.ts @@ -1,11 +1,12 @@ import * as actions from '../actions'; +import Completions from "../Completions"; export interface State { mode: string; messageText: string; consoleText: string; completionSource: string; - completions: any[], + completions: Completions; select: number; viewIndex: number; } -- cgit v1.2.3