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[]=@sapphire5 Replies
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; }>>
?Thank you so much, I finally found it
Promise<Option.None | Option.Some<{name:string, value:string}[]>>
Great! For future reference,
Option<T>
will expand to Some<T> | None
, so that would be the most concise way to type it.Indeed the final answer is
Promise<Option<{name:string, value:string}[]
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