Make function Values take any[] instead of Value[]. TypeScript won't let you assign a function that only takes number/string etc. to (...args: Value[]) => Value, so make it take any.
let x: (...args: Value[]) => Value = Math.max // TypeScript will error
let x: (...args: any[]) => Value = Math.max // TypeScript is happy
Update evaluate's and simplify's definition to only take an object of Values instead of a Value (which can also be array/boolean/etc.)
Update evaluate functions to return a Value type instead of just number
Minor changes to make the type definitions more accurate
Add
operators.array
toParserOptions
Add types for
Parser.unaryOps
,Parser.functions
, andParser.consts
Add boolean and array to
Value
type, sinceevaluate
can return those.Make function
Value
s takeany[]
instead ofValue[]
. TypeScript won't let you assign a function that only takesnumber
/string
etc. to(...args: Value[]) => Value
, so make it take any.Update
evaluate
's andsimplify
's definition to only take an object ofValue
s instead of aValue
(which can also be array/boolean/etc.)Update
evaluate
functions to return aValue
type instead of justnumber