Strict types for WebGL and WebGL2
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 5/5
- 预计耗时
- 一周以上
- 新手友好度
- 25/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- typescript
- 领域
- tooling
调研方向
首先审查 TypeScript PR #21902 中提议的类型及其修改的文件,然后检查自动生成的 typings 如何导入 dom.generated.d.ts。确定 WebGL/WebGL2 声明应作为额外输入,还是应作为单独的 lib 选项,并评估 issue 中所述的 overload 和共享超类型问题。完成的标准是达成一致的集成方案,并具备适当的严格 typings。
由索引模型根据 Issue 内容生成。
描述
Opening a new issue, as requested. See also https://github.com/Microsoft/TypeScript/pull/21902.
I wrote some strict types for WebGL/WebGL2, which would fix https://github.com/Microsoft/TypeScript/issues/5855 among others. See https://github.com/Microsoft/TypeScript/pull/21902/files.
The auto-generated typings would need to be excluded. Maybe this should be added as a separate option for the lib compiler option as it's not exactly lightweight.
I might have made some of the types too strict, for example for texImage2D I added overloads which exactly match the internalFormat/format/type combinations allowed by the WebGL spec. When calling the function with immediate values, this is fine, but calling it with values in variables is going to require as any casts. (Which could be fine, as at that point you're responsible for the correct types anyway).
Also the following would fail, because TS doesn't currently generate a common supertype (?).
declare const randomParameter: GL['ACTIVE_TEXTURE'] | GL['ALIASED_LINE_WIDTH_RANGE']
const x = gl.getParameter(randomParameter)
// no matching overload, but a return type of GL.TextureUnits | Float32Array would make sense.
Is adding the .d.ts files as additional inputFiles which are concatenated to the dom.generated.d.ts (or a separate webgl lib file) an option? I added a number of subtypes which are only implicitly in the spec: all constants are typed as a generic GLenum in spec, although there are many different subgroups which I typed explicitly. It is highly unlikely that those will be added to the IDL.
- 主要语言
- TypeScript
- 星标
- 741
- 派生
- 475
- 平均合并
- 6 天 10 小时
- 30 天内合并 PR
- 6
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/TypeScript-DOM-lib-generator 的其他 Issue
-
lib.d.ts bug
难度 2/5 1-3 小时 新手友好度 62/100
microsoft/TypeScript-DOM-lib-generator#2566 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
microsoft/TypeScript-DOM-lib-generator#2554 · 6 条评论 ·
维护者通常 1 天内回复
-
lib.d.ts bug
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/TypeScript-DOM-lib-generator#2485 ·
维护者通常 1 天内回复
-
Incorrect MDN link for requestAnimationFrame in lib.dom.d.ts可能已有人在做 @Mohitlikestocode 于 254 天前认领。 未关闭lib.d.ts bug
难度 1/5 1 小时以内 新手友好度 68/100
microsoft/TypeScript-DOM-lib-generator#2154 · 1 个 reaction ·
维护者通常 1 天内回复
-
lib.d.ts bug
难度 2/5 1-3 小时 新手友好度 68/100
microsoft/TypeScript-DOM-lib-generator#2107 · 5 条评论 ·
维护者通常 1 天内回复
查看 microsoft/TypeScript-DOM-lib-generator 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
Comfy-Org/ComfyUI_frontend#20346 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
decentralized-identity/didwebvh-ts#203 ·
维护者通常 1 天内回复
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 2/5 1-3 小时 新手友好度 65/100
lingdojo/kana-dojo#31791 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
Telegram webhook: line breaks lost since switch to rich messages可能已有人在做 @Kshot3000 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
github_actions security
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 1 天内回复