SAP / openui5

OpenUI5 lets you build enterprise-ready web applications, responsive to all devices, running on almost any browser of your choice.
http://openui5.org
Apache License 2.0
2.94k stars 1.23k forks source link

sap.ui.core.URI type definition #3976

Closed whydrae closed 6 months ago

whydrae commented 6 months ago

OpenUI5 version: latest

Browser/version (+device/version): all

URL (minimal example if possible): https://ui5.sap.com/#/api/sap.ui.core.URI

Steps to reproduce the problem:

  1. In a ui5 typescript app, try to import the sap.ui.core.URI (results in import { URI } from "sap/ui/core/library";)
  2. The type of this import would be just a string (export type URI = string;)

What is the expected result? It's actually possible to validate an input using this type, since it's created from the DataType, so I would expect the DataType function to be available in the TS.

https://github.com/SAP/openui5/blob/master/src/sap.ui.core/src/sap/ui/core/library.js#L2104

What happens instead? The imported type can only be handled as a string.

Any other information? (attach screenshot if possible) I was not sure in which repo I should create this issue. Please, correct me if I'm wrong.

codeworrior commented 6 months ago

See https://github.com/SAP/ui5-typescript/issues/386#issuecomment-1433778909 for an explanation why we don't expose the DataType instance (intentionally).