Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Add types for `require.context`

未关闭
#1,232 1 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
48/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞

调研方向

首先阅读链接的 Metro-Context-Modules-Demo 仓库中 types/metroRequire.d.ts 的类型声明,然后找到 Metro 现有的内置类型定义。添加 require.context 定义,使其参数获得补全、错误检查和重构支持。当 Metro 用户报告的 NodeRequire 错误得到解决时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Do you want to request a feature or report a bug?

Feature request

Currently, Metro supports require.context, added in this PR, but it lacks built-in type definitions. This makes it more challenging to use require.context effectively as there's no code completion, error checking, or refactoring support for its arguments.

Property 'context' does not exist on type 'NodeRequire'.
Screenshot 2024-03-08 at 15 17 28

Right now, I have to create a types file and add the following content from @EvanBacon's Metro-Context-Modules-Demo repo, having them included by default in Metro would be a great improvement.

Including type definitions for require.context would significantly improve the developer experience by enabling these features and making code using require.context more robust and maintainable.

主要语言
JavaScript
星标
5.7k
派生
706
平均合并
2 天 4 小时
30 天内合并 PR
65

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

react/metro 的其他 Issue

查看 react/metro 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。