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

1 messages · Page 1 of 1 (latest)

gaunt fiber
#

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
                                }
                        ]
                });
        }

I know it isn't the best but I'm not sure what's wrong with this, any help?

hot crowBOT
#

@gaunt fiber to help others find answers, you can mark your question as solved via Right Click Solution Message->Apps->✅ Mark Solution

sinful fox
#

Write a proper tsconfig. By default with no target set it compiles to ES3 which doesn't support classes.

#

extend @sapphire/ts-config and/or read up on tsconfig options.

gaunt fiber
#

Will setting the target in the compiler options to ES2021 fix it?

sinful fox
#

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.

gaunt fiber
#

Alright, thank you

#

Are there any example and opensource bots made with Sapphire?

timid frostBOT
#

Discord bots that use @sapphire/framework v4
_ _

nova ivy
#

@gaunt fiber

hot crowBOT
#

Thank you for marking this question as solved!

Question Message ID

1081909601341034497

Solution Message ID

1081912354058535024