Skip to content

Commit

Permalink
Update return type for getItem to indicate it can return null
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy committed Nov 6, 2024
1 parent 90313a3 commit 30dce50
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/items/items.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ function existsItem (name) {
* @memberof items
* @param {string} name the name of the Item
* @param {boolean} [nullIfMissing=false] whether to return null if the Item cannot be found (default is to throw an {@link https://www.openhab.org/javadoc/latest/org/openhab/core/items/itemnotfoundexception ItemNotFoundException})
* @returns {Item} {@link items.Item} Item or `null` if `nullIfMissing` is true and Item is missing
* @returns {Item | null} {@link items.Item} Item or `null` if `nullIfMissing` is true and Item is missing
*/
function getItem (name, nullIfMissing = false) {
try {
Expand Down
4 changes: 2 additions & 2 deletions types/items/items.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ export function existsItem(name: string): boolean;
* @memberof items
* @param {string} name the name of the Item
* @param {boolean} [nullIfMissing=false] whether to return null if the Item cannot be found (default is to throw an {@link https://www.openhab.org/javadoc/latest/org/openhab/core/items/itemnotfoundexception ItemNotFoundException})
* @returns {Item} {@link items.Item} Item or `null` if `nullIfMissing` is true and Item is missing
* @returns {Item | null} {@link items.Item} Item or `null` if `nullIfMissing` is true and Item is missing
*/
export function getItem(name: string, nullIfMissing?: boolean): Item;
export function getItem(name: string, nullIfMissing?: boolean): Item | null;
/**
* Gets all openHAB Items.
*
Expand Down
2 changes: 1 addition & 1 deletion types/items/items.d.ts.map

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

0 comments on commit 30dce50

Please sign in to comment.