Skip to content

Commit

Permalink
[rules] Rule Builder: Fix wrong type definition for send(command) (#389)
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-h05 authored Oct 9, 2024
1 parent ceab88d commit 0ebd7e6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/rules/operation-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ const items = require('../items/items');
* @typedef { import("../items/items").Item } Item
* @private
*/
/**
* @typedef {import('@js-joda/core').ZonedDateTime} time.ZonedDateTime
* @private
*/
/**
* @typedef {import('../quantity').Quantity} Quantity
* @private
*/

/**
* Operation to execute as part of a rule
Expand Down Expand Up @@ -63,7 +71,7 @@ class OperationBuilder {
/**
* Specifies that a command should be sent as a result of this rule firing.
*
* @param {string} command the command to send
* @param {string|number|time.ZonedDateTime|Quantity|HostState} command the command to send
* @returns {SendCommandOrUpdateOperation} the operation
*/
send (command) {
Expand Down
16 changes: 14 additions & 2 deletions types/rules/operation-builder.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export type Item = {
removeTags(...tagNames: string[]): void;
toString(): any;
};
export type Quantity = import('../quantity').Quantity;
/**
* Sends a command or update to an item
*
Expand Down Expand Up @@ -204,6 +205,14 @@ export class CopyStateOperation extends OperationConfig {
* @typedef { import("../items/items").Item } Item
* @private
*/
/**
* @typedef {import('@js-joda/core').ZonedDateTime} time.ZonedDateTime
* @private
*/
/**
* @typedef {import('../quantity').Quantity} Quantity
* @private
*/
/**
* Operation to execute as part of a rule
* @hideconstructor
Expand Down Expand Up @@ -238,10 +247,10 @@ export class OperationBuilder {
/**
* Specifies that a command should be sent as a result of this rule firing.
*
* @param {string} command the command to send
* @param {string|number|time.ZonedDateTime|Quantity|HostState} command the command to send
* @returns {SendCommandOrUpdateOperation} the operation
*/
send(command: string): SendCommandOrUpdateOperation;
send(command: string | number | time.ZonedDateTime | Quantity | HostState): SendCommandOrUpdateOperation;
/**
* Specifies that an update should be posted as a result of this rule firing.
*
Expand Down Expand Up @@ -324,5 +333,8 @@ declare class OperationConfig {
*/
build(name?: string, description?: string, tags?: Array<string>, id?: string): void;
}
declare namespace time {
type ZonedDateTime = import('@js-joda/core').ZonedDateTime;
}
export {};
//# sourceMappingURL=operation-builder.d.ts.map
2 changes: 1 addition & 1 deletion types/rules/operation-builder.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0ebd7e6

Please sign in to comment.