Trying to use Buttons with sapphire

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.
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.
I created a Button increation handler using sapphire cli but for some reason they might be using old types?
7 Replies
acronie
acronie2y ago
Also I was wondering do I handle multiple buttons from here only
Favna
Favna2y ago
Make sure you set up the hoisting pattern when using pnpm. Other than that, it is entirely possible that transient dependencies are outdated. We recently updated lexure and result, but not framework because it has a caret dependency. That's on the package manager of end users to resolve. For example try running pnpm update --recursive "@sapphire/*"
acronie
acronie2y ago
Okay I will try, do we have any examples for using Buttons in sapphire?
Spinel
Spinel2y ago
<::746069730170896405> Sapphire guide results: User Guide / Buttons Discord bots that use @sapphire/framework v4 - Official Bot Examples ᴱ ᴰ ᴶˢ - Gemboard ᴱ ᴰ - Dragonite ᴱ ᴰ - Radon ᴱ ᴬ - Sapphire Application Commands Examples ᴱ - Archangel ᴱ ᴰ - Zeyr ᴰ ᴬ Discord bots that use @sapphire/framework v3 - Arima ᴱ - Nino ᴱ ᴰ - Operator ᴱ ᴬ ᴰ - Spectera ᴬ Discord bots that use @sapphire/framework v2 - Materia ᴱ - RTByte ᴱ ᴬ - Skyra ᴬ ᴰ - YliasDiscordBot ᴬ _ : Uses ESM (if not specified then uses CJS) : Advanced bot (if not specified it is a simple bot, or not graded) : Uses Docker in production ᴶˢ: Written in JavaScript. If not specified then the bot is written in TypeScript.
acronie
acronie2y ago
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. I wasn't able to resolve it by updating I don't know what is the issue pepeHmm I use hoisting pattern on the sapphire framework
# pnpm only
shamefully-hoist=true
public-hoist-pattern[]=@sapphire/*
# pnpm only
shamefully-hoist=true
public-hoist-pattern[]=@sapphire/*
its already done pepeHmm trying to run that command  ERR_PNPM_PUBLIC_HOIST_PATTERN_DIFF  This modules directory was created using a different public-hoist-pattern value. Run "pnpm install" to recreate the modules directory. is returned (can fix for awhile using any)
Favna
Favna2y ago
no idea. Check if the issue persists with npm or yarn as well I guess. If it does send a repo link with a small reproducable sample code
WhacK
WhacK2y ago
I had this issue with npm the other day and couldn’t find any posts about it. I had to import the corresponding options from @saphire/framework/result to get it to compile and then it went back to normal.
import { Result, None, Option } from ‘@sapphire/framework’
import { Result, None, Option } from ‘@sapphire/framework’
I also had to remove the type casting I had put on the some() return.
// old
return this.<ChannelEncounterData>some(dataFromDB)

// new
return this.some(dataFromDB)
// old
return this.<ChannelEncounterData>some(dataFromDB)

// new
return this.some(dataFromDB)
Want results from more Discord servers?
Add your server