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:
I know it isn't the best but I'm not sure what's wrong with this, any help?
Solution:Jump to solution
Write a proper tsconfig. By default with no target set it compiles to ES3 which doesn't support classes.
9 Replies
Solution
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.
Will setting the target in the compiler options to ES2021 fix it?
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.
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.
Alright, thank you
Are there any example and opensource bots made with Sapphire?
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.
@BHS.
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.