Issue with pnpm (A type annotation is necessary)

The inferred type of 'parse' cannot be named without a reference to '.pnpm/@[email protected]/node_modules/@sapphire/result'. This is likely not portable.A type annotation is necessary.ts(2742) I saw this error before but how can I fix it. I don't want to switch to Yarn. I have set this line, but this is not helping public-hoist-pattern[]=@sapphire
No description
5 Replies
Lioness100
Lioness100•15mo ago
The easiest way to fix this is just to explicitly type the return value, as the error says. I think that's it's Promise<Option<{ name: string; value: string; }>>?
Mateleo
Mateleo•15mo ago
Thank you so much, I finally found it Promise<Option.None | Option.Some<{name:string, value:string}[]>>
Lioness100
Lioness100•15mo ago
Great! For future reference, Option<T> will expand to Some<T> | None, so that would be the most concise way to type it.
Mateleo
Mateleo•15mo ago
Indeed the final answer is Promise<Option<{name:string, value:string}[]
bonk
bonk•13mo ago
Hey, I wanted to remember you guys that this error still exists 🙂 I switched to yarn for now since the solution mentioned here somehow doesnt work for me
Want results from more Discord servers?
Add your server