Skip to content

Commit 29edc7c

Browse files
committed
refactor: any 타입 전체 삭제
1 parent 2f590c1 commit 29edc7c

File tree

7 files changed

+19
-26
lines changed

7 files changed

+19
-26
lines changed

src/components/Home/Home.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const Home = () => {
4646
onClick={() => {
4747
send({ type: AppBridgeMessageType.OPEN_GALLERY, payload: "" });
4848

49-
send({ type: AppBridgeMessageType.RECEIVE_SCAN_RESULT, payload: scanData });
49+
send({ type: AppBridgeMessageType.RECEIVE_SCAN_RESULT, payload: { result: "" } });
5050
}}
5151
/>
5252
<IconButton
@@ -55,7 +55,7 @@ const Home = () => {
5555
onClick={() => {
5656
send({ type: AppBridgeMessageType.OPEN_CAMERA, payload: "" });
5757

58-
send({ type: AppBridgeMessageType.RECEIVE_SCAN_RESULT, payload: scanData });
58+
send({ type: AppBridgeMessageType.RECEIVE_SCAN_RESULT, payload: { result: "" } });
5959
}}
6060
/>
6161
</div>

src/components/ReceiptEdit/ReceiptEdit.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ const ReceiptEdit = () => {
1717

1818
const { setOcrText } = useCreateReviewStore();
1919

20-
const [formData, setFormData] = useState<{ [key: string]: string }[]>([
21-
{ test: "abc" },
22-
{ test2: "aadsasf" },
23-
]);
20+
const [formData, setFormData] = useState<{ key: string; value: string }[]>([]);
2421
const [focusState, setFocusState] = useState<{ [key: string]: boolean }>({});
2522

2623
useEffect(() => {

src/components/provider/AppBridgeProvider/AppBridgeMessage.types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ export interface CopyMessage {
5050

5151
export interface ReceiveScanResultMessage {
5252
type: AppBridgeMessageType.RECEIVE_SCAN_RESULT;
53-
// payload: Array<{ [key: string]: string }>;
54-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
55-
payload: any;
53+
payload: {
54+
result: string;
55+
};
5656
}
5757

5858
export interface ReceiveGeneratedReviewMessage {

src/components/provider/AppBridgeProvider/AppBridgeProvider.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ export function AppBridgeProvider({ children }: AppBridgeProviderProps) {
4141
useEffect(() => {
4242
if (typeof window !== "undefined") {
4343
window.response = {
44-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
45-
receiveScanResult: (jsonData: any) => {
44+
receiveScanResult: (jsonData: string) => {
4645
try {
47-
// alert("Scan Result: " + jsonData);
4846
setScanData(JSON.parse(jsonData));
4947
} catch (error) {
5048
console.error("Invalid JSON data for scan result:", error);

src/components/provider/AppBridgeProvider/convertToNativeMessage.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ const iosHandlers = {
1313
}) => window.webkit?.messageHandlers.createReview.postMessage(message.payload),
1414
[AppBridgeMessageType.COPY]: (message: { payload: { review: string } }) =>
1515
window.webkit?.messageHandlers.copy.postMessage(message.payload),
16-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
17-
[AppBridgeMessageType.RECEIVE_SCAN_RESULT]: (message: { payload: { result: any } }) =>
16+
[AppBridgeMessageType.RECEIVE_SCAN_RESULT]: (message: { payload: { result: string } }) =>
1817
window.response?.receiveScanResult(message.payload.result),
1918
[AppBridgeMessageType.RECEIVE_GENERATED_REVIEW]: (message: { payload: { result: string } }) =>
2019
window.response?.receiveGeneratedReview(message.payload.result),
@@ -29,8 +28,7 @@ const androidHandlers = {
2928
}) => window.AndroidBridge?.createReview(JSON.stringify(message.payload)),
3029
[AppBridgeMessageType.COPY]: (message: { payload: { review: string } }) =>
3130
window.AndroidBridge?.copy(JSON.stringify(message.payload)),
32-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
33-
[AppBridgeMessageType.RECEIVE_SCAN_RESULT]: (message: { payload: { result: any } }) =>
31+
[AppBridgeMessageType.RECEIVE_SCAN_RESULT]: (message: { payload: { result: string } }) =>
3432
window.response?.receiveScanResult(message.payload.result),
3533
[AppBridgeMessageType.RECEIVE_GENERATED_REVIEW]: (message: { payload: { result: string } }) =>
3634
window.response?.receiveGeneratedReview(message.payload.result),

src/store/useScanDataStore.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import { create } from "zustand";
22

33
interface ScanDataStoreProps {
4-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5-
scanData: any;
6-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
7-
setScanData: (scanData: any[]) => void;
4+
scanData: ScanResultPayload;
5+
setScanData: (scanData: ScanResultPayload) => void;
86
resetScanData: () => void;
97
}
108

119
export const useScanDataStore = create<ScanDataStoreProps>((set) => ({
12-
scanData: [],
13-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
14-
setScanData: (scanData: any[]) => set({ scanData }),
15-
resetScanData: () => set({ scanData: [] }),
10+
scanData: { parsed: [] },
11+
setScanData: (scanData: ScanResultPayload) => set({ scanData }),
12+
resetScanData: () => set({ scanData: { parsed: [] } }),
1613
}));

src/types/global.d.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ declare global {
1919
interface CopyMessagePayload {
2020
review: string;
2121
}
22+
23+
interface ScanResultPayload {
24+
parsed: Array<{ key: string; value: string }>;
25+
}
2226
interface Window {
2327
response?: {
24-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
25-
receiveScanResult: (jsonData: any) => void;
28+
receiveScanResult: (jsonData: string) => void;
2629
receiveGeneratedReview: (jsonData: string) => void;
2730
};
2831
webkit?: {

0 commit comments

Comments
 (0)