Max
Max
Adding custom Roll class to CONFIG.Dice.rolls
Maybe some of you instantly see my issue and can be help with this problem. Any help that leads me into the right direction is greatly appreciated.
3 replies
Adding custom Roll class to CONFIG.Dice.rolls
I'm also passing a constructor to call the super function with my type
constructor(formula: string, data: RealRoll, options?: RollSR6["options"]) {
super(formula, data, options);
this.rollData = data;

console.log(`Shadowrun6 | Executing roll=[${formula}]`);

if (formula.indexOf("@initiative") > -1) {
console.debug("Shadowrun 6 | Initiative Roll detected");
this.rollData.rollType = RollType.Initiative;
}
}
constructor(formula: string, data: RealRoll, options?: RollSR6["options"]) {
super(formula, data, options);
this.rollData = data;

console.log(`Shadowrun6 | Executing roll=[${formula}]`);

if (formula.indexOf("@initiative") > -1) {
console.debug("Shadowrun 6 | Initiative Roll detected");
this.rollData.rollType = RollType.Initiative;
}
}
The actual error I get is
Type 'typeof RollSR6' is not assignable to type 'typeof Roll'.
Types of construct signatures are incompatible.
Type 'new (formula: string, data: RealRoll, options?: InexactPartial<Options> | undefined) => RollSR6' is not assignable to type 'new <D extends AnyObject = AnyObject>(formula: string, data?: D | undefined, options?: InexactPartial<Options> | undefined) => Roll<D>'.
Types of parameters 'data' and 'data' are incompatible.
Type 'D | undefined' is not assignable to type 'RealRoll'.
Type 'undefined' is not assignable to type 'RealRoll'.ts(2322)
Type 'typeof RollSR6' is not assignable to type 'typeof Roll'.
Types of construct signatures are incompatible.
Type 'new (formula: string, data: RealRoll, options?: InexactPartial<Options> | undefined) => RollSR6' is not assignable to type 'new <D extends AnyObject = AnyObject>(formula: string, data?: D | undefined, options?: InexactPartial<Options> | undefined) => Roll<D>'.
Types of parameters 'data' and 'data' are incompatible.
Type 'D | undefined' is not assignable to type 'RealRoll'.
Type 'undefined' is not assignable to type 'RealRoll'.ts(2322)
3 replies