Strict types for WebGL and WebGL2
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- typescript
- Área
- tooling
Línea de trabajo
Comienza revisando los tipos propuestos en TypeScript PR #21902 y sus archivos modificados; después, inspecciona cómo los typings generados automáticamente se incorporan a dom.generated.d.ts. Determina si las declaraciones de WebGL/WebGL2 deberían ser entradas adicionales o una opción de lib independiente, y evalúa las cuestiones relacionadas con los overloads y el supertipo compartido descritas en el issue. Se considera terminado cuando exista un enfoque de integración acordado y unos typings estrictos adecuados.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 740
- Forks
- 474
- Merge medio
- 2 d 8 h
- PR fusionados (30 d)
- 15
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/TypeScript-DOM-lib-generator
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
microsoft/TypeScript-DOM-lib-generator#2554 · 6 comentarios ·
-
lib.d.ts bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
lib.d.ts bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
microsoft/TypeScript-DOM-lib-generator#2154 · 1 reacción ·
-
lib.d.ts bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/TypeScript-DOM-lib-generator#2107 · 5 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
microsoft/TypeScript-DOM-lib-generator#1675 · 2 comentarios · 1 reacción ·
Todos los issues de microsoft/TypeScript-DOM-lib-generator
Issues similares
-
blocklist removal
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
pastelsky/bundlephobia#1122 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100