Skip to content

Commit 65152b9

Browse files
committed
Added Typescript to functions that return JSX elements
1 parent d61b5fb commit 65152b9

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

src/app/components/Action.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ interface ActionProps {
3939
*/
4040
// index and delta props were removed from Action.jsx */
4141
// viewIndex and handleonkeyDown added to props
42-
const Action = (props: ActionProps): unknown => {
42+
const Action = (props: ActionProps): JSX.Element => {
4343
const {
4444
selected, last, index, sliderIndex, dispatch, displayName, componentName,
4545
componentData, viewIndex, handleOnkeyDown,
@@ -80,7 +80,7 @@ const Action = (props: ActionProps): unknown => {
8080
return (
8181
<div
8282
// Invoking keyboard functionality; functionality is in ActionContainer;
83-
onKeyDown={(e:string) => handleOnkeyDown(e, viewIndex)}
83+
onKeyDown={(e) => handleOnkeyDown(e, viewIndex)}
8484
className={selected || last ? 'action-component selected' : 'action-component'}
8585
onClick={() => {
8686
dispatch(changeView(index));

src/app/components/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const initialState:{port: null|number,
1010
tabs: {},
1111
};
1212

13-
function App(): unknown {
13+
function App(): JSX.Element {
1414
return (
1515
<StoreContext.Provider value={useReducer(mainReducer, initialState)}>
1616
<MainContainer />

src/app/components/DiffRoute.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@ interface DiffRouteProps{
1111
state?: string | unknown
1212
stateSnaphot?: Record<string, unknown>;
1313
children?: unknown[];
14+
atomSelectors?:object;
15+
atomsComponents?:object
1416
}>;
1517
}
1618

17-
const DiffRoute = (props: DiffRouteProps): unknown => (
19+
const DiffRoute = (props: DiffRouteProps): JSX.Element => (
1820

1921
<Router>
2022
<div className="navbar">

src/app/components/Dropdown.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ interface DropdownProps {
77
setSpeed: () => void;
88
}
99

10-
const Dropdown = (props: DropdownProps): unknown => {
10+
const Dropdown = (props: DropdownProps): JSX.Element => {
1111
const { speeds, setSpeed, selectedSpeed } = props;
1212
return (
1313
<Select

src/app/components/StateRoute.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import ComponentMap from './ComponentMap';
1616
import PerfView from './PerfView';
1717
import AtomsRelationship from './AtomsRelationship.jsx';
1818
import Example from './AtomsRelationship.jsx';
19-
import ParentSize from '@visx/responsive/lib/components/ParentSize';
19+
import ParentSize from '@visx/responsive';
2020

2121
const History = require('./History').default;
2222

@@ -84,8 +84,9 @@ const StateRoute = (props: StateRouteProps) => {
8484

8585
const renderAtomsRelationship = () => (
8686
<Example
87-
width={600}
88-
height={1000} />
87+
width={500}
88+
height={500} />
89+
8990
// atomsComponents={snapshot.atomsComponents}
9091
// atomSelectors={snapshot.atomSelectors}
9192
// />

src/app/containers/StateContainer.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ interface StateContainerProps {
1313
snapshot: Record<number,
1414
{ name?: string; componentData?: Record<string, unknown>;
1515
state?: Record<string, unknown>; stateSnaphot?: Record<string, unknown>; children?: unknown[];
16-
AtomsRelationship?: any[]
16+
AtomsRelationship?: any[]; atomSelectors?:object; atomsComponents?:object
1717
}
1818
> ;
1919
AtomsRelationship?: any[];
2020
hierarchy:Record<string, unknown>;
2121
snapshots:[];
2222
viewIndex:number;
23+
2324
}
2425

2526
// eslint-disable-next-line react/prop-types
26-
const StateContainer = (props:StateContainerProps): unknown => {
27+
const StateContainer = (props:StateContainerProps): JSX.Element => {
2728
const {
2829
snapshot, hierarchy, snapshots, viewIndex,
2930
} = props;

0 commit comments

Comments
 (0)