Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type 'import("sap/ui/core/Popup").Dock' is not assignable to type 'typeof Dock' using @sapui5/types: "1.126.0" #4091

Closed
JuanjoPP opened this issue Jul 17, 2024 · 3 comments
Labels

Comments

@JuanjoPP
Copy link

OpenUI5 version: 1.126.0

Browser/version (+device/version): not applicable

Steps to reproduce the problem:

  1. Create a sap.m.MessageToast with the "at" property populated
  2. Fill the "at" property with a sap.ui.core.Popup.Dock type variable

What is the expected result? The TypeScript checker does not throw an error

What happens instead? It throws an error

Any other information?
image
image
image

@codeworrior
Copy link
Member

codeworrior commented Jul 17, 2024

This is an incompatible change of the TypeScript definitions and was introduced in 1.115.0.
The change and how to deal with it, is explained in more detail in the UI5 TypeScript release notes for 1.115.

Basically, enums attached to other control or utility APIs are no longer named exports (Dock) but static properties of the default export of the bearing API (Popup.Dock).

The change was done to make static and dynamic imports consistent.

@JuanjoPP
Copy link
Author

JuanjoPP commented Jul 17, 2024

Hi,

I tried the change proposed and changed the import:

image image image

Unfortunately the error still appears.

@codeworrior
Copy link
Member

You're right, the generation of the MessageToast.show API is broken. I've created SAP/ui5-typescript#466 as this needs to be fixed in the dts-generator.

The only workaround for now is a type cast (which unfortunately needs to be removed once the issue has been fixed):

  at: Popup.Dock.BeginBottom as unknown as typeof Popup.Dock

As this is not an issue in the OpenUI5 code base, I'm closing this issue here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants