Module augmentation does not work
I recently updated my project with the latest versions of typescript and @sapphire/framework, and then I run into the problem that augmenting typing no longer works.
I thought the problem would be pnpm, I even tried with the .npmrc configuration file "shamefully-hoist=true" but I'm still trying with yarn and the same thing happens, I don't know what to do.
These are the versions I am using and my tsconfig file.
Solution:Jump to solution
normally module augments should work just fine if everything is done right though. The last time I had difficulties was when I had incorrectly published some package (i think it was pieces) where it was missing some files in dist. Maybe check that out for your own packages? Check the files array and check the dist?
6 Replies
Well, I found the problem, it's my subcommand package, but I don't understand why I can't extend from the sapphire command class.
bit hard to tell but FWIW the base sapphire sub commands plugin also doesnt module augment the command class.
With how that is designed there is no reason to because subcommands are their own class with their own properties and they dont augment commands at runtime either so there is no need to module augment either
Solution
normally module augments should work just fine if everything is done right though. The last time I had difficulties was when I had incorrectly published some package (i think it was pieces) where it was missing some files in dist. Maybe check that out for your own packages? Check the files array and check the dist?
I'll take a look at it, but I find it weird that it doesn't work now because I haven't changed anything about the package.json and it was working fine before, a bit weird.
Something I don't understand, is that if I copy literally the same code but in the code of my project it works correctly.
Hm kaname left again. I'll assume that he figured it out. Marking as resolved.