Async Preconditions
Helloo! It seems that I am unable to create a precondition that is async, whenever I try to write one with async. I get
The inferred type of 'chatInputRun' cannot be named without a reference to '.pnpm/@[email protected]/node_modules/@sapphire/result'. This is likely not portable. A type annotation is necessary.
Here is the code in question:
12 Replies
cannot reproduce. Update all your dependencies, Nuke your node_modules and lockfile and reinstall dependencies
I still receive the same error, I've done the following:
-
pnpm update --latest
- Delete node_modules and pnpm_lock.yaml
- pnpm install
- Restarted TS language serverDid you add the hoist pattern that you have to use when using pnpm?
pnpm is well known to have issues with TypeScript when dealing with packages that use module augmentations and transitive dependencies because they do not patch typescript internally to actually redirect the server to scan whever the hell they place the dependencies that is not
node_modules
. It's really not an all that good package manager because of its major issues with typescript. Compare that to Yarn which also has a pnp mode, when enabled it also patches TypeScript to actually ensure that it can read the files when it should.You could also follow the ts instructions and manually annotate the return type (
Ok
, I think?)true
it's just a bit of a PITA to have to do that but yeah
it's
: Precondition.AsyncResult
btwI've tried annotating it to Promise<PreconditionResult> but it gave me more errors than before it's like this I see
that is an alias for
type AsyncPreconditionResult = Promise<Result<unknown, UserError>>
so yeah not the same as Promise<PreconditionResult>
Promise<PreconditionResult>
is Promise<Awaitable<Result<unknown, UserError>>>
ah I see I see the few ways I can get past this is by either manually annotating the return type, or by making the switch to yarn or npm?
One of those sounds easier than the other
(im sure you mean switching to yarn right lioness)
(oh for sure)
pls do