DefinitelyTyped/expr-eval/index.d.ts
Andy Hanson c21893d61a Update expr-eval for new linter
* Now warns if we `export =` a namespace
* `unified-signatures` no longer complains when static and non-static methods share a name
* Also change `values` paramters to be of type `Values` rather than `Value`
2017-01-10 11:44:39 -08:00

32 lines
991 B
TypeScript

// Type definitions for expr-eval 1.0
// Project: https://github.com/silentmatt/expr-eval#readme
// Definitions by: Connor Peet <https://github.com/connor4312>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type Value = number
| string
| ((...args: Value[]) => Value)
| { [propertyName: string]: Value };
interface Values {
[propertyName: string]: Value;
}
export class Parser {
constructor(options?: { allowMemberAccess?: boolean });
parse(expression: string): Expression;
evaluate(expression: string, values?: Values): number;
static parse(expression: string): Expression;
static evaluate(expression: string, values?: Values): number;
}
export interface Expression {
simplify(values?: Values): Expression;
evaluate(values?: Values): number;
substitute(values: Values): Expression;
symbols(): string[];
variables(): string[];
toJSFunction(params: string, values?: Values): (...args: Value[]) => number;
}