Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: storybook missing controls props #78

Closed
wants to merge 3 commits into from

Conversation

Hanna922
Copy link
Member

@Hanna922 Hanna922 commented Apr 29, 2024

1️⃣ 어떤 작업을 했나요? (Summary)

2️⃣ 알아두시면 좋아요!

image

union/ReactReactNode type으로 인식되는 부분에 있어 Storybook을 좀 뜯어봤습니다.

Storybookjs next branch에서 local storybook 실행 시

image

이렇게 뜨고 있고, Storybookjs #19580 보시면 문제점에 "We have many duplicated types in our codebase" 언급 확인하실 수 있습니다.

// code/node_modules/@storybook/csf/dist/index.d.ts
type SBScalarType = SBBaseType & {
    name: 'boolean' | 'string' | 'number' | 'function' | 'symbol';
};
type SBArrayType = SBBaseType & {
    name: 'array';
    value: SBType;
};
type SBObjectType = SBBaseType & {
    name: 'object';
    value: Record<string, SBType>;
};
type SBEnumType = SBBaseType & {
    name: 'enum';
    value: (string | number)[];
};
type SBIntersectionType = SBBaseType & {
    name: 'intersection';
    value: SBType[];
};
type SBUnionType = SBBaseType & {
    name: 'union';
    value: SBType[];
};
type SBOtherType = SBBaseType & {
    name: 'other';
    value: string;
};

결론: 수동 문서로 type을 전부 넣어줄 것 아니면 autodocs를 사용하는 이상 간결하게 타입을 표시하게 됨, 스토리북에서 취급하는 예제에서도 union 타입으로 보여줌

4️⃣ 체크리스트 (Checklist)

  • main 브랜치의 최신 코드를 pull 받았나요?

@Hanna922 Hanna922 requested a review from nijuy as a code owner April 29, 2024 13:24
@Hanna922 Hanna922 added bug Something isn't working RFC labels Apr 29, 2024
@nijuy
Copy link
Collaborator

nijuy commented Apr 29, 2024

stories.tsx 안에서 meta - ArgType으로 지정이 가능한 거 같은데 여기서도 먹힐지 좀 더 해보고 맗할게요 ㅠㅠ
(여기 관련 내용은 아닌데 omit에서 JSDoc으로 달았던 주석 누락되는 것도 이걸로 해결은 가능할 거 같아요 수작업 들어가야 하지만)

+) description 파트만 수정 가능할 거 같네요.. 타입이 union으로 뜨는 걸 이걸로 해결하진 못할 걱 ㅏㅌ같아요 아나 🤔

@Hanna922 Hanna922 changed the title fix: storybook controls props, type 인식 문제 fix: storybook missing controls props May 9, 2024
@Hanna922
Copy link
Member Author

Hanna922 commented May 9, 2024

@nijuy PR comment에 간단하게 설명 적어뒀는데 확인 부탁드려용

@Hanna922 Hanna922 closed this May 9, 2024
@Hanna922 Hanna922 deleted the fix/#77-controls-props branch May 9, 2024 09:21
@Hanna922 Hanna922 mentioned this pull request May 9, 2024
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working RFC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: Controls props 설명 사라짐
2 participants