Issue with pnpm (A type annotation is necessary)

The inferred type of 'parse' cannot be named without a reference to '.pnpm/@sapphire+result@2.6.4/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•10mo 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•10mo ago
Thank you so much, I finally found it Promise<Option.None | Option.Some<{name:string, value:string}[]>>
Lioness100
Lioness100•10mo 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•10mo ago
Indeed the final answer is Promise<Option<{name:string, value:string}[]
bonk
bonk•9mo 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