Bleeding edge

2022/12/16 - TIL 본문

ConnecTo

2022/12/16 - TIL

codevil 2022. 12. 19. 13:40

1. 문제 : Title type

Title component의 type 에 문제가 있다.

export interface ITitleProps {
    lv: 1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6';
    hidden?: boolean;
    focusable?: boolean;
    children?: string;
    restProps?: unknown[];
    forwardedAs?: string | React.ComponentType<any>;
}

문제는 restProps?: unknowon[]에 문제가 있다. 지금 Title의 구조를 보면 heading tag가 바깥을 감싸고 있는 구조이기 때문에 heading에서 받을 수 있는 모든 attributes를 사용할 수 있어야한다.

export interface ITitleProps extends React.DetailedHTMLProps<React.HTMLAttributes, HTMLHeadingElement>{
    lv?: 1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6';
    hidden?: boolean;
    focusable?: boolean;
    children?: string;
    forwardedAs?: string | React.ComponentType<any>;
}

extends를 이용하여 HTML Attributes를 확장하였다.

2. 새로운 문제

이를 수정하였지만

같은 에러가 work flow에서 발생하였다. 고민을 해본 결과 내가 라이브러리를 다시 npm publish 안하고 수정하여서 이렇게 에러가 발생했다. 이유는 github 자체에는 library가 안올라가고, work flow에서 npm install을 하여 라이브러리를 새로 설치하기 때문이다.

 

'ConnecTo' 카테고리의 다른 글

2022/12/21 - JSON-LD  (0) 2022.12.22
2022/12/19 - Styled Components vs Emotion  (0) 2022.12.20
2022/12/15 - History in React  (0) 2022.12.15
2022/12/14 - Gitpage env  (0) 2022.12.14
2022/12/13 - Github API  (0) 2022.12.14