node-dbus-next icon indicating copy to clipboard operation
node-dbus-next copied to clipboard

support TypeScript decorators

Open mikelpr opened this issue 3 years ago • 2 comments

I'm getting these when I try to use the @method({}) decorator:

TypeError: Cannot read properties of undefined (reading 'value')
    at /home/mikel/Workspace/<>/node_modules/dbus-next/lib/service/interface.js:158:40
    at __decorate (/home/mikel/Workspace/<>/node_modules/tslib/tslib.js:99:114)
    at file:///home/mikel/Workspace/<>/dist/index.js:189:1
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

https://github.com/dbusjs/node-dbus-next/blob/b2a6b89e79de423debb4475452db1cc410beab41/lib/service/interface.js#L158

Debugging with vscode shows me that descriptor is my Interface but descriptor.descriptor is undefined so it fails on that descriptor.descriptor.value

mikelpr avatar Jan 14 '22 02:01 mikelpr

ok so I see it works if I use js and babel, while it does not work with typescript's decorators. also that the @property decorator doesn't crash on typescript but doesn't show up in D-Feet anyway. so it's a general typescript incompatibility

mikelpr avatar Jan 14 '22 07:01 mikelpr

https://acrisci.github.io/doc/node-dbus-next/module-interface-Interface.html

use configureMembers(). If there's a way to make the decorators compatible with TypeScript let me know.

acrisci avatar Jan 14 '22 14:01 acrisci