typing cleanup
This commit is contained in:
parent
9582d91ac1
commit
8befcc1ca1
|
@ -19,7 +19,7 @@ export const tokenizeMath = (cmd: string, modifiers: RollModifiers): [ReturnData
|
|||
loggingEnabled && log(LT.LOG, `Parsing roll ${cmd}`);
|
||||
|
||||
// Remove all spaces from the operation config and split it by any operator (keeping the operator in mathConf for fullSolver to do math on)
|
||||
const mathConf: MathConf[] = <MathConf[]> cmd
|
||||
const mathConf: MathConf[] = cmd
|
||||
.replace(cmdSplitRegex, '')
|
||||
.replace(internalWrapRegex, '')
|
||||
.replace(/ /g, '')
|
||||
|
|
|
@ -14,7 +14,7 @@ import { assertPrePostBalance } from 'src/artigen/utils/parenBalance.ts';
|
|||
// parseRoll(fullCmd, modifiers)
|
||||
// parseRoll handles converting fullCmd into a computer readable format for processing, and finally executes the solving
|
||||
export const parseRoll = (fullCmd: string, modifiers: RollModifiers): SolvedRoll => {
|
||||
const returnMsg = <SolvedRoll> {
|
||||
const returnMsg: SolvedRoll = {
|
||||
error: false,
|
||||
errorCode: '',
|
||||
errorMsg: '',
|
||||
|
|
|
@ -69,22 +69,22 @@ export const roll = (rollStr: string, modifiers: RollModifiers): RollSet[] => {
|
|||
reroll: {
|
||||
on: false,
|
||||
once: false,
|
||||
nums: <number[]> [],
|
||||
nums: [],
|
||||
},
|
||||
critScore: {
|
||||
on: false,
|
||||
range: <number[]> [],
|
||||
range: [],
|
||||
},
|
||||
critFail: {
|
||||
on: false,
|
||||
range: <number[]> [],
|
||||
range: [],
|
||||
},
|
||||
exploding: {
|
||||
on: false,
|
||||
once: false,
|
||||
compounding: false,
|
||||
penetrating: false,
|
||||
nums: <number[]> [],
|
||||
nums: [],
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import { getMatchingParenIdx } from 'artigen/utils/parenBalance.ts';
|
|||
export const fullSolver = (conf: MathConf[], wrapDetails = false): SolvedStep => {
|
||||
// Initialize PEMDAS
|
||||
const signs = ['^', '*', '/', '%', '+', '-'];
|
||||
const stepSolve = {
|
||||
const stepSolve: SolvedStep = {
|
||||
total: 0,
|
||||
details: '',
|
||||
containsCrit: false,
|
||||
|
@ -166,10 +166,11 @@ export const fullSolver = (conf: MathConf[], wrapDetails = false): SolvedStep =>
|
|||
stepSolve.details = conf[0].toString();
|
||||
} else {
|
||||
// Else fully populate the stepSolve with what was computed
|
||||
stepSolve.total = (<SolvedStep> conf[0]).total;
|
||||
stepSolve.details = (<SolvedStep> conf[0]).details;
|
||||
stepSolve.containsCrit = (<SolvedStep> conf[0]).containsCrit;
|
||||
stepSolve.containsFail = (<SolvedStep> conf[0]).containsFail;
|
||||
const tempConf = <SolvedStep> conf[0];
|
||||
stepSolve.total = tempConf.total;
|
||||
stepSolve.details = tempConf.details;
|
||||
stepSolve.containsCrit = tempConf.containsCrit;
|
||||
stepSolve.containsFail = tempConf.containsFail;
|
||||
}
|
||||
|
||||
// If this was a nested call, add on parens around the details to show what math we've done
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// EmojiConf is used as a structure for the emojis stored in config.ts
|
||||
export type EmojiConf = {
|
||||
name: string;
|
||||
aliases: Array<string>;
|
||||
aliases: string[];
|
||||
id: string;
|
||||
animated: boolean;
|
||||
deleteSender: boolean;
|
||||
|
|
Loading…
Reference in New Issue