Allow flow inference of cast variable definitions.
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, react, typescript
- Lĩnh vực
- documentation, frontend
Hướng nghiên cứu
Issue không cung cấp tệp repository, test hoặc entry point nào. Hãy bắt đầu bằng cách lần theo cách react-docgen phát hiện các định nghĩa component và chú thích kiểu Flow, sử dụng hai ví dụ Elevation làm đầu vào; hoàn thành có nghĩa là phép gán cast được phát hiện là một component và kiểu props của nó được trích xuất mà không có wrapper.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I love this library, I use it to generate the documentation for https://jamesmfriedman.github.io/rmwc/.
If this library could detect cast expressions from Flow, it seemingly would fix any sort of style related issue for how people wanted to write their components.
I tried implementing this myself, but I just don't know enough about the codebase to make it happen.
For reference, this is what I'm currently doing to hack around this. I have a factory function that can't be detected, so I have to have a separate component that wraps it just to capture the flowtype definition. I get a lot of utility out of this library, but this is something I really wish I could fix.
BAD EXAMPLE
// @flow
// eslint-disable-next-line no-unused-vars
import * as React from 'react';
import { simpleTag } from '@rmwc/base';
import type { SimpleTagPropsT } from '@rmwc/base/simpleTag';
export type ElevationPropsT = {
/** A number from 0 - 24 for different levels of elevation */
z: number | string,
/** Allows for smooth transitions between elevations when the z value changes. */
transition?: boolean
} & SimpleTagPropsT;
const ElevationRoot = simpleTag({
displayName: 'ElevationRoot',
defaultProps: {
z: 0,
transition: false
},
tag: 'div',
classNames: (props: ElevationPropsT) => [
`mdc-elevation--z${props.z}`,
{ 'mdc-elevation-transition': props.transition }
],
consumeProps: ['z', 'transition']
});
// I HAVE TO RE-WRAP THIS JUST TO MAKE IT WORK
/**
* The Elevation Component
*/
export const Elevation: React.ComponentType<ElevationPropsT> = (
props: ElevationPropsT
) => <ElevationRoot {...props} />;
Elevation.displayName = 'Elevation';
export default Elevation;
WHAT WOULD BE AMAZING
// @flow
// eslint-disable-next-line no-unused-vars
import * as React from 'react';
import { simpleTag } from '@rmwc/base';
import type { SimpleTagPropsT } from '@rmwc/base/simpleTag';
export type ElevationPropsT = {
/** A number from 0 - 24 for different levels of elevation */
z: number | string,
/** Allows for smooth transitions between elevations when the z value changes. */
transition?: boolean
} & SimpleTagPropsT;
// MAKE THIS WORK BECAUSE IT IS CASTING TO React.ComponentType<ElevationPropsT>
/**
* The Elevation Component
*/
const Elevation: React.ComponentType<ElevationPropsT> = simpleTag({
displayName: 'Elevation',
defaultProps: {
z: 0,
transition: false
},
tag: 'div',
classNames: (props: ElevationPropsT) => [
`mdc-elevation--z${props.z}`,
{ 'mdc-elevation-transition': props.transition }
],
consumeProps: ['z', 'transition']
});
export default Elevation;
- Ngôn ngữ chính
- TypeScript
- Star
- 3.8k
- Fork
- 316
- Merge trung bình
- 3 giờ 28 phút
- Pull request đã merge (30 ngày)
- 6
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của reactjs/react-docgen
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
reactjs/react-docgen#1102 ·
-
Typescript Status Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
reactjs/react-docgen#1005 · 4 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
reactjs/react-docgen#997 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 42/100
reactjs/react-docgen#994 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
reactjs/react-docgen#982 · 2 bình luận ·
Tất cả issue của reactjs/react-docgen
Issue tương tự
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
Mend: dependency security vulnerability untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100