ui5-typescript icon indicating copy to clipboard operation
ui5-typescript copied to clipboard

`sap.ui.Device.system` is undeclared

Open sap-sebelao opened this issue 2 years ago • 1 comments

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.

sap-sebelao avatar Jun 28 '22 12:06 sap-sebelao

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) {...

akudev avatar Jun 29 '22 15:06 akudev

Fixed with UI5 types 1.115.0, see #311

Closing the issue.

petermuessig avatar May 25 '23 09:05 petermuessig