Skip to content

Commit 6902cbf

Browse files
committed
Full TS implementation on SwitchApp.tsx
1 parent ce2f1a9 commit 6902cbf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/app/components/SwitchApp.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,23 @@ import Select from 'react-select';
33
import { useStoreContext } from '../store';
44
import { setTab } from '../actions/actions';
55

6-
const SwitchAppDropdown = () => {
6+
const SwitchAppDropdown = (): JSX.Element => {
77
const [{ currentTab, tabs }, dispatch] = useStoreContext();
88

9-
const tabsArray: any[] = [];
9+
const tabsArray: {}[] = [];
1010
Object.keys(tabs).forEach((tab) => {
1111
tabsArray.unshift({ value: tab, label: tabs[tab].title });
1212
});
1313

14-
const currTab = {
14+
const currTab: {} = {
1515
value: currentTab,
1616
label: tabs[currentTab].title,
1717
};
1818

19-
const customStyles = {
20-
menu: (provided, state) => {
21-
const outline = state.isSelected ? 'transparent' : 'transparent';
22-
const margin = 0;
19+
const customStyles: {} = {
20+
menu: (provided, state):{} => {
21+
const outline: string = state.isSelected ? 'transparent' : 'transparent';
22+
const margin: number = 0;
2323

2424
return { ...provided, outline, margin };
2525
},
@@ -31,7 +31,7 @@ const SwitchAppDropdown = () => {
3131
classNamePrefix='tab-select'
3232
value={currTab}
3333
styles={customStyles}
34-
onChange={(e) => {
34+
onChange={(e): void => {
3535
dispatch(setTab(parseInt(e.value, 10)));
3636
}}
3737
options={tabsArray}

0 commit comments

Comments
 (0)