Sapphire - Imagine a framework
Sapphire - Imagine a framework

sapphire-support

Root Question Message

Feralheart
Feralheart1/22/2023
@sapphire/result error in v4

After migrating to Sapphire v4 and D.js v14 and fixed all breaking changes, I've still got three errors from @sapphire/result

One of the error is:

 node_modules/@sapphire/result/dist/lib/Option.d.ts:45:46 - error TS2344: Type 'T[P]' does not satisfy the constraint 'Option<any>'.
   Type 'T[keyof T]' is not assignable to type 'Option<any>'.
     Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'Option<any>'.
       Type 'T[string]' is not assignable to type 'Option<any>'.
         Type 'T[string]' is not assignable to type 'Some<any>'.
           Type 'T[keyof T]' is not assignable to type 'Some<any>'.
             Type 'T[P]' is not assignable to type 'Some<any>'.
               Type 'T[keyof T]' is not assignable to type 'Some<any>'.
                 Type 'T[string] | T[number] | T[symbol]' is not assignable to type 'Some<any>'.
                   Type 'T[string]' is not assignable to type 'Some<any>'.
 
 45         -readonly [P in keyof T]: UnwrapSome<T[P]>;


The other two looks the same but instead of UnwrapSome there's UnwrapOk and UnwrapErr in the last row
How to fix this?
Feralheart
Feralheart1/23/2023
Tried with yarn dedupe and also tried to reinstall my node_modules, but sadly the error is still there
Favna
Favna1/23/2023
need more info then because I can guarantee that if you create a fresh new project with Sapphire CLI that it wont have this error
Favna
Favna1/23/2023
i.e. full package.json for starters
Feralheart
Feralheart1/24/2023
I use node v16.19
Also my package.json:
Feralheart
Feralheart1/24/2023
Favna
Favna1/24/2023
it's invalid for starters
Favna
Favna1/24/2023
also just curious but any particular reason you're using raw i18next + i18next-fs-backend instead of @sapphire/plugin-i18next?
Favna
Favna1/24/2023
because i18next-fs-backend has some pretty nasty bugs and performance flaws that Kyra and I fixed in @skyra/i18next-backend which is used in the plugin
Favna
Favna1/24/2023
Anyway I think the reason for your issue might be that you haven't updated TypeScript, so try updating it to 4.9.4
Feralheart
Feralheart1/24/2023
There was an old memory-cache for prisma, but I mistakenly left it in the package.json after migrating to prisma-redis-middleware, and now after removing it I forgot to delete the comma 😅
Feralheart
Feralheart1/24/2023
I use a custom random translation functionality in various places (for example in the 8ball command)
Feralheart
Feralheart1/24/2023
I want make a PR to the @sapphire/plugin-i18next, to add this functionality there as well, but I haven't had time to do it yet
Feralheart
Feralheart1/24/2023
Thank you, I'll check it soon ^^
Favna
Favna1/24/2023
you can literally just
import { i18next } from 'i18next';

i18next.t('key');

anywhere, any time, any place. Whether you use the plugin or not. We still use i18next.
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy