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

Type declarations should not inline type definitions #392

Open
wertzui opened this issue Oct 28, 2024 · 1 comment
Open

Type declarations should not inline type definitions #392

wertzui opened this issue Oct 28, 2024 · 1 comment
Labels
external bug Something isn't working and it isn't our fault

Comments

@wertzui
Copy link

wertzui commented Oct 28, 2024

After upgrading to the latest version, VS code tells me that there is a problem when I pass an Item to triggers.ItemStateChangeTrigger, because Item does not expose "__#5@#getToggleState"(): "PAUSE" | "PLAY" | "OPEN" | "CLOSED" | "ON" | "OFF" which is defined here

"__#6@#getToggleState"(): "PAUSE" | "PLAY" | "OPEN" | "CLOSED" | "ON" | "OFF";
and got introduced with 2348409.

Besides this method definition being obviously wrong (It should probably be getToggleState(): "PAUSE" | "PLAY" | "OPEN" | "CLOSED" | "ON" | "OFF"), I think triggers.d.ts should not expose its own Item definition, but rather use the one from items.d.ts.

florian-h05 added a commit to florian-h05/openhab-js that referenced this issue Nov 3, 2024
Private methods are not supported by .d.ts type declarations, so do not use them!

Refs openhab#392.

Signed-off-by: Florian Hotze <[email protected]>
@florian-h05
Copy link
Contributor

#394 fixes the issue with "__#5@#getToggleState"(): "PAUSE" | "PLAY" | "OPEN" | "CLOSED" | "ON" | "OFF" by not making this method private anymore.

I think triggers.d.ts should not expose its own Item definition, but rather use the one from items.d.ts.

Yes, but our type definitions are emitted by the TypeScript compiler, which currently inlines type definitions.
This is an upstream issue: microsoft/TypeScript#37151

@florian-h05 florian-h05 added the external bug Something isn't working and it isn't our fault label Nov 3, 2024
@florian-h05 florian-h05 changed the title types/triggers.d.ts should not expose its own Item definition Type declarations should not inline type definitions Nov 3, 2024
florian-h05 added a commit that referenced this issue Nov 3, 2024
Private methods are not supported by .d.ts type declarations, so do not
use them!

Refs #392.

Signed-off-by: Florian Hotze <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external bug Something isn't working and it isn't our fault
Projects
None yet
Development

No branches or pull requests

2 participants