Skip to content

Commit

Permalink
refactor(system-message): read class property for checkType
Browse files Browse the repository at this point in the history
  • Loading branch information
favna committed Feb 10, 2024
1 parent 5ad7ecf commit a2d6506
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,10 @@ export class DiscordSystemMessage extends LitElement implements LightTheme {
@property({ type: Boolean, reflect: true, attribute: 'light-theme' })
public accessor lightTheme = false;

public checkType(value: string) {
if (typeof value !== 'string') {
public checkType() {
if (typeof this.type !== 'string') {
throw new TypeError('DiscordSystemMessage `type` prop must be a string.');
} else if (!['join', 'leave', 'call', 'missed-call', 'boost', 'edit', 'thread', 'pin', 'alert', 'error'].includes(value)) {
} else if (!['join', 'leave', 'call', 'missed-call', 'boost', 'edit', 'thread', 'pin', 'alert', 'error'].includes(this.type)) {
throw new RangeError(
"DiscordSystemMessage `type` prop must be one of: 'join', 'leave', 'call', 'missed-call', 'boost', 'edit', 'thread', 'pin', 'alert', 'error'"
);
Expand All @@ -183,7 +183,7 @@ export class DiscordSystemMessage extends LitElement implements LightTheme {

protected override render() {
this.timestamp = handleTimestamp(this.timestamp);
this.checkType(this.type);
this.checkType();

let icon: TemplateResult<1>;

Expand Down

0 comments on commit a2d6506

Please sign in to comment.