Add JSX.ElementChildrenAttribute change to TypeScript 5.8 release notes
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 68/100
- Tipo de issue
- Documentación
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- typescript
- Área
- documentation
Línea de trabajo
Revisar el PR 60880 y el issue 61354 para confirmar el cambio de comportamiento de JSX.ElementChildrenAttribute y, a continuación, compararlo con las notas de la versión de TypeScript 5.8. Actualizar la página de release-notes de 5.8 para describir el cambio incompatible y su efecto en la inferencia de children, usando como contexto el ejemplo twrl reportado.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
🔎 Search Terms
tsx, jsx, children, 5.8
🕗 Version & Regression Information
- This changed between versions 5.7.3 and 5.8
- This changed in commit or PR 60880
⏯ Playground Link
No response
💻 Code
declare global {
namespace JSX {
type Element = HTMLElement; /* return type for 'jsx()' */
/* accepted element tags & attributes */
type IntrinsicElements = {
/* All HTML elements */
[Tag in keyof HTMLElementTagNameMap]: {
[T in HTMLElementStringAttributes<Tag>]?: string | Dyn<string>;
} & {
[T in HTMLElementNumberAttributes<Tag>]?: number | Dyn<number>;
} & (Tag extends keyof TwrlOverrides ? TwrlOverrides[Tag] : {}) & {
style?: string /* note: This should probably be CSSStyleDeclaration */;
// BREAKS HERE without this: children?: Children /* defines the type of children */;
};
};
}
}
🙁 Actual behavior
The breaking change is not listed in the 5.8 Release Notes
🙂 Expected behavior
The breaking change should be listed in the 5.8 Release Notes
Additional information about the issue
I ran into issues when upgrading TypeScript and narrowed it down to 5.7.3 to 5.8. The issues is that children is not inferred by default.
Luckily I came across this discussion: https://github.com/microsoft/TypeScript/issues/61354
This led me to this PR: https://github.com/microsoft/TypeScript/pull/60880
It would have been much faster if the (breaking) change had been mentioned in the 5.8 release notes. Moreover, one (apparent?) side effect of #61354 is that children does not have a default anymore (i.e. if JSX.ElementChildrenAttribute is not set, pre-5.8 children would be accepted; post-5.8 not anymore).
Here's the JSX implementation that surfaced the issue for me:
declare global {
namespace JSX {
type Element = HTMLElement; /* return type for 'jsx()' */
/* accepted element tags & attributes */
type IntrinsicElements = {
/* All HTML elements */
[Tag in keyof HTMLElementTagNameMap]: {
[T in HTMLElementStringAttributes<Tag>]?: string | Dyn<string>;
} & {
[T in HTMLElementNumberAttributes<Tag>]?: number | Dyn<number>;
} & (Tag extends keyof TwrlOverrides ? TwrlOverrides[Tag] : {}) & {
style?: string /* note: This should probably be CSSStyleDeclaration */;
children?: Children /* defines the type of children */; // <- this is now REQUIRED
};
};
}
}
- Lenguaje dominante
- Go
- Estrellas
- 111k
- Forks
- 14.4k
- Merge medio
- 2 d 3 h
- PR fusionados (30 d)
- 125
Guía de contribución
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
-
Possible Improvement
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/TypeScript#64278 · 1 comentario · 1 reacción ·
-
Docs
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
microsoft/TypeScript#64118 · 1 comentario ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
microsoft/TypeScript#64094 ·
-
Docs
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
microsoft/TypeScript#63959 · 5 comentarios ·
-
Domain: lib.d.ts Help Wanted
Dificultad 1/5 Menos de una hora Aptitud para principiantes 91/100
microsoft/TypeScript#63722 · 4 comentarios · 1 reacción ·
Todos los issues de microsoft/TypeScript
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
-
acceptance-tests phase-coding schema-coverage testing triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100