Skip to content

Commit c27a537

Browse files
refactor: fix variable typo
1 parent 0905db8 commit c27a537

File tree

2 files changed

+24
-30
lines changed

2 files changed

+24
-30
lines changed

src/store/reducers/preview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import '../../services/api';
22

3-
import type {ErrorRepsonse, ExecuteActions} from '../../types/api/query';
3+
import type {ErrorResponse, ExecuteActions} from '../../types/api/query';
44
import type {IQueryResult} from '../../types/store/query';
55
import {parseQueryAPIExecuteResponse} from '../../utils/query';
66

@@ -16,7 +16,7 @@ const initialState = {
1616

1717
const preview = (
1818
state = initialState,
19-
action: ApiRequestAction<typeof SEND_QUERY, IQueryResult, ErrorRepsonse> | ReturnType<typeof setQueryOptions>,
19+
action: ApiRequestAction<typeof SEND_QUERY, IQueryResult, ErrorResponse> | ReturnType<typeof setQueryOptions>,
2020
) => {
2121
switch (action.type) {
2222
case SEND_QUERY.REQUEST: {

src/types/api/query.ts

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ export interface CommonFields {
88
ast?: AST;
99
plan?: Plan;
1010
stats?: Stats;
11-
};
11+
}
1212

1313
interface DeprecatedCommonFields {
1414
stats?: Stats;
1515
}
1616

17-
export interface ErrorRepsonse {
17+
export interface ErrorResponse {
1818
error?: any;
1919
issues?: any;
20-
};
20+
}
2121

2222
export type ExecuteActions = 'execute-script' | 'execute' | 'execute-scan' | undefined;
2323
export type ExplainActions = 'explain' | 'explain-ast';
@@ -34,7 +34,7 @@ type CellValue = string | number | null | undefined;
3434

3535
export type KeyValueRow<T = CellValue> = {
3636
[key: string]: T;
37-
}
37+
};
3838

3939
export type ArrayRow<T = CellValue> = Array<T>;
4040

@@ -63,17 +63,15 @@ export type ExecuteYdbResponse = {
6363
result: KeyValueRow[];
6464
} & CommonFields;
6565

66-
type ExecuteResponse<Schema extends Schemas> =
66+
type ExecuteResponse<Schema extends Schemas> =
6767
| CommonFields // result can be undefined for queries like `insert into`
68-
| (
69-
Schema extends 'modern'
70-
? ExecuteModernResponse
71-
: Schema extends 'ydb'
72-
? ExecuteYdbResponse
73-
: Schema extends 'classic' | undefined
74-
? ExecuteClassicResponse
75-
: unknown
76-
);
68+
| (Schema extends 'modern'
69+
? ExecuteModernResponse
70+
: Schema extends 'ydb'
71+
? ExecuteYdbResponse
72+
: Schema extends 'classic' | undefined
73+
? ExecuteClassicResponse
74+
: unknown);
7775

7876
// deprecated response from older versions, backward compatibility
7977

@@ -92,8 +90,9 @@ export type DeprecatedExecuteResponseDeep = {
9290
// can be undefined for queries like `insert into`
9391
export type DeprecatedExecuteResponsePlain = DeprecatedExecuteResponseValue | undefined;
9492

95-
export type DeprecatedExecuteResponse = DeprecatedExecuteResponseDeep | DeprecatedExecuteResponsePlain;
96-
93+
export type DeprecatedExecuteResponse =
94+
| DeprecatedExecuteResponseDeep
95+
| DeprecatedExecuteResponsePlain;
9796

9897
// ==== EXPLAIN ====
9998

@@ -103,14 +102,12 @@ type ExplainResponse = CommonFields;
103102

104103
// deprecated response from older versions, backward compatibility
105104

106-
type DeprecatedExplainResponse<Action extends ExplainActions> = (
105+
type DeprecatedExplainResponse<Action extends ExplainActions> =
107106
Action extends 'explain-ast'
108107
? ({result: {ast: AST}} & Required<DeprecatedCommonFields>) | {ast: AST}
109108
: Action extends 'explain'
110109
? ({result: Plan} & Required<DeprecatedCommonFields>) | Plan
111-
: unknown
112-
);
113-
110+
: unknown;
114111

115112
// ==== COMBINED API RESPONSE ====
116113

@@ -124,15 +121,14 @@ export type QueryAPIExplainResponse<Action extends ExplainActions> =
124121
| DeprecatedExplainResponse<Action>
125122
| null;
126123

127-
export type QueryAPIResponse<Action extends Actions, Schema extends Schemas = undefined> = (
124+
export type QueryAPIResponse<Action extends Actions, Schema extends Schemas = undefined> =
128125
Action extends ExecuteActions
129126
? QueryAPIExecuteResponse<Schema>
130127
: Action extends ExplainActions
131128
? QueryAPIExplainResponse<Action>
132-
: unknown
133-
);
129+
: unknown;
134130

135-
export type AnyExecuteResponse =
131+
export type AnyExecuteResponse =
136132
| ExecuteModernResponse
137133
| ExecuteClassicResponse
138134
| ExecuteYdbResponse
@@ -146,13 +142,11 @@ export type DeepExecuteResponse =
146142
| ExecuteYdbResponse
147143
| DeprecatedExecuteResponseDeep;
148144

149-
export type AnyExplainResponse =
145+
export type AnyExplainResponse =
150146
| ExplainResponse
151147
| CommonFields
152148
| DeprecatedExplainResponse<'explain'>
153149
| DeprecatedExplainResponse<'explain-ast'>
154150
| null;
155151

156-
export type AnyResponse =
157-
| AnyExecuteResponse
158-
| AnyExplainResponse;
152+
export type AnyResponse = AnyExecuteResponse | AnyExplainResponse;

0 commit comments

Comments
 (0)