Augmenting Container Failed

declare module '@sapphire/pieces' {
interface Container {
db: PrismaClient;
}
}
declare module '@sapphire/pieces' {
interface Container {
db: PrismaClient;
}
}
Idk why but this suddenly stopped working after i installed the following packages @sapphire/async-queue @sapphire/fetch @sapphire/pieces @sapphire/discord.js-utilities Everything was working fine before but i think after i installed @sapphire/pieces it broke. I tried reinstallig the node_modules and reloading vscode but nothing seems to work
Solution:
Run yarn dedupe
Jump to solution
14 Replies
Oreo ™
Oreo ™OP2y ago
Oreo ™
Oreo ™OP2y ago
And PrismaClient is getting imported properly And the other augments work fine
Oreo ™
Oreo ™OP2y ago
Lioness100
Lioness1002y ago
@oreotm. I think it's the best idea to not install @sapphire/pieces directly. It introduces conflicts such as what you're experiencing. Everything you'd need from pieces is reexported from /framework.
kyra
kyra2y ago
You need to import '@sapphire/pieces'; at the top of the file, it's a requirement for augmenting, otherwise it's declarating which in turn replaces the types.
Lioness100
Lioness1002y ago
I don't know if that would be the problem, because it worked before they added the new packages (not changing the file), right?
Oreo ™
Oreo ™OP2y ago
I tried that and it doesnt seem to work
Oreo ™
Oreo ™OP2y ago
Gist
Augments.d.ts
GitHub Gist: instantly share code, notes, and snippets.
Oreo ™
Oreo ™OP2y ago
heres my augments file
kyra
kyra2y ago
It looks correct Then it may be due to duplicated @sapphire/pieces version, are you using npm or yarn?
Oreo ™
Oreo ™OP2y ago
yarn v3 should i use npm?
kyra
kyra2y ago
No, yarn
Solution
kyra
kyra2y ago
Run yarn dedupe
Oreo ™
Oreo ™OP2y ago
Worked

Did you find this page helpful?