Skip to content

Commit ff5cea3

Browse files
committed
Change type names
1 parent 0642574 commit ff5cea3

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

src/parse.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const DEFAULT_FILTER = '';
4040
const DEFAULT_IMAGE = '';
4141
const VALID_BRACKET_KEYS = ['bg', 'music', 'sound', 'image', 'filter'];
4242

43-
const errorAction: StateAction = ({ i, breakCount, text }: ActionInput) => {
43+
const errorAction: Action = ({ i, breakCount, text }: ActionInput) => {
4444
const spaces: string[] = [];
4545
for (let index = 0; index < i; index++) {
4646
spaces.push(' ');
@@ -51,21 +51,21 @@ const errorAction: StateAction = ({ i, breakCount, text }: ActionInput) => {
5151

5252
const DUMMY_STATE = 'DUMMY_STATE';
5353

54-
interface ActionNextState {
55-
action: StateAction;
56-
nextState: State | 'DUMMY_STATE';
54+
interface Event {
55+
action: Action;
56+
nextState: State | typeof DUMMY_STATE;
5757
}
5858

5959
const STATE_KEYS = ['[', ']', ' ', '\n', 'END', 'OTHERS'] as const;
6060
type StateKey = typeof STATE_KEYS[number];
6161

6262
interface State {
63-
'[': ActionNextState;
64-
']': ActionNextState;
65-
' ': ActionNextState;
66-
'\n': ActionNextState;
67-
END: ActionNextState;
68-
OTHERS: ActionNextState;
63+
'[': Event;
64+
']': Event;
65+
' ': Event;
66+
'\n': Event;
67+
END: Event;
68+
OTHERS: Event;
6969
}
7070

7171
interface ActionInput {
@@ -76,9 +76,9 @@ interface ActionInput {
7676
text: string;
7777
}
7878

79-
type StateAction = (actionInput: ActionInput) => CurrentProps;
79+
type Action = (actionInput: ActionInput) => CurrentProps;
8080

81-
const ERROR_ACTION_STATE: ActionNextState = {
81+
const ERROR_ACTION_STATE: Event = {
8282
action: errorAction,
8383
nextState: DUMMY_STATE,
8484
};
@@ -98,7 +98,7 @@ const createInitProps = (): CurrentProps => ({
9898
bracketKey: '',
9999
});
100100

101-
const noOpAction: StateAction = ({ cur }: ActionInput) => {
101+
const noOpAction: Action = ({ cur }: ActionInput) => {
102102
return cur;
103103
};
104104

@@ -111,7 +111,7 @@ const initState: State = {
111111
OTHERS: { action: noOpAction, nextState: DUMMY_STATE }, // To be replaced
112112
};
113113

114-
const pushCharAction: StateAction = ({ cur, char }: ActionInput) => {
114+
const pushCharAction: Action = ({ cur, char }: ActionInput) => {
115115
cur.chars.push(char);
116116
return cur;
117117
};
@@ -130,7 +130,7 @@ initState['\n'].action = ({ cur }: ActionInput) => {
130130
};
131131
initState['\n'].nextState = initState;
132132

133-
const endShotAction: StateAction = ({ cur }: ActionInput) => {
133+
const endShotAction: Action = ({ cur }: ActionInput) => {
134134
const paragraph = cur.chars.join('');
135135
cur.chars = [];
136136
if (paragraph !== '') {
@@ -168,7 +168,7 @@ const afterEndBracketState: State = {
168168

169169
//------------------------------------------
170170

171-
const endBracketAction: StateAction = ({ char, cur, i, breakCount, text }: ActionInput) => {
171+
const endBracketAction: Action = ({ char, cur, i, breakCount, text }: ActionInput) => {
172172
const value = cur.chars.join('');
173173
cur.chars = [];
174174
const key = cur.bracketKey;
@@ -245,7 +245,7 @@ const keyDetermineAction = ({ cur, char, i, breakCount, text }: ActionInput) =>
245245
return cur;
246246
};
247247

248-
const singleKeywordTagEndAction: StateAction = ({ char, cur, i, breakCount, text }: ActionInput) => {
248+
const singleKeywordTagEndAction: Action = ({ char, cur, i, breakCount, text }: ActionInput) => {
249249
if (cur.chars.join('') === PAGE) {
250250
cur.chars = [];
251251
cur.pages.push({ shots: cur.shots, id: cur.pageId });

0 commit comments

Comments
 (0)