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

Feature request: split whatwg definitions in separate files

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
typescript
领域
tooling

调研方向

该 issue 未指出任何文件、测试或入口点。首先阅读相关 issue 41727 和 31535,然后检查此生成器如何组织 DOM 库定义。当用户可以选择单独的 whatwg URL,并在不依赖更广泛的 DOM lib 的情况下获取与 ECMAScript lib 一起使用的定义时,即表示完成。

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

描述

Use case

I want to write an isomorphic library that runs in the browser and nodejs. I want to make sure that I only rely on globals that are available in both environments. Currently, to do this, I must use lib: ["dom"] and types: ["node"], which results in defined globals that are not actually available in both runtime envs, leading to a fake sense of type safety when writing code.

Suggested solution

As a user of typescript, I would like to be able to pick more precisely the libs I depend on. For example: lib: ["es2022", "whatwg.url", "whatwg.fetch"]

There would be a lot of benefit to doing this:

  • @types/node would not have to re-define definitions already provided by typescript (new URL(u as URL) incorrectly yields an error when using types: ["node"])
  • All libraries targeting both dom & scripthost envs would benefit from improved type safety
Related issues
主要语言
TypeScript
星标
740
派生
474
平均合并
3 天 7 小时
30 天内合并 PR
14

环境准备

我们还没有检查这个项目的环境配置文件。先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

microsoft/TypeScript-DOM-lib-generator 的其他 Issue

查看 microsoft/TypeScript-DOM-lib-generator 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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