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

Make DOM types available without polluting the global scope with 790 global variables

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

未指定文件、测试或入口点。首先检查此仓库如何生成 DOM 库文件,以及 lib: ['DOM'] 选项如何公开声明;将当前生成的输出与所要求的仅类型行为进行比较。在不引入所列的不需要的全局变量的情况下提供 DOM 类型信息,即表示完成。

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

描述

Adding lib: ['DOM'] introduces 790 global variables. Many of these are deprecated and useless. Many of them have short names that can hide mistakes like a missing var or let. Some obvious offenders that absolutely result in regular bugs:

  • event
  • closed
  • parent
  • screen
  • status
  • toolbar
  • top
  • length
  • self
  • history
  • location
  • origin

For this reason I have so far refrained from using lib: ['DOM'] in my projects and prefer to access all globals via window.foo instead for clarity and safety.

However, this means that TS doesn't know about any of these types. Please can we make these types available so that we can at least access and use the type information without polluting the global scope with all these variables.

I'd be happy with one that just declares document and window globals, or a types-only version that leave all globals up to us, either way I don't mind, just anything that makes the types available without all these junk globals.

主要语言
TypeScript
星标
741
派生
475
平均合并
6 天 10 小时
30 天内合并 PR
6

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 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 摘要。