Generics
Pre-release
Pre-release
Changes
- Now you also have to define the type of your cmd structure as Generic to the command class. This well help in inferring the type of each field properly when using
this.extract()
.
// commands/test.ts
export default class extends Command<[string, number|null]> {
constructor() {
super({
structure: ["string", "number|null"]
});
}
async execute() {
// one: string, two: number|null
const [one, two] = this.extract();
}
}