Skip to content

Commit

Permalink
work around status potentially being undefined
Browse files Browse the repository at this point in the history
Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
  Type 'undefined' is not assignable to type 'string'.ts(2345)
  • Loading branch information
Dhaulagiri committed May 16, 2024
1 parent f8439e7 commit 764a215
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ export default class HdsAppFooterStatusLinkComponent extends Component<HdsAppFoo
* @description The text content of the StatusLink
*/
get text() {
if (!this.args.text) {
return STATUSES[this.status].text;
if (!this.args.text && this.status) {
const index = Object.keys(STATUSES).indexOf(this.status);
return STATUSES[index]?.text;
}
return this.args.text;
}
Expand Down

0 comments on commit 764a215

Please sign in to comment.