Property does not exist on type 'Container'

i'm trying to use DI in typescript like on this page https://www.sapphirejs.dev/docs/Guide/additional-information/using-and-extending-container and i can't get it to work. my code is
export class MyClient extends SapphireClient {
public constructor() {
super(...optionsandstuff);
}

public override async login(token?: string) {
container.pollManager = new PollManager();
return super.login(token);
}
// destroy too
}

declare module '@sapphire/pieces' {
interface Container {
pollManager: PollManager;
}
}
export class MyClient extends SapphireClient {
public constructor() {
super(...optionsandstuff);
}

public override async login(token?: string) {
container.pollManager = new PollManager();
return super.login(token);
}
// destroy too
}

declare module '@sapphire/pieces' {
interface Container {
pollManager: PollManager;
}
}
but it gives the error Property 'pollManager' does not exist on type 'Container'. i'm using discord.js 14.14.1, @sapphire/framework 4.8.2, and typescript 5.3.2 with @sapphire/ts-config 5.0.0. i am really not sure what i'm doing wrong if anyone could help it would be greatly appreciated. thanks
Sapphire Framework
Using and extending container | Sapphire
The container is a way in which Sapphire achieves Dependency Injection. This is a very useful feature, since it
Solution:
Start by updating your dependencies. If anything framework 4.8.2 is bugged (as opposed to 4.8.5) but you should be able to just update to v5. Also make sure you do not have @sapphire/pieces in your dependencies, let it be installed as a transitive dependency.
Jump to solution
2 Replies
Solution
Favna
Favna7mo ago
Start by updating your dependencies. If anything framework 4.8.2 is bugged (as opposed to 4.8.5) but you should be able to just update to v5. Also make sure you do not have @sapphire/pieces in your dependencies, let it be installed as a transitive dependency.
jeelzzz
jeelzzz7mo ago
updating to sapphire v5 worked, thank you :D