type Actions (#7862)

* type ViewHomPage action

Signed-off-by: Kerry Archibald <kerrya@element.io>

* type spacestore actions

Signed-off-by: Kerry Archibald <kerrya@element.io>

* lint

Signed-off-by: Kerry Archibald <kerrya@element.io>

* add action types

Signed-off-by: Kerry Archibald <kerrya@element.io>

* use new action types in stores

Signed-off-by: Kerry Archibald <kerrya@element.io>

* remove debug change

Signed-off-by: Kerry Archibald <kerrya@element.io>

* stricter keyboard shortcut types

Signed-off-by: Kerry Archibald <kerrya@element.io>

* action comments

Signed-off-by: Kerry Archibald <kerrya@element.io>
This commit is contained in:
Kerry 2022-02-22 11:04:27 +01:00 committed by GitHub
parent 57595bc593
commit 5b8d440406
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 304 additions and 73 deletions

View file

@ -114,7 +114,14 @@ export const labGroupNames: Record<LabGroup, string> = {
[LabGroup.Developer]: _td("Developer"),
};
interface IBaseSetting {
export type SettingValueType = boolean |
number |
string |
number[] |
string[] |
Record<string, unknown>;
export interface IBaseSetting<T extends SettingValueType = SettingValueType> {
isFeature?: false | undefined;
// Display names are strongly recommended for clarity.
@ -134,7 +141,7 @@ interface IBaseSetting {
// Required. Can be any data type. The value specified here should match
// the data being stored (ie: if a boolean is used, the setting should
// represent a boolean).
default: any;
default: T;
// Optional settings controller. See SettingsController for more information.
controller?: SettingController;
@ -166,7 +173,7 @@ interface IBaseSetting {
};
}
export interface IFeature extends Omit<IBaseSetting, "isFeature"> {
export interface IFeature extends Omit<IBaseSetting<boolean>, "isFeature"> {
// Must be set to true for features.
isFeature: true;
labsGroup: LabGroup;