I am just getting started to shift my DSL-rules to JS Scripting with openhab-js. In general it seems to work fine. But the types are not recognized correctly on openhab.rules.*. Only the exported symbols of /rules/rules.js are exposed and in turn suggested by the IDE(vs-code).
My guess is, that the export from /types/openhab-js.d.ts export const rules: typeof import("./rules/rules");
The problem why we haven‘t got type defs for RuleBuilder yet, is the complexity of RuleBuilder, for which I honestly haven‘t found the time yet to add type defs for it.
Just changing the export statement for the type defs is no solution, since your change would disable type definitions for JSRule, runRule, and so on.
About ES6 import: I am not sure if that would work because ES6 import is working asynchronously, and there are limitations which do not allow us to run async tasks. I can probably have a look if we can get ES import working, however this is not high on my (long) priority list.
Note, that if you want more strict type behaviour in VS Code, you can add // @ts-check to the top of your js files.
Regarding your long todo-list I appreciate your and all the community-members efforts on making openhab great. Maybe I can myself find the time to get into contribution someday.
Referring to ES6 support I already did some research and already saw that it supports ES6 (and there are interesting discussions about direct Typescript compilation too). But I also think about your suggestion to build the rules elsewhere and then include the compiled code to /automation/js.
However, what I found very difficult was that I spent a couple of hours analyzing this. My suggestion is to add a short comment in the Rule-Builder section of JS Scripting docs that TS-types are not available.