Skip to content

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

Description

@ThaDaVos

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions