HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🧚
[1기]최종 프로젝트 데브코스
/
[팀7] 뿡치와 삼촌들 - Devnity
[팀7] 뿡치와 삼촌들 - Devnity
/
📘
프론트엔드 공간
/
🧑‍🎓
Today We Learned
/
emotion 테마 객체 자동완성 되도록 만들기
emotion 테마 객체 자동완성 되도록 만들기
emotion 테마 객체 자동완성 되도록 만들기

emotion 테마 객체 자동완성 되도록 만들기

생성일
Dec 4, 2021 06:53 AM
기록자
Jay Mincheol Cho
해결 여부
해결 여부
속성
카테고리

블로그

https://datalater.github.io/posts/emotion-theme-type/

메모

const theme = { colors: { primary: "#ffb266", fontColor: "#4d5256", disabled: "#c0c0c0", black: "#000", white: "#fff", }, } as const; export default theme; // type Keys = keyof typeof theme.colors; // "primary" | "fontColor" | "disabled" | "black" | "white" // theme[keyof typeof theme]; // ffb266 | 4d5256 | ... export type ITheme = typeof theme; // // 1번 가능하고 // type ThemeInterface = typeof theme[keyof typeof theme]; // // 2번 가능하고 // type ThemeInterface = typeof theme // // 3번 가능하고 // type ThemeInterface = Theme[keyof Theme];
type ValueOf<T> = T[keyof T]; export type TagMapValueType = ValueOf<typeof TagMap>; export type TagMapValueType2 = typeof TagMap[keyof typeof TagMap]; // https://stackoverflow.com/questions/49285864/is-there-a-valueof-similar-to-keyof-in-typescript