Skip to content

Commit 7a41257

Browse files
committed
feat: storage 메서드 타입 추가
1 parent d7ad87b commit 7a41257

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/utils/storage.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
const storage = window.localStorage;
22

3-
export const setItem = (key, value) => {
3+
export const setItem = (key: string, value: string) => {
44
try {
55
storage.setItem(key, value);
66
} catch (error) {
77
console.log(error);
88
}
99
};
1010

11-
export const getItem = (key, defaultValue) => {
11+
export const getItem = <T>(key: string, defaultValue: T): T => {
1212
try {
1313
const data = storage.getItem(key);
1414
if (data) return JSON.parse(data);

0 commit comments

Comments
 (0)