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

[rules] Rule Builder: Fix wrong type definition for send(command) #389

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading