11import i18next from 'i18next' ;
2- import {
3- UserPreferences as Preferences ,
4- AppThemeOptions ,
5- UpdatePreferencesRequestBody
6- } from '../../../../common/types' ;
2+ import { UpdatePreferencesRequestBody } from '../../../../common/types' ;
73import { apiClient } from '../../../utils/apiClient' ;
84import * as ActionTypes from '../../../constants' ;
9- import { PreferencesState } from '../reducers/preferences' ;
10- import { RootState } from '../../../reducers' ;
5+ import type { PreferencesState } from '../reducers/preferences' ;
6+ import type { RootState } from '../../../reducers' ;
117
128export type UpdatePreferencesDispatch = ( action : unknown ) => void ;
139export type GetRootState = ( ) => RootState ;
@@ -27,14 +23,24 @@ function updatePreferences(
2723 } ) ;
2824}
2925
30- export function setPreferencesTab ( value : PreferencesState [ 'tabIndex' ] ) {
26+ type SetPreferencesTabValue = PreferencesState [ 'tabIndex' ] ;
27+ export type SetPreferencesTabAction = {
28+ type : typeof ActionTypes . SET_PREFERENCES_TAB ;
29+ value : SetPreferencesTabValue ;
30+ } ;
31+ export function setPreferencesTab ( value : SetPreferencesTabValue ) {
3132 return {
3233 type : ActionTypes . SET_PREFERENCES_TAB ,
3334 value
3435 } ;
3536}
3637
37- export function setFontSize ( value : PreferencesState [ 'fontSize' ] ) {
38+ type SetFontSizeValue = PreferencesState [ 'fontSize' ] ;
39+ export type SetFontSizeAction = {
40+ type : typeof ActionTypes . SET_FONT_SIZE ;
41+ value : SetFontSizeAction ;
42+ } ;
43+ export function setFontSize ( value : SetFontSizeValue ) {
3844 return ( dispatch : UpdatePreferencesDispatch , getState : GetRootState ) => {
3945 // eslint-disable-line
4046 dispatch ( {
@@ -53,7 +59,12 @@ export function setFontSize(value: PreferencesState['fontSize']) {
5359 } ;
5460}
5561
56- export function setLineNumbers ( value ) {
62+ type SetLineNumbersValue = PreferencesState [ 'lineNumbers' ] ;
63+ export type SetLineNumbersAction = {
64+ type : typeof ActionTypes . SET_LINE_NUMBERS ;
65+ value : SetLineNumbersValue ;
66+ } ;
67+ export function setLineNumbers ( value : SetLineNumbersValue ) {
5768 return ( dispatch : UpdatePreferencesDispatch , getState : GetRootState ) => {
5869 dispatch ( {
5970 type : ActionTypes . SET_LINE_NUMBERS ,
@@ -71,7 +82,14 @@ export function setLineNumbers(value) {
7182 } ;
7283}
7384
74- export function setAutocloseBracketsQuotes ( value ) {
85+ type SetAutocloseBracketsQuotesValue = PreferencesState [ 'autocloseBracketsQuotes' ] ;
86+ export type SetAutocloseBracketsQuotesAction = {
87+ type : typeof ActionTypes . SET_AUTOCLOSE_BRACKETS_QUOTES ;
88+ value : SetAutocloseBracketsQuotesValue ;
89+ } ;
90+ export function setAutocloseBracketsQuotes (
91+ value : SetAutocloseBracketsQuotesValue
92+ ) {
7593 return ( dispatch : UpdatePreferencesDispatch , getState : GetRootState ) => {
7694 dispatch ( {
7795 type : ActionTypes . SET_AUTOCLOSE_BRACKETS_QUOTES ,
@@ -89,7 +107,12 @@ export function setAutocloseBracketsQuotes(value) {
89107 } ;
90108}
91109
92- export function setAutocompleteHinter ( value ) {
110+ type SetAutocompleteHinterValue = PreferencesState [ 'autocompleteHinter' ] ;
111+ export type SetAutocompleteHinterValueAction = {
112+ type : typeof ActionTypes . SET_AUTOCLOSE_BRACKETS_QUOTES ;
113+ value : SetAutocompleteHinterValue ;
114+ } ;
115+ export function setAutocompleteHinter ( value : SetAutocompleteHinterValue ) {
93116 return ( dispatch : UpdatePreferencesDispatch , getState : GetRootState ) => {
94117 dispatch ( {
95118 type : ActionTypes . SET_AUTOCOMPLETE_HINTER ,
0 commit comments