
export type tapType = 'waiting' |'expected' |'done';
여기에서 wating이라는 string을 숨기고자 상수화를 시켜서 ctap 이라는 파일을 만들었다
ctap 파일은
export const TAB = {
waiting: 'WAITING',
expected: 'EXPECTED',
done: 'DONE',
};
이런식으로 되어있다.
이렇게 선언을 해 주었으니 맨 위 type을 상수 선언한 것으로 통일되게 바꿔주어야해서
import { TAB } from "@/constant/tab/ctap";
export type tapType = TAB.waiting |TAB.expected |TAB.done;
이런식으로 import 해 와서 선언을 해 주었더니
Cannot find namespace 'TAB'
라고 경고가 뜨게 되었다... ;;
export type tapType = typeof TAB.waiting |typeof TAB.expected |typeof TAB.done;
이런식으로 선언하는 타입 앞에 typeof 를 붙여주면 된다