Skip to content

Commit

Permalink
Enforce Attributor#add() types
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Jan 15, 2024
1 parent 956adb1 commit d69787d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/attributor/attributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export default class Attributor {
}
}

public add(node: HTMLElement, value: any): boolean {
public add(node: HTMLElement, value: string | number): boolean {
if (!this.canAdd(node, value)) {
return false;
}
node.setAttribute(this.keyName, value);
node.setAttribute(this.keyName, String(value));
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/attributor/class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ClassAttributor extends Attributor {
.map((name) => name.split('-').slice(0, -1).join('-'));
}

public add(node: HTMLElement, value: any): boolean {
public add(node: HTMLElement, value: string | number): boolean {
if (!this.canAdd(node, value)) {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/attributor/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class StyleAttributor extends Attributor {
});
}

public add(node: HTMLElement, value: any): boolean {
public add(node: HTMLElement, value: string | number): boolean {
if (!this.canAdd(node, value)) {
return false;
}
Expand Down

0 comments on commit d69787d

Please sign in to comment.