Skip to content

Commit

Permalink
Revert ""undefined" can also be a valid value to return on get when n…
Browse files Browse the repository at this point in the history
…o value came back"

This reverts commit 76846be.
  • Loading branch information
Apollon77 committed Jan 6, 2025
1 parent 04a71e0 commit c67a4dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ declare module 'tuyapi' {
disconnect(): void;
isConnected(): boolean;

get(options: GetOptions): Promise<DPSObject|number|boolean|string|undefined>;
get(options: GetOptions): Promise<DPSObject|number|boolean|string>;
refresh(options: RefreshOptions): Promise<DPSObject>;
set(options: SingleSetOptions|MultipleSetOptions): Promise<DPSObject>;
toggle(property: number): Promise<boolean>;
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class TuyaDevice extends EventEmitter {
* @example
* // get all available data from device
* tuya.get({schema: true}).then(data => console.log(data))
* @returns {Promise<Boolean|Object|undefined>}
* @returns {Promise<Boolean|Object>}
* returns boolean if single property is requested, otherwise returns object of results
*/
async get(options = {}) {
Expand Down Expand Up @@ -183,7 +183,7 @@ class TuyaDevice extends EventEmitter {
data = await this.set(setOptions);
}

if (data === undefined || typeof data !== 'object' || options.schema === true) {
if (typeof data !== 'object' || options.schema === true) {
// Return whole response
return data;
}
Expand Down

0 comments on commit c67a4dc

Please sign in to comment.