Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Cannot parse Flow $Shape

Đang mở
#306 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
javascript
Lĩnh vực
documentation, tooling

Hướng nghiên cứu

Tái hiện lỗi bằng ví dụ components/Label.js được cung cấp và kiểm tra các điểm đầu vào phân tích Flow của react-docgen; issue không nêu tệp nguồn hoặc bài kiểm thử nào. Hoàn thành khi các props được bọc trong $Shape được phân tích và trả về siêu dữ liệu props được hiển thị cho kiểu không được bọc, kèm coverage cho ví dụ này.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

flow help wanted improvement

I don't know whether this applies to all Flow utility types in general, but React makes extensive use of $Shape (and so do we!) - react-docgen (3.0.0-rc.1) seems to fail at parsing this.

Example component props:

// components/Label.js
type Props = $Shape<{
	/** Content to place inside .ui.label element */
	children?: React.Node,
	/** Classes for .ui.label element */
	classes?: string,
	/** Type of the label (icon, favicon, image, notification, state) */
	type?: 'icon' | 'favicon' | 'image' | 'notification' | 'state',
	/** Tooltip (data-content, data-position, data-delay) */
	tooltip?: Tooltip
}>;

With $Shape:

{
    "displayName": "Label",
    "methods": []
}

Without $Shape:

{
	"displayName": "Label",
	"methods": [],
	"props": {
		"children": {
			"required": false,
			"flowType": {
				"name": "ReactNode",
				"raw": "React.Node"
			},
			"description": "Content to place inside .ui.label element"
		},
		"classes": {
			"required": false,
			"flowType": {
				"name": "string"
			},
			"description": "Classes for .ui.label element"
		},
		"type": {
			"required": false,
			"flowType": {
				"name": "union",
				"raw": "'icon' | 'favicon' | 'image' | 'notification' | 'state'",
				"elements": [
					{
						"name": "literal",
						"value": "'icon'"
					},
					{
						"name": "literal",
						"value": "'favicon'"
					},
					{
						"name": "literal",
						"value": "'image'"
					},
					{
						"name": "literal",
						"value": "'notification'"
					},
					{
						"name": "literal",
						"value": "'state'"
					}
				]
			},
			"description": "Type of the label (icon, favicon, image, notification, state)"
		},
		"tooltip": {
			"required": false,
			"flowType": {
				"name": "Tooltip"
			},
			"description": "Tooltip (data-content, data-position, data-delay)"
		}
	}
}
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

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của reactjs/react-docgen

Tất cả issue của reactjs/react-docgen

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.