How to generate correct prop types when the prop-types package is not explicitly imported?
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- react, webpack
- 领域
- documentation, tooling
调研方向
首先阅读 resolveToModule util 和现有的 prop-types handler。重现 webpack ProvidePlugin 在没有显式 prop-types import 的情况下提供 PropTypes 的情形,然后确定现有 handler 是否支持这种情况;当生成的输出报告 string 或 bool 等具体类型而不是 custom 时即完成。
由索引模型根据 Issue 内容生成。
描述
Is there a recommended way to generate prop types when the prop-types package is not explicitly imported into each component? For example, in my project, PropTypes is provided as a global through webpack's providePlugin:
config: {
plugins: [
new ProvidePlugin({
PropTypes: 'prop-types',
}),
]
};
So PropTypes is available to any react component—even when it is not imported.
I see the resolveToModule util looks for the prop-types import, and if it is not found, we end up with custom prop types rather than their actual type, like string or bool. It seems I can create a handler to generate prop types even when the prop-types package is not explicitly imported, but is there an already existing handler or other way to do this that addresses this case?
- 主要语言
- TypeScript
- 星标
- 3.8k
- 派生
- 316
- 平均合并
- 3 小时 28 分钟
- 30 天内合并 PR
- 6
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
reactjs/react-docgen 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
reactjs/react-docgen#1102 ·
-
难度 5/5 一周以上 新手友好度 20/100
reactjs/react-docgen#1005 · 4 个 reaction ·
-
难度 3/5 1-2 天 新手友好度 48/100
reactjs/react-docgen#997 ·
-
难度 3/5 1-2 天 新手友好度 42/100
reactjs/react-docgen#994 · 1 条评论 ·
-
难度 4/5 3-5 天 新手友好度 25/100
reactjs/react-docgen#982 · 2 条评论 ·
查看 reactjs/react-docgen 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
copse-dev/agent-pane#2953 ·
-
难度 2/5 1-3 小时 新手友好度 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
难度 2/5 1-3 小时 新手友好度 78/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
-
calcite-components needs triage refactor
难度 2/5 1-3 小时 新手友好度 75/100
Esri/calcite-design-system#15203 ·