Skip to content

Commit 9c8375f

Browse files
committed
Extract a function to construct a Position
1 parent 472cf4f commit 9c8375f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

ui/frontend/actions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
PrimaryActionAuto,
2828
PrimaryActionCore,
2929
ProcessAssembly,
30+
makePosition,
3031
} from './types';
3132

3233
const routes = {
@@ -430,7 +431,7 @@ export const enableFeatureGate = (featureGate: string) =>
430431
createAction(ActionType.EnableFeatureGate, { featureGate });
431432

432433
export const gotoPosition = (line: string | number, column: string | number) =>
433-
createAction(ActionType.GotoPosition, { line: +line, column: +column });
434+
createAction(ActionType.GotoPosition, makePosition(line, column));
434435

435436
const requestFormat = () =>
436437
createAction(ActionType.RequestFormat);

ui/frontend/types.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ export interface Position {
55
column: number;
66
}
77

8+
export const makePosition = (line: string | number, column: string | number): Position =>
9+
({ line: +line, column: +column });
10+
811
export interface Crate {
912
id: string;
1013
name: string;

0 commit comments

Comments
 (0)