Type 'import("sap/ui/core/Popup").Dock' is not assignable to type 'typeof Dock' (since UI5 1.115.0)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 42/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- typescript
- Área
- tooling
Línea de trabajo
Start with the TypeScript declarations for sap/ui/core/Popup and MessageToast, focusing on how Popup.Dock is referenced in MessageToast.show. Verify the completed change by checking that Dock is accepted there without the typeof mismatch and that the documented example type-checks.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
Since UI5 1.115.0, the TS types use a different strategy for enums attached to another API. They are no longer named exports, but attached as static properties.
When such an enum (e.g. Dock), exported as static property of a class (e.g. Popup.Dock), is used in the signature of yet another class (e.g. MessageToast), then the signature of that other class is broken. For a detailed example see https://github.com/SAP/openui5/issues/4091.
Expected behavior
Any usage of such an enum in another API should work seamlessly.
Additional context
The problem is that the "usage in yet another class" currently uses the static property to refer to the type:
import Popup from "sap/ui/core/Popup";
interface MessageToast {
show(
msg: string,
at: typeof Popup.Dock // <-- problem
)
...
Unfortunately, this is not the same as the original enum. According to my experiments, it would be better to
import type {Dock} from "sap/ui/core/Popup"; // ideally, import as type
interface MessageToast {
show(
msg: string,
at: Dock // <-- better declaration of type
)
...
Interestingly, this works already today as the enum Dock is exported from Popup (any declaration in an ambient module declaration is implicitly an export, even without the keyword export).
- Lenguaje dominante
- TypeScript
- Estrellas
- 213
- Forks
- 35
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la 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 UI5/typescript
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
UI5/typescript#625 · 4 comentarios ·
-
dts-generator
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
UI5/typescript#529 · 3 comentarios ·
-
Dependency DashboardAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
UI5/typescript#587 ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
UI5/typescript#532 ·
-
enhancement ts-interface-generator
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
UI5/typescript#524 ·
Todos los issues de UI5/typescript
Issues similares
-
combobox: highlighted item never scrolls into view when there's no content part (Ark Command)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
bug P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 1 día
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día