Skip to content

Commit

Permalink
Fix correctly cast this.constructor calls
Browse files Browse the repository at this point in the history
  • Loading branch information
davwheat committed Sep 10, 2021
1 parent 5ce4a1d commit 4511d7d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/src/common/Component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ export default abstract class Component<Attrs extends ComponentAttrs = Component
if ('children' in attrs) {
throw new Error(
`[${
(this.constructor as any).name
(this.constructor as typeof Component).name
}] The "children" attribute of attrs should never be used. Either pass children in as the vnode children or rename the attribute`
);
}

if ('tag' in attrs) {
throw new Error(`[${(this.constructor as any).name}] You cannot use the "tag" attribute name with Mithril 2.`);
throw new Error(`[${(this.constructor as typeof Component).name}] You cannot use the "tag" attribute name with Mithril 2.`);
}
}

Expand Down
2 changes: 1 addition & 1 deletion js/src/common/components/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default abstract class Modal<ModalAttrs extends Record<string, unknown> =
return (
<div className={'Modal modal-dialog ' + this.className()}>
<div className="Modal-content">
{(this.constructor as any).isDismissible && (
{(this.constructor as typeof Modal).isDismissible && (
<div className="Modal-close App-backControl">
{Button.component({
icon: 'fas fa-times',
Expand Down

1 comment on commit 4511d7d

@davwheat
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incorrectly* 🙈

Please sign in to comment.