Weird type error

TS2345: Argument of type 'PieceContext<keyof StoreRegistryEntries>' is not assignable to parameter of type 'LoaderContext'.
Types of property 'store' are incompatible.
Type 'ArgumentStore | CommandStore | InteractionHandlerStore | ListenerStore | PreconditionStore' is not assignable to type 'InteractionHandlerStore'.
Property 'run' is missing in type 'ArgumentStore' but required in type 'InteractionHandlerStore'.

17 super(ctx, {
~~~

node_modules/.pnpm/@sapphire+framework@4.8.5/node_modules/@sapphire/framework/dist/cjs/index.d.ts:441:5
441 run(interaction: Interaction): Promise<boolean>;
~~~
'run' is declared here.
TS2345: Argument of type 'PieceContext<keyof StoreRegistryEntries>' is not assignable to parameter of type 'LoaderContext'.
Types of property 'store' are incompatible.
Type 'ArgumentStore | CommandStore | InteractionHandlerStore | ListenerStore | PreconditionStore' is not assignable to type 'InteractionHandlerStore'.
Property 'run' is missing in type 'ArgumentStore' but required in type 'InteractionHandlerStore'.

17 super(ctx, {
~~~

node_modules/.pnpm/@sapphire+framework@4.8.5/node_modules/@sapphire/framework/dist/cjs/index.d.ts:441:5
441 run(interaction: Interaction): Promise<boolean>;
~~~
'run' is declared here.
export class DeleteInviteButtonHandler extends InteractionHandler {
public constructor(ctx: PieceContext, options: InteractionHandler.Options) {
super(ctx, {
...options,
interactionHandlerType: InteractionHandlerTypes.Button,
});
}
...
export class DeleteInviteButtonHandler extends InteractionHandler {
public constructor(ctx: PieceContext, options: InteractionHandler.Options) {
super(ctx, {
...options,
interactionHandlerType: InteractionHandlerTypes.Button,
});
}
...
Solution:
Change PieceContext to LoaderContext
Jump to solution
10 Replies
Marino
MarinoOP•11mo ago
Got this recently, no idea what happened, was fine before, just ran pnpm up and nothing changed
Solution
Favna
Favna•11mo ago
Change PieceContext to LoaderContext
Marino
MarinoOP•11mo ago
Is this a recent update?
Favna
Favna•11mo ago
No, couples of months already by now.
Marino
MarinoOP•11mo ago
Hm okay thanks
Favna
Favna•11mo ago
FWIW while an argument could be made that it was a breaking chang we opted for it to not be a major version because it's a type only change, and a very easy one at that.
Marino
MarinoOP•11mo ago
yeah i understand that was there a reasoning behind the change? was the type changed much?
Favna
Favna•11mo ago
Type wasn't really changed. The reasoning was that we had multiple types called Context and wanted better clarification.
Favna
Favna•11mo ago
GitHub
refactor: rename Piece.Context to Piece.LoaderContext by kyrane...
As there are framework pieces with name clash (Argument.Context for example isn't Piece.Context, but ArgumentContext).
Marino
MarinoOP•11mo ago
Ah Thanks for the explanation 🙂
Want results from more Discord servers?
Add your server