Type 'import("sap/ui/core/Popup").Dock' is not assignable to type 'typeof Dock' (since UI5 1.115.0)
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 42/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- typescript
- Domaine
- tooling
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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).
- Langage dominant
- TypeScript
- Étoiles
- 213
- Forks
- 35
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de UI5/typescript
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
UI5/typescript#625 · 4 commentaires ·
-
dts-generator
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
UI5/typescript#529 · 3 commentaires ·
-
Dependency DashboardOuverte
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 15/100
UI5/typescript#587 ·
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
UI5/typescript#532 ·
-
enhancement ts-interface-generator
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
UI5/typescript#524 ·
Toutes les issues de UI5/typescript
Issues similaires
-
combobox: highlighted item never scrolls into view when there's no content part (Ark Command)Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 83/100
Les mainteneurs répondent en général sous 1 jour
-
Bug
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
-
bug P3
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 64/100
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
Les mainteneurs répondent en général sous 1 jour