Skip to content

Commit f8c622e

Browse files
authored
fix(mentions): cast UserPageResolver to satisfy Routes.add() type constraint (flarum#4479)
TypeScript's strict constructor signature checking prevents `typeof UserPageResolver` (specialized to UserPage components) from satisfying `typeof DefaultResolver` (uses generic Comp). Cast via `as typeof DefaultResolver` to resolve the type error.
1 parent 36fc4ed commit f8c622e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

extensions/mentions/js/src/forum/extend.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Extend from 'flarum/common/extenders';
22
import Post from 'flarum/common/models/Post';
33
import User from 'flarum/common/models/User';
4+
import DefaultResolver from 'flarum/common/resolvers/DefaultResolver';
45
import UserPageResolver from 'flarum/forum/resolvers/UserPageResolver';
56
import MentionsUserPage from './components/MentionsUserPage';
67
import PostMentionedNotification from './components/PostMentionedNotification';
@@ -13,7 +14,7 @@ export default [
1314
...commonExtend,
1415

1516
new Extend.Routes() //
16-
.add('user.mentions', '/u/:username/mentions', MentionsUserPage, UserPageResolver),
17+
.add('user.mentions', '/u/:username/mentions', MentionsUserPage, UserPageResolver as typeof DefaultResolver),
1718

1819
new Extend.Model(Post) //
1920
.hasMany<Post>('mentionedBy')

0 commit comments

Comments
 (0)