11import  i18next  from  'i18next' ; 
2+ import  {  UpdatePreferencesRequestBody  }  from  '../../../../common/types' ; 
23import  {  apiClient  }  from  '../../../utils/apiClient' ; 
34import  *  as  ActionTypes  from  '../../../constants' ; 
5+ import  type  { 
6+  UpdatePreferencesDispatch , 
7+  SetPreferencesTabValue , 
8+  SetFontSizeValue , 
9+  GetRootState , 
10+  SetLineNumbersValue , 
11+  SetAutocloseBracketsQuotesValue , 
12+  SetAutocompleteHinterValue , 
13+  SetAutosaveValue , 
14+  SetLinewrapValue , 
15+  SetLintWarningValue , 
16+  SetTextOutputValue , 
17+  SetAllAccessibleOutputValue , 
18+  SetAutorefreshValue , 
19+  SetGridOutputValue , 
20+  SetLanguageValue , 
21+  SetThemeValue 
22+ }  from  './preferences.types' ; 
423
5- function  updatePreferences ( formParams ,  dispatch )  { 
24+ function  updatePreferences ( 
25+  formParams : UpdatePreferencesRequestBody , 
26+  dispatch : UpdatePreferencesDispatch 
27+ )  { 
628 apiClient 
729 . put ( '/preferences' ,  formParams ) 
830 . then ( ( )  =>  { } ) 
@@ -14,15 +36,15 @@ function updatePreferences(formParams, dispatch) {
1436 } ) ; 
1537} 
1638
17- export  function  setPreferencesTab ( value )  { 
39+ export  function  setPreferencesTab ( value :  SetPreferencesTabValue )  { 
1840 return  { 
1941 type : ActionTypes . SET_PREFERENCES_TAB , 
2042 value
2143 } ; 
2244} 
2345
24- export  function  setFontSize ( value )  { 
25-  return  ( dispatch ,  getState )  =>  { 
46+ export  function  setFontSize ( value :  SetFontSizeValue )  { 
47+  return  ( dispatch :  UpdatePreferencesDispatch ,  getState :  GetRootState )  =>  { 
2648 // eslint-disable-line 
2749 dispatch ( { 
2850 type : ActionTypes . SET_FONT_SIZE , 
@@ -40,8 +62,8 @@ export function setFontSize(value) {
4062 } ; 
4163} 
4264
43- export  function  setLineNumbers ( value )  { 
44-  return  ( dispatch ,  getState )  =>  { 
65+ export  function  setLineNumbers ( value :  SetLineNumbersValue )  { 
66+  return  ( dispatch :  UpdatePreferencesDispatch ,  getState :  GetRootState )  =>  { 
4567 dispatch ( { 
4668 type : ActionTypes . SET_LINE_NUMBERS , 
4769 value
@@ -58,8 +80,10 @@ export function setLineNumbers(value) {
5880 } ; 
5981} 
6082
61- export  function  setAutocloseBracketsQuotes ( value )  { 
62-  return  ( dispatch ,  getState )  =>  { 
83+ export  function  setAutocloseBracketsQuotes ( 
84+  value : SetAutocloseBracketsQuotesValue 
85+ )  { 
86+  return  ( dispatch : UpdatePreferencesDispatch ,  getState : GetRootState )  =>  { 
6387 dispatch ( { 
6488 type : ActionTypes . SET_AUTOCLOSE_BRACKETS_QUOTES , 
6589 value
@@ -76,8 +100,8 @@ export function setAutocloseBracketsQuotes(value) {
76100 } ; 
77101} 
78102
79- export  function  setAutocompleteHinter ( value )  { 
80-  return  ( dispatch ,  getState )  =>  { 
103+ export  function  setAutocompleteHinter ( value :  SetAutocompleteHinterValue )  { 
104+  return  ( dispatch :  UpdatePreferencesDispatch ,  getState :  GetRootState )  =>  { 
81105 dispatch ( { 
82106 type : ActionTypes . SET_AUTOCOMPLETE_HINTER , 
83107 value
@@ -94,8 +118,8 @@ export function setAutocompleteHinter(value) {
94118 } ; 
95119} 
96120
97- export  function  setAutosave ( value )  { 
98-  return  ( dispatch ,  getState )  =>  { 
121+ export  function  setAutosave ( value :  SetAutosaveValue )  { 
122+  return  ( dispatch :  UpdatePreferencesDispatch ,  getState :  GetRootState )  =>  { 
99123 dispatch ( { 
100124 type : ActionTypes . SET_AUTOSAVE , 
101125 value
@@ -112,8 +136,8 @@ export function setAutosave(value) {
112136 } ; 
113137} 
114138
115- export  function  setLinewrap ( value )  { 
116-  return  ( dispatch ,  getState )  =>  { 
139+ export  function  setLinewrap ( value :  SetLinewrapValue )  { 
140+  return  ( dispatch :  UpdatePreferencesDispatch ,  getState :  GetRootState )  =>  { 
117141 dispatch ( { 
118142 type : ActionTypes . SET_LINEWRAP , 
119143 value
@@ -130,8 +154,8 @@ export function setLinewrap(value) {
130154 } ; 
131155} 
132156
133- export  function  setLintWarning ( value )  { 
134-  return  ( dispatch ,  getState )  =>  { 
157+ export  function  setLintWarning ( value :  SetLintWarningValue )  { 
158+  return  ( dispatch :  UpdatePreferencesDispatch ,  getState :  GetRootState )  =>  { 
135159 dispatch ( { 
136160 type : ActionTypes . SET_LINT_WARNING , 
137161 value
@@ -148,8 +172,8 @@ export function setLintWarning(value) {
148172 } ; 
149173} 
150174
151- export  function  setTextOutput ( value )  { 
152-  return  ( dispatch ,  getState )  =>  { 
175+ export  function  setTextOutput ( value :  SetTextOutputValue )  { 
176+  return  ( dispatch :  UpdatePreferencesDispatch ,  getState :  GetRootState )  =>  { 
153177 dispatch ( { 
154178 type : ActionTypes . SET_TEXT_OUTPUT , 
155179 value
@@ -166,8 +190,8 @@ export function setTextOutput(value) {
166190 } ; 
167191} 
168192
169- export  function  setGridOutput ( value )  { 
170-  return  ( dispatch ,  getState )  =>  { 
193+ export  function  setGridOutput ( value :  SetGridOutputValue )  { 
194+  return  ( dispatch :  UpdatePreferencesDispatch ,  getState :  GetRootState )  =>  { 
171195 dispatch ( { 
172196 type : ActionTypes . SET_GRID_OUTPUT , 
173197 value
@@ -184,12 +208,8 @@ export function setGridOutput(value) {
184208 } ; 
185209} 
186210
187- export  function  setTheme ( value )  { 
188-  // return { 
189-  // type: ActionTypes.SET_THEME, 
190-  // value 
191-  // }; 
192-  return  ( dispatch ,  getState )  =>  { 
211+ export  function  setTheme ( value : SetThemeValue )  { 
212+  return  ( dispatch : UpdatePreferencesDispatch ,  getState : GetRootState )  =>  { 
193213 dispatch ( { 
194214 type : ActionTypes . SET_THEME , 
195215 value
@@ -206,12 +226,8 @@ export function setTheme(value) {
206226 } ; 
207227} 
208228
209- export  function  setAutorefresh ( value )  { 
210-  // return { 
211-  // type: ActionTypes.SET_AUTOREFRESH, 
212-  // value 
213-  // }; 
214-  return  ( dispatch ,  getState )  =>  { 
229+ export  function  setAutorefresh ( value : SetAutorefreshValue )  { 
230+  return  ( dispatch : UpdatePreferencesDispatch ,  getState : GetRootState )  =>  { 
215231 dispatch ( { 
216232 type : ActionTypes . SET_AUTOREFRESH , 
217233 value
@@ -228,15 +244,18 @@ export function setAutorefresh(value) {
228244 } ; 
229245} 
230246
231- export  function  setAllAccessibleOutput ( value )  { 
232-  return  ( dispatch )  =>  { 
247+ export  function  setAllAccessibleOutput ( value :  SetAllAccessibleOutputValue )  { 
248+  return  ( dispatch :  UpdatePreferencesDispatch , getState :  GetRootState )  =>  { 
233249 dispatch ( setTextOutput ( value ) ) ; 
234250 dispatch ( setGridOutput ( value ) ) ; 
235251 } ; 
236252} 
237253
238- export  function  setLanguage ( value ,  {  persistPreference =  true  }  =  { } )  { 
239-  return  ( dispatch ,  getState )  =>  { 
254+ export  function  setLanguage ( 
255+  value : SetLanguageValue , 
256+  {  persistPreference =  true  }  =  { } 
257+ )  { 
258+  return  ( dispatch : UpdatePreferencesDispatch ,  getState : GetRootState )  =>  { 
240259 i18next . changeLanguage ( value ) ; 
241260 dispatch ( { 
242261 type : ActionTypes . SET_LANGUAGE , 
0 commit comments