When using the following code from the repository documentation:
import { Discord } from '@typeit/discord';
@Discord() // Decorate the class
abstract class AppDiscord {}
My application crashes with the following error:
\node_modules\@typeit\src\Decorators\Discord.ts:1
TypeError: Cannot read property 'importCommands' of undefined
at \node_modules\@typeit\src\Decorators\Discord.ts:24:16
at DecorateConstructor (\node_modules\reflect-metadata\Reflect.js:541:33)
at Object.decorate (\node_modules\reflect-metadata\Reflect.js:130:24)
at Object.__decorate (\node_modules\tslib\tslib.js:92:96)
at Object.<anonymous> (\src\main.ts:9:22)
at Generator.next (<anonymous>)
My tool configuration is:
Node v12.16.1
TypeScript 3.8.2
ts-node 8.9.1
Solution
According to Judge user from the discord channel, I fixed this by adding brackets in the parentheses when calling Discord decorator in this way:
import { Discord } from '@typeit/discord';
@Discord({}) // Decorate the class with brackets in parentheses
abstract class AppDiscord {}
Maybe it'll be useful for someone with the same versions of configuration tools.
Problem
When using the following code from the repository documentation:
My application crashes with the following error:
My tool configuration is:
Solution
According to Judge user from the discord channel, I fixed this by adding brackets in the parentheses when calling Discord decorator in this way:
Maybe it'll be useful for someone with the same versions of configuration tools.