Skip to content

Commit

Permalink
[1.x] [extensibility] Add (some) missing shims (#4027)
Browse files Browse the repository at this point in the history
* chore: add some missing shims

* chore: remove unused import
  • Loading branch information
DavideIadeluca authored Oct 2, 2024
1 parent ed72aa0 commit 88f182c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 1 deletion.
12 changes: 12 additions & 0 deletions extensions/approval/js/src/@types/shims.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
declare module 'flarum/common/models/Discussion' {
export default interface Discussion {
isApproved(): boolean;
}
}

declare module 'flarum/common/models/Post' {
export default interface Post {
isApproved(): boolean;
canApprove(): boolean;
}
}
2 changes: 1 addition & 1 deletion extensions/likes/js/src/@types/shims.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Post from 'flarum/common/models/Post';
import User from 'flarum/common/models/User';

declare module 'flarum/common/models/Post' {
export default interface Post {
likes(): User[];
likesCount(): number;
canLike(): boolean;
}
}
6 changes: 6 additions & 0 deletions extensions/lock/js/src/@types/shims.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module 'flarum/common/models/Discussion' {
export default interface Discussion {
isLocked(): boolean;
canLock(): boolean;
}
}
5 changes: 5 additions & 0 deletions extensions/nicknames/js/src/@types/shims.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module 'flarum/common/models/User' {
export default interface User {
canEditNickname(): boolean;
}
}
6 changes: 6 additions & 0 deletions extensions/sticky/js/src/@types/shims.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare module 'flarum/common/models/Discussion' {
export default interface Discussion {
isSticky(): boolean;
canSticky(): boolean;
}
}
8 changes: 8 additions & 0 deletions extensions/suspend/js/src/@types/shims.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare module 'flarum/common/models/User' {
export default interface User {
canSuspend(): boolean;
suspendedUntil(): Date | string | null | undefined;
suspendReason(): string | null | undefined;
suspendMessage(): string | null | undefined;
}
}

0 comments on commit 88f182c

Please sign in to comment.