@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]>;
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?
Solution:
Anyway I think the reason for your issue might be that you haven't updated TypeScript, so try updating it to 4.9.4
Jump to solution
11 Replies
Favna
Favna2y ago
Deduplicate your dependencies. There are no current known issues in result.
Feralheart
Feralheart2y ago
Tried with yarn dedupe and also tried to reinstall my node_modules, but sadly the error is still there
Favna
Favna2y ago
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 i.e. full package.json for starters
Spinel
Spinel2y ago
When asking for help, make sure to provide as much detail as possible. What have you tried so far? Do you have stacktraces that you can show us? What are you trying to achieve? Try to answer these questions and others, so we do not have to ask for them afterwards.
❯ For a good guide on how to ask questions, see the instructions that StackOverflow gives. You should try to always follow these guidelines. ❯ For an excellent video that shows how not to ask technical questions is this, watch this YouTube video by LiveOverflow. ❯ Asking technical questions (Clarkson)How to ask questions the smart way (Raymond)
Feralheart
Feralheart2y ago
I use node v16.19 Also my package.json:
Favna
Favna2y ago
it's invalid for starters
Favna
Favna2y ago
also just curious but any particular reason you're using raw i18next + i18next-fs-backend instead of @sapphire/plugin-i18next? 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
Solution
Favna
Favna2y ago
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
Feralheart2y ago
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 😅 I use a custom random translation functionality in various places (for example in the 8ball command) 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 Thank you, I'll check it soon ^^
Favna
Favna2y ago
you can literally just
import { i18next } from 'i18next';

i18next.t('key');
import { i18next } from 'i18next';

i18next.t('key');
anywhere, any time, any place. Whether you use the plugin or not. We still use i18next.
Want results from more Discord servers?
Add your server