TypeError: Class extends value undefined is not a constructor or null

Hey, newbie here in both TypeScript and Sapphire, and I'm trying to build a command but I'm getting the error specified in the title, my code for the constructor is the following:
public constructor(context: CommandContext, options: Command.Options) {
super(context, {
description: 'Play a song',
preconditions: [ new VoiceChannelOnly() ],
options: [
{
name: 'play',
description: 'Play a song from YouTube',
type: 'STRING',
required: true
}
]
});
}
public constructor(context: CommandContext, options: Command.Options) {
super(context, {
description: 'Play a song',
preconditions: [ new VoiceChannelOnly() ],
options: [
{
name: 'play',
description: 'Play a song from YouTube',
type: 'STRING',
required: true
}
]
});
}
I know it isn't the best but I'm not sure what's wrong with this, any help?
Solution:
Write a proper tsconfig. By default with no target set it compiles to ES3 which doesn't support classes.
Solution
Favna
Favna441d ago
Write a proper tsconfig. By default with no target set it compiles to ES3 which doesn't support classes.
Favna
Favna441d ago
extend @sapphire/ts-config and/or read up on tsconfig options.
kzts
kzts441d ago
Will setting the target in the compiler options to ES2021 fix it?
Favna
Favna441d ago
yes but again, you should read up on what everything in tsconfig does. You shouldnt set values you have no idea for what they do.
Favna
Favna441d ago
TSConfig Reference - Docs on every TSConfig option
From allowJs to useDefineForClassFields the TSConfig reference includes information about all of the active compiler flags setting up a TypeScript project.
kzts
kzts441d ago
Alright, thank you Are there any example and opensource bots made with Sapphire?
Spinel
Spinel441d ago
Discord bots that use @sapphire/framework v4 - Official Bot Examples ᴱ ᴰ ᴶˢ - Dragonite ᴱ ᴰ Discord bots that use @sapphire/framework v3 - Archangel ᴱ ᴰ - Arima ᴱ - Nino ᴱ ᴰ - Operator ᴱ ᴬ ᴰ - Radon ᴱ ᴬ - Sapphire Application Commands Examples ᴱ - 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.
Lioness100
Lioness100441d ago
@BHS.
Spinel
Spinel440d ago
Discord bots that use @sapphire/framework v4 - Official Bot Examples ᴱ ᴰ ᴶˢ - Dragonite ᴱ ᴰ Discord bots that use @sapphire/framework v3 - Archangel ᴱ ᴰ - Arima ᴱ - Nino ᴱ ᴰ - Operator ᴱ ᴬ ᴰ - Radon ᴱ ᴬ - Sapphire Application Commands Examples ᴱ - 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.
Want results from more Discord servers?
Add your server
More Posts
THREAD_CREATE event Listener run method argumentsWhat I want to do: I want to inspect the id of the parent channel where the thread was created. TheCommand info command issueI have a command info command, but when I try to get information on a command called "flags" it retuawait args.pick("member");how to enable this? https://discord.com/channels/737141877803057244/737142071319855105/107804884825Command info command issueI have a command info command, but when I try to get information on a command called "flags" it retuRunning in productionHey! What's the recommended method for starting up a node app in production? Specifically for DiscorspeakerName translation in FFXIVIpcChatHello everyone, I'm using ffxiv-pcap to read chat messages using the Sapphire Struct for chat messagClearing registered slash commandsHello 👋 I would like to know if there's a system provided by Sapphire to automatically clear previDocker being goofyI have no idea why Docker is being all goofy, it's saying that my discord token is invalid, but it'sReferenceError: [ENV] BOT_OWNER_IDS - The key must be an array, but is empty or undefined.I am using `@skyra/env-utilities` and when I start up my bot, I get the error reported in the title How can I turn a joinedTimestamp into this Discord TimestampThe one that automatically shows you like how long ago this timestamp wasHow to use `@sapphire/shapeshift ` dateValid & stringRegexI have a slash command that needs to take in a date input in the format of `YYYY-MM-DD`. I want to Access extended sapphire clientFollowing usecase: I extended the sapphire client in order to create custom collections etc. Is thVersion mismatch between Sapphire and dapi-typesHi, I was updating my dependencies when I encountered Discord.js' dapi-types error. I copy/pasted thWhats the syntax to require Permission X AND Y OR Z when using requiredUserPermissionswhen using `requiredUserPermissions`. Its an array so Im not sureGetting modalSubmit error over the weekendDid discord change something???How to use windows env variables using skyra env utilitiesi am trying to use CD for hosting and i have env variables set on windows, how do i access them withPattern for fetching all registered slash commandsI have some slash commands and some with subcommands and and want to introduce a `/help` slash comminteraction.showModal not workinginteraction.showModal doesnt work, I dont know why. Code: ``` this.container.logger.debug("Start EdPrecondition with Slash CommandHow to report precondition failure w/ clash command? If I use `this.error({ message: 'error' });` iHow to use skyra env utilities with the cli generated project?I want to use env variables to store my mongo uri, but due to skyra utilities being their i cant use