SAP / ui5-typescript

Tooling to enable TypeScript support in SAPUI5/OpenUI5 projects
https://sap.github.io/ui5-typescript
Apache License 2.0
201 stars 28 forks source link

`sap.ui.Device.system` is undeclared #362

Closed sap-sebelao closed 1 year ago

sap-sebelao commented 2 years ago

Example:

import Device from "sap/ui/Device"

if(Device.system.tablet) { // TS: Property "system" does not exist on type "Device"
     ...
}

TS does not recognize the property system.

It is part of the public API https://sapui5.hana.ondemand.com/#/api/sap.ui.Device.system So I see no reason why it should not be supported.

akudev commented 2 years ago

Hi @sap-sebelao , yes this is a current glitch. Right now you can access Device.system by directly importing it as named export from the "Device" module:

import { system } from "sap/ui/Device";

if (system.tablet) {...
petermuessig commented 1 year ago

Fixed with UI5 types 1.115.0, see #311

Closing the issue.