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

Improve Typescript support - ex: Add Java.type definitions #387

Open
ThaDaVos opened this issue Oct 6, 2024 · 0 comments
Open

Improve Typescript support - ex: Add Java.type definitions #387

ThaDaVos opened this issue Oct 6, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@ThaDaVos
Copy link

ThaDaVos commented Oct 6, 2024

Your Environment

  • Version used: (e.g., openHAB and JS Scripting add-on version) 5.7.0
  • Environment name and version (e.g. Chrome 76, Java 8, Node.js 12.9, ...): Typescript 5.6.2
  • Operating System and version (desktop or mobile, Windows 10, Raspbian Buster, ...): Ubuntu

Currently when writing rules using Typescript certain types are missing - also it takes some time to get it to load the existing types.
But the thing missing most are the Java.* types and intellisense - currently I am running into issues as follows:

TypeError: invokeMember (includes) on java.util.ArrayList@6fddcfbe failed due to: Unknown identifier: includes: TypeError: invokeMember (includes) on java.util.ArrayList@6fddcfbe failed due to: Unknown identifier: includes

I am getting this when I use .includes on some metadata I retrieved with Item.getMetadata() - now I am trying to catch this error by firstly converting it from a Java type to a JS type - but this is only possible if it is a Java type so before doing that I am trying to check if it is - here lies the issue - there's no typing for the Java.* methods at all - not even in the source code here (or I looked over it).

So this feature request is all about improving the typing support for Typescript - or at least, adding the missing types

@ThaDaVos ThaDaVos added the enhancement New feature or request label Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant